Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const TracerDomain = "org.hypertrace.goagent"
TracerDomain represents the tracer name for the Hypertrace instrumentation
Variables ¶
View Source
var StartSpan = startSpan(otel.GetTracerProvider)
Functions ¶
func Init ¶
func Init(cfg *config.AgentConfig) func()
Init initializes opentelemetry tracing and returns a shutdown function to flush data immediately on a termination signal.
Example ¶
cfg := config.Load() cfg.ServiceName = config.String("my_example_svc") cfg.DataCapture.HttpHeaders.Request = config.Bool(true) cfg.Reporting.Endpoint = config.String("http://api.traceable.ai:9411/api/v2/spans") shutdown := Init(cfg) defer shutdown()
Output:
func RegisterService ¶
func RegisterService(serviceName string, resourceAttributes map[string]string) (sdk.StartSpan, error)
RegisterService creates tracerprovider for a new service and returns a func which can be used to create spans
Example ¶
cfg := config.Load() cfg.ServiceName = config.String("my_example_svc") cfg.DataCapture.HttpHeaders.Request = config.Bool(true) cfg.Reporting.Endpoint = config.String("http://api.traceable.ai:9411/api/v2/spans") cfg.Reporting.TraceReporterType = config.TraceReporterType_ZIPKIN shutdown := Init(cfg) _, err := RegisterService("custom_service", map[string]string{"test1": "val1"}) if err != nil { log.Fatalf("Error while initializing service: %v", err) } defer shutdown()
Output:
Types ¶
Click to show internal directories.
Click to hide internal directories.