-
Notifications
You must be signed in to change notification settings - Fork 0
Jaeger
samithiwat edited this page Feb 27, 2023
·
1 revision
Jaeger SDK is the code for start tracing the service's operation in distributed system
type JaegerConfig struct {
Host string `mapstructure:"host"`
Environment string `mapstructure:"env"`
ServiceName string `mapstructure:"service-name"`
}
name | description | example |
---|---|---|
Host | The host of the Jaeger in format http://hostname:port
|
http://localhost:14268 |
Environment | Environment of current service | local |
ServiceName | The name of service | gateway |
Initialize by calling gosdk.SetupTracer
if err := gosdk.SetupTracer(*JaegerConfig, tracerName){
// handle error
}
name | description | example |
---|---|---|
JaegerConfig | Jaeger Configuration | |
tracerName | name of the tracer | gateway |
Start to trace
newCtx, span := gosdk.StartTracer(tracerName, spanName, ctx, opt...)
if span != nil {
defer span.End()
}
name | description | example |
---|---|---|
tracerName | name of tracer | verify-ticket-handler |
spanName | name of span | verify-ticket |
ctx | context to pass to another service with span | |
opt | span start option (optional) |
name | description | example |
---|---|---|
newCtx | context from tracer | |
span | interface of span in tracer |