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)!
connectTimeout = "60s" //(2)!
exportTimeout = "3s" //(3)!
scheduleDelay = "2s" //(4)!
maxExportBatchSize = 512 //(5)!
maxQueueSize = 2048 //(6)!
batchExportTimeout = "30s" //(7)!
compression = "gzip" //(8)!
exportUnsampledSpans = false //(9)!
retry {
maxAttempts = 5 //(10)!
initialBackoff = "1s" //(11)!
maxBackoff = "5s" //(12)!
backoffMultiplier = 1.5 //(13)!
}
}
attributes { //(14)!
"service.name" = "example-service"
"service.namespace" = "kora"
}
}
- URL from OpenTelemetry service collector (mandatory)
- Time to wait for connection to exporter
- Maximum time to wait for telemetry processing by collector
- Time between exporting telemetry to the collector
- Maximum number of telemetry within one export
- Maximum queue size of unsent telemetry
- Maximum waiting time for export
- Telemetry compression mechanism when exporting
- Whether to export unsampled telemetry
- Maximum number of export attempts
- Initial value of waiting time before next export attempt
- Maximum wait value before next export attempt
- Waiting delay value multiplier
- Additional telemetry attributes
Translated with DeepL.com (free version)
tracing:
exporter:
endpoint: http://localhost:4317 #(1)!
connectTimeout: 60s #(2)!
exportTimeout: 3s #(3)!
scheduleDelay: 2s #(4)!
maxExportBatchSize: 512 #(5)!
maxQueueSize: 2048 #(6)!
batchExportTimeout: 30s #(7)!
compression: gzip #(8)!
exportUnsampledSpans: false #(9)!
retry:
maxAttempts: 5 #(10)!
initialBackoff: 1s #(11)!
maxBackoff: 5s #(12)!
backoffMultiplier: 1.5 #(13)!
attributes: #(14)!
service.name: example-service
service.namespace: kora
- URL from OpenTelemetry service collector (mandatory)
- Time to wait for connection to exporter
- Maximum time to wait for telemetry processing by collector
- Time between exporting telemetry to the collector
- Maximum number of telemetry within one export
- Maximum queue size of unsent telemetry
- Maximum waiting time for export
- Telemetry compression mechanism when exporting
- Whether to export unsampled telemetry
- Maximum number of export attempts
- Initial value of waiting time before next export attempt
- Maximum wait value before next export attempt
- Waiting delay value multiplier
- 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: