Tracing
Module for collecting application trace according to [OpenTelemetry] standard(https://opentelemetry.io/docs/what-is-opentelemetry/) and export trace by gRPC in OTLP format.
gRPC¶
Module allows trace collection using gRPC protocol by means of GrpcSender
.
Зависимость build.gradle
:
Модуль:
HTTP¶
Module allows to collect trace using HTTP protocol by means of HttpSender
.
Зависимость build.gradle
:
Модуль:
Configuration¶
endpoint
is the only a required field, attributes from the attributes
field will be sent with each span.
Parameters described in the OpentelemetryGrpcExporterConfig
/OpentelemetryHttpExporterConfig
and OpentelemetryResourceConfig
classes:
tracing {
exporter {
endpoint = "http://localhost:4317" // (1)!
exportTimeout = "2s" // (2)!
scheduleDelay = "2s" // (3)!
maxExportBatchSize = 512 // (4)!
maxQueueSize = 1024 // (5)!
}
attributes { // (6)!
"service.name" = "example-service"
"service.namespace" = "kora"
}
}
- URL from OpenTelemetry service collector (required)
- Maximum time to wait for the collector to process telemetry
- Time between exporting telemetry to the collector
- Maximum number of telemetry within one export
- Maximum queue size of unsent telemetry
- Additional telemetry attributes
tracing:
exporter:
endpoint: http://localhost:4317 # (1)!
exportTimeout: 2s # (2)!
scheduleDelay: 2s # (3)!
maxExportBatchSize: 512 # (4)!
maxQueueSize: 1024 # (6)!
attributes: # (6)!
service.name: example-service
service.namespace: kora
- URL from OpenTelemetry service collector (required)
- Maximum time to wait for the collector to process telemetry
- Time between exporting telemetry to the collector
- Maximum number of telemetry within one export
- Maximum queue size of unsent telemetry
- Additional telemetry attributes
Trace collection configuration parameters are described in modules that include trace collection, e.g. HTTP server, HTTP client, etc.
Imperative tracing¶
In addition to automatically created spans, you can use the Tracer
object from the dependency container.
You can create a span with the current one in parent as follows: