Skip to content

Instantly share code, notes, and snippets.

🏊
trying to master freestyle

zhaohuabing zhaohuabing

🏊
trying to master freestyle
Block or report user

Report or block zhaohuabing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View DBAccess.java
@Component
public class DBAccess {
@Traced
public void save2db() {
try {
Thread.sleep((long) (Math.random() * 100));
} catch (InterruptedException e) {
e.printStackTrace();
}
View TracingAspect.java
@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();
View jaeger.yaml
apiVersion: v1
kind: Service
metadata:
name: jaeger-query
namespace: istio-system
annotations:
labels:
app: jaeger
jaeger-infra: jaeger-service
chart: tracing
View tracer.java
@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 Aug 24, 2019
Enhance Istio Distributed Tracing with OpenTracing-eshop-checkout
View eshop-checkout.java
@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 Jul 19, 2019
Split TCP from HTTP traffic by listener filters
View gist:7abaf8e00d2ab8978dc3e5d890fcc637
{
"version_info": "0",
"listener": {
"name": "0.0.0.0_1030",
"address": {
"socket_address": {
"address": "0.0.0.0",
"port_value": 1030
}
},
View envoy config dump-details
{
"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",
View pilot eds dump
[
{
"clusterName": "outbound|15011||istio-pilot.istio-system.svc.cluster.local",
"endpoints": [
{
"locality": {
},
"lbEndpoints": [
{
View envoy bootstrap config
{
"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",
View envoy config dump
{
"configs": {
"listeners": {
"@type": "type.googleapis.com/envoy.admin.v2alpha.ListenersConfigDump",
"version_info": "2018-09-27T07:17:49Z",
"dynamic_active_listeners": [
{
"version_info": "2018-09-06T09:34:19Z",
"listener": {
"name": "10.103.219.158_9102",
You can’t perform that action at this time.