Skip to content

Instantly share code, notes, and snippets.

View zhaohuabing's full-sized avatar
💭
I may be slow to respond.

Huabing Zhao zhaohuabing

💭
I may be slow to respond.
View GitHub Profile
{
"name": "ztunnel_outbound",
"active_state": {
"version_info": "2022-09-13T11:17:20Z/5",
"listener": {
"@type": "type.googleapis.com/envoy.config.listener.v3.Listener",
"name": "ztunnel_outbound",
"address": {
"socket_address": {
"address": "0.0.0.0",
@Component
public class DBAccess {
@Traced
public void save2db() {
try {
Thread.sleep((long) (Math.random() * 100));
} catch (InterruptedException e) {
e.printStackTrace();
}
@Aspect
@Component
public class TracingAspect {
@Autowired
Tracer tracer;
@Around("@annotation(com.zhaohuabing.demo.instrument.Traced)")
public Object aroundAdvice(ProceedingJoinPoint jp) throws Throwable {
String class_name = jp.getTarget().getClass().getName();
String method_name = jp.getSignature().getName();
apiVersion: v1
kind: Service
metadata:
name: jaeger-query
namespace: istio-system
annotations:
labels:
app: jaeger
jaeger-infra: jaeger-service
chart: tracing
@Bean
public Tracer jaegerTracer() {
// The following environment variables need to set
// JAEGER_ENDPOINT="http://10.42.126.171:28019/api/traces"
// JAEGER_PROPAGATION="b3"
// JAEGER_TRACEID_128BIT="true" Use 128bit tracer id to be compatible with the
// trace id generated by istio/envoy
return Configuration.fromEnv("eshop-opentracing").getTracer();
}
@zhaohuabing
zhaohuabing / eshop-checkout.java
Last active August 24, 2019 02:08
Enhance Istio Distributed Tracing with OpenTracing-eshop-checkout
@RequestMapping(value = "/checkout")
public String checkout(@RequestHeader HttpHeaders headers) {
  String result = "";
  // Use HTTP GET in this demo. In a real world use case,We should use HTTP POST
  // instead.
  // The three services are bundled in one jar for simplicity. To make it work,
  // define three services in Kubernets.
  result += restTemplate.exchange("http://inventory:8080/createOrder", HttpMethod.GET,
  new HttpEntity<>(passTracingHeader(headers)), String.class).getBody();
  result += "<BR>";
@zhaohuabing
zhaohuabing / gist:7abaf8e00d2ab8978dc3e5d890fcc637
Created July 19, 2019 02:30
Split TCP from HTTP traffic by listener filters
{
"version_info": "0",
"listener": {
"name": "0.0.0.0_1030",
"address": {
"socket_address": {
"address": "0.0.0.0",
"port_value": 1030
}
},
{
"configs": [
{
"@type": "type.googleapis.com/envoy.admin.v2alpha.BootstrapConfigDump",
"bootstrap": {
"node": {
"id": "sidecar~10.40.0.17~ratings-v1-f745cf57b-kx8lf.default~default.svc.cluster.local",
"cluster": "ratings.default",
"metadata": {
"ISTIO_PROXY_SHA": "istio-proxy:c33dc49585e5e7b5f616c8b5377a5f1f52505e20",
[
{
"clusterName": "outbound|15011||istio-pilot.istio-system.svc.cluster.local",
"endpoints": [
{
"locality": {
},
"lbEndpoints": [
{
{
"node": {
"id": "sidecar~192.168.206.23~productpage-v1-54b8b9f55-bx2dq.default~default.svc.cluster.local",
"cluster": "productpage",
"metadata": {
"INTERCEPTION_MODE": "REDIRECT",
"ISTIO_PROXY_SHA": "istio-proxy:6166ae7ebac7f630206b2fe4e6767516bf198313",
"ISTIO_PROXY_VERSION": "1.0.0",
"ISTIO_VERSION": "1.0.0",