Documentation
¶
Overview ¶
Package otlpjson sends spans to an OTLP/HTTP endpoint in OTLP's JSON encoding (POST {endpoint}/v1/traces, application/json), over net/http alone. It is the exporter of a program that cannot carry the OTLP exporters' protobuf and gRPC code, such as Tacklr on Cloudflare Workers (js/wasm), where net/http sends through fetch. Install sets up the process-wide tracer with it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Headers ¶
Headers parses OTEL_EXPORTER_OTLP_HEADERS ("k1=v1,k2=v2", values URL-encoded, as the OpenTelemetry environment variables give them).
func Install ¶
func Install(e *Exporter, service string) *sdktrace.TracerProvider
Install installs the process-wide tracer provider, exporting through e in batches, with the W3C propagator and parent-based sampling, as export.Init does for a host process. It returns the provider: Flush it when the platform may stop the program, and Shutdown it at the end.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter is an sdktrace.SpanExporter to one OTLP/HTTP endpoint.
func New ¶
New exports to endpoint (the OTLP/HTTP base URL, such as https://otlp.example.com/otlp), with headers on each request (an API key). A nil client is http.DefaultClient.
func (*Exporter) ExportSpans ¶
ExportSpans implements sdktrace.SpanExporter: one request for the batch.