Document updated on Jan 22, 2024
OpenCensus Telemetry Integration
KrakenD has traditionally offered its telemetry integration through this OpenCensus component, which has provided reliable service for over six years, but now is transitioning to the more modern and robust OpenTelemetry framework.
As a result of a change in the industry, the OpenCensus integration is no longer mantained, and all efforts are focused on OpenTelemetry.
The Opencensus exporter is a single component that allows you to export data to multiple providers, both open source and privative.
You will be interested in Opencensus when you want to see data in one of its supported exporters
. For instance, you might want to send metrics to Prometheus. That would be as easy as adding this snippet in the root level of your krakend.json
file:
{
"version": 3,
"extra_config": {
"telemetry/opencensus": {
"exporters": {
"prometheus": {
"port": 9091,
"namespace": "krakend"
}
}
}
}
}
Configuration
The Opencensus needs at least an exporter to work, although multiple exporters can be added in the same configuration. Notice that adding several exporters that push metrics out to multiple systems will affect the performance of the server.
Every exporter has its own configuration and it’s described in its section.
By default, all exporters use a sample_rate=0
, meaning that they won’t report anything, but this can be changed by specifying the configuration another percentage, like 100% of the activity:
{
"version": 3,
"extra_config": {
"telemetry/opencensus": {
"sample_rate": 100,
"reporting_period": 0,
"enabled_layers": {
"backend": true,
"router": true,
"pipe": true
},
"exporters": {
"prometheus": {
"port": 9091
}
}
}
}
}
Fields of Telemetry via Opencensus
enabled_layers
- Lets you specify what data you want to export. All layers are enabled by default unless you declare this section.
backend
boolean- Reports the activity between KrakenD and your servicesDefaults to
false
pipe
boolean- Reports the activity at the beginning of the proxy layer. It gives a more detailed view of the internals of the pipe between end-users and KrakenD, having into account merging of different backends.Defaults to
false
router
boolean- Reports the activity between end-users and KrakenDDefaults to
false
exporters
* object- The exporter(s) you would like to enable. See each exporter configuration in its own section.
reporting_period
integer- The number of seconds passing between reports. If duration is less than or equal to zero, it enables the default behavior of each exporter.Defaults to
0
sample_rate
integer- A number between 0 (no requests at all) and 100 (all requests) representing the percentage of sampled requests you want to send to the exporter. Sampling the 100% of the requests is generally discouraged when the relationship between traffic and dedicated resources is sparse.Defaults to
0
Transition from OpenCensus
If you have been using telemetry on KrakenD for the past six years (before KrakenD 2.6), you were using the OpenCensus exporters, which have worked like a Swiss clock.
While OpenCensus has been working very well, it has merged with OpenTracing to form OpenTelemetry, which serves as the next major version of OpenCensus and OpenTracing.
While our OpenCensus integration will keep functioning on KrakenD for now, it won’t receive additional updates (netiher security fixes), so we recommend replacing it with OpenTelemetry.
Contribute to KrakenD Documentation. Improve this page »