Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Jaeger | 17,352 | 15 | 139 | 5 hours ago | 290 | September 16, 2022 | 330 | apache-2.0 | Go | |
CNCF Jaeger, a Distributed Tracing Platform | ||||||||||
Gf | 9,043 | 7 | 232 | a day ago | 509 | August 22, 2022 | 67 | mit | Go | |
GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang. | ||||||||||
Opentracing Go | 3,445 | 2,041 | 3,564 | 10 days ago | 17 | February 28, 2022 | 27 | apache-2.0 | Go | |
OpenTracing API for Go. 🛑 This library is DEPRECATED! https://github.com/opentracing/specification/issues/163 | ||||||||||
Stabilityguide | 2,776 | 10 days ago | other | |||||||
【稳定大于一切】打造国内稳定性领域知识库,让无法解决的问题少一点点,让世界的确定性多一点点。 | ||||||||||
Stagemonitor | 1,695 | 11 | 8 | a month ago | 47 | April 06, 2020 | 85 | apache-2.0 | Java | |
an open source solution to application performance monitoring for java server applications | ||||||||||
Opentracing Tutorial | 1,532 | 3 | 4 months ago | 10 | April 21, 2021 | 28 | apache-2.0 | Java | ||
A collection of tutorials for the OpenTracing API | ||||||||||
Opentracing Javascript | 1,068 | 7,360 | 271 | a year ago | 40 | January 06, 2022 | 34 | apache-2.0 | TypeScript | |
OpenTracing API for Javascript (both Node and browser) | ||||||||||
Jaeger Ui | 896 | 2 | 2 days ago | 7 | March 19, 2019 | 197 | apache-2.0 | JavaScript | ||
Web UI for Jaeger | ||||||||||
Molten | 694 | 3 years ago | 49 | apache-2.0 | C | |||||
php probe for zipkin and opentracing | ||||||||||
Mortar | 645 | 7 | a month ago | 37 | May 30, 2022 | mit | Go | |||
Mortar is a GO framework/library for building gRPC (and REST) web services. |
This package is a Go platform API for OpenTracing.
In order to understand the Go platform API, one must first be familiar with the OpenTracing project and terminology more specifically.
Everyday consumers of this opentracing
package really only need to worry
about a couple of key abstractions: the StartSpan
function, the Span
interface, and binding a Tracer
at main()
-time. Here are code snippets
demonstrating some important use cases.
The simplest starting point is ./default_tracer.go
. As early as possible, call
import "github.com/opentracing/opentracing-go"
import ".../some_tracing_impl"
func main() {
opentracing.SetGlobalTracer(
// tracing impl specific:
some_tracing_impl.New(...),
)
...
}
If you prefer direct control to singletons, manage ownership of the
opentracing.Tracer
implementation explicitly.
context.Context
If you use context.Context
in your application, OpenTracing's Go library will
happily rely on it for Span
propagation. To start a new (blocking child)
Span
, you can use StartSpanFromContext
.
func xyz(ctx context.Context, ...) {
...
span, ctx := opentracing.StartSpanFromContext(ctx, "operation_name")
defer span.Finish()
span.LogFields(
log.String("event", "soft error"),
log.String("type", "cache timeout"),
log.Int("waited.millis", 1500))
...
}
It's always possible to create a "root" Span
with no parent or other causal
reference.
func xyz() {
...
sp := opentracing.StartSpan("operation_name")
defer sp.Finish()
...
}
func xyz(parentSpan opentracing.Span, ...) {
...
sp := opentracing.StartSpan(
"operation_name",
opentracing.ChildOf(parentSpan.Context()))
defer sp.Finish()
...
}
func makeSomeRequest(ctx context.Context) ... {
if span := opentracing.SpanFromContext(ctx); span != nil {
httpClient := &http.Client{}
httpReq, _ := http.NewRequest("GET", "http://myservice/", nil)
// Transmit the span's TraceContext as HTTP headers on our
// outbound request.
opentracing.GlobalTracer().Inject(
span.Context(),
opentracing.HTTPHeaders,
opentracing.HTTPHeadersCarrier(httpReq.Header))
resp, err := httpClient.Do(httpReq)
...
}
...
}
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
var serverSpan opentracing.Span
appSpecificOperationName := ...
wireContext, err := opentracing.GlobalTracer().Extract(
opentracing.HTTPHeaders,
opentracing.HTTPHeadersCarrier(req.Header))
if err != nil {
// Optionally record something about err here
}
// Create the span referring to the RPC client if available.
// If wireContext == nil, a root span will be created.
serverSpan = opentracing.StartSpan(
appSpecificOperationName,
ext.RPCServerOption(wireContext))
defer serverSpan.Finish()
ctx := opentracing.ContextWithSpan(context.Background(), serverSpan)
...
}
log.Noop
In some situations, you may want to dynamically decide whether or not to log a field. For example, you may want to capture additional data, such as a customer ID, in non-production environments:
func Customer(order *Order) log.Field {
if os.Getenv("ENVIRONMENT") == "dev" {
return log.String("customer", order.Customer.ID)
}
return log.Noop()
}
The entire public API is goroutine-safe and does not require external synchronization.
Tracing system implementors may be able to reuse or copy-paste-modify the basictracer
package, found here. In particular, see basictracer.New(...)
.
For the time being, "mild" backwards-incompatible changes may be made without changing the major version number. As OpenTracing and opentracing-go
mature, backwards compatibility will become more of a priority.
A test suite is available in the harness package that can assist Tracer implementors to assert that their Tracer is working correctly.