VictoriaTraces supports both client open-telemetry SDK and collector .
Client SDK #
The OpenTelemetry provides detailed document and examples for various programming languages:
You can send data to VictoriaTraces by HTTP or gRPC endpoints.
HTTP endpoint #
To send data by HTTP endpoint, specify the EndpointURL for http-exporter builder to http://<victoria-traces>:10428/insert/opentelemetry/v1/traces.
Consider the following example for Go SDK:
traceExporter, err := otlptracehttp.New(ctx,
otlptracehttp.WithEndpointURL("http://<victoria-traces>:10428/insert/opentelemetry/v1/traces"),
)
gRPC endpoint #
To send the trace data to VictoriaTraces gRPC trace service, you need to first enable the OTLP gRPC server on VictoriaTraces by:
./victoria-traces -otlpGRPCListenAddr=:4317 -otlpGRPC.tls -otlpGRPC.tlsCertFile=<cert_file> -otlpGRPC.tlsKeyFile=<key_file>
TLS is disabled for incoming gRPC requests if -otlpGRPC.tls isn’t set. TLS is recommended for production use, and disabling it should only be done when you’re testing or aware of the potential risks.
After that, specify the Endpoint for grpc-exporter builder to <victoria-traces>:4317.
Consider the following example for Go SDK:
traceExporter, err := otlptracegrpc.New(ctx,
otlptracegrpc.WithEndpoint("<victoria-traces>:4317"),
otlptracegrpc.WithTLSCredentials(<creds>),
// otlptracegrpc.WithInsecure(), // use insecure connection if TLS is disabled.
)
VictoriaTraces supports other HTTP headers in both HTTP and gRPC endpoints - see HTTP headers .
VictoriaTraces automatically use service.name in resource attributes and name in span as
stream fields
.
While the remaining data (including resource
, instrumentation scope
, and fields in span
, like trace_id, span_id, span attributes and more) are stored as
regular fields
:
The ingested trace spans can be queried according to these docs .
Collector configuration #
VictoriaTraces supports receiving traces from the following OpenTelemetry collector:
OpenTelemetry #
HTTP exporter #
To send the collected traces to VictoriaTraces HTTP endpoint, specify traces endpoint for OTLP/HTTP exporter in configuration file:
exporters:
otlphttp:
traces_endpoint: http://<victoria-traces>:10428/insert/opentelemetry/v1/traces
VictoriaTraces supports various HTTP headers, which can be used during data ingestion - see the list of
HTTP headers
.
These headers can be passed to OpenTelemetry exporter config via headers options. For example, the following configs add (or overwrites) foo: bar field to each trace span during data ingestion:
exporters:
otlphttp:
traces_endpoint: http://<victoria-traces>:10428/insert/opentelemetry/v1/traces
headers:
VT-Extra-Fields: foo=bar
gRPC exporter #
To send the collected traces to VictoriaTraces gRPC trace service, you need to first enable the OTLP gRPC server on VictoriaTraces by:
./victoria-traces -otlpGRPCListenAddr=:4317 -otlpGRPC.tls -otlpGRPC.tlsCertFile=<cert_file> -otlpGRPC.tlsKeyFile=<key_file>
TLS is disabled for incoming gRPC requests if -otlpGRPC.tls isn’t set. TLS is recommended for production use, and disabling it should only be done when you’re testing or aware of the potential risks.
After that, specify endpoint for OTLP/gRPC exporter :
exporters:
# otlp exporter with TLS
otlp/with-tls:
endpoint: <victoria-traces>:4317
tls:
cert_file: file.cert
key_file: file.key
# otlp exporter without TLS
otlp/without-tls:
endpoint: <victoria-traces>:4317
tls:
insecure: true
Optionally, you can specify the compression type to one of the following: gzip (default), snappy, zstd, and none.
As same as HTTP endpoint, gRPC also support various HTTP headers. For example, the following configs add (or overwrites) foo: bar field to each trace span during data ingestion:
exporters:
otlp/without-tls:
endpoint: <victoria-traces>:4317
tls:
insecure: true
headers:
VT-Extra-Fields: foo=bar
See also: