- Discuss the role of Observability (Logging; Tracing; and Metric) in modern architecture.
- How to implement observability in Golang using OpenCensus.
- The 4 golden signals when designing the metrics.
- How to apply observability into the process.
38. OpenCensus sample rules
The OpenCensus use the head-based sampling with following rules:
1. If the span is a root Span:
• If a "span-scoped" Sampler is provided, use it to determine the sampling decision.
• Else use the global default Sampler to determine the sampling decision.
2. If the span is a child of a remote Span:
• If a "span-scoped" Sampler is provided, use it to determine the sampling decision.
• Else use the global default Sampler to determine the sampling decision.
3. If the span is a child of a local Span:
• If a "span-scoped" Sampler is provided, use it to determine the sampling decision.
• Else keep the sampling decision from the parent.
Disadvantages:
- Might lost some useful data.
- Can be Wixed by using the tail-based approach on the OpenCensus collector.
References:
- https://github.com/census-instrumentation/opencensus-specs/blob/master/
trace/Sampling.md
- https://sWlanders.net/2019/04/17/intelligent-sampling-with-opencensus/
71. Sample project
1. Repository: https://github.com/tsocial/distributed_tracing_demo
- Test with Gorm/Redis
- Test tracing with console exporter
- Test with Jaeger /Prometheus
- Call external service
- Call internal service
- TODO: test with OpenCensus service
2. Repository:
https://github.com/census-instrumentation/opencensus-service/blob/master/demos/trace/
docker-compose.yaml
- Test with OpenCensus service
- Multiple internal services
- Jaeger / Prometheus / Zipkin …