Document updated on Apr 18, 2024
Granular OpenTelemetry by endpoint
The OpenTelemetry configuration is declared at the service level, but in the Enterprise edition you have more granularity and you can override metrics and traces per endpoint and per backend as follows.
Endpoint Override of metrics and traces
The following example overrides some properties that could be declared at the service level, and changes the exporters defined there to use a different set.
While the proxy section can be defined in the Community edition, the exporters_override and backend sections are Enterprise only. Only a small set of settings are displayed in this example:
{
"endpoints": [
{
"endpoint": "/example",
"backend": [
{
"host": [
"example.com"
],
"url_pattern": "/example"
}
],
"extra_config": {
"telemetry/opentelemetry": {
"proxy": {
"disable_metrics": false,
"disable_traces": false
},
"backend": {
"metrics": {
"read_payload": false,
"static_attributes": [
{
"key":"my_metric_attr",
"value":"my_metric_val"
}
]
},
"exporters_override": {
"metric_reporting_period": 10,
"trace_sample_rate": 1,
"metric_exporters": [
"local_prometheus"
],
"trace_exporters": [
"debug_jaeger",
"newrelic",
"local_tempo"
]
}
}
}
}
]
}
Exporter names must be typed exactly as in the service level. The full set of options are:
Options to override OpenTelemetry settings at the endpoint level
backendobject- Reports the activity between KrakenD and each of your backend services. This is the more granular layer.
metricsobjectdetailed_connectionboolean- Whether you want to enable detailed metrics for the HTTP connection phase or not. Includes times to connect, DNS querying, and the TLS handshake.Defaults to
false disable_stageboolean- Whether to turn off the metrics or not. Setting this to
truemeans stop reporting any data.Defaults tofalse read_payloadboolean- Whether you want to enable metrics for the response reading payload or not (HTTP connection not taken into account).Defaults to
false round_tripboolean- Whether you want to enable metrics for the actual HTTP request for the backend or not (manipulation not taken into account). This is the time your backend needs to produce a result.Defaults to
false static_attributesarray- A list of tags or labels you want to associate with these metrics.Example:
[{"key":"my_metric_attr","value":"my_metric_val"}]
tracesobjectdetailed_connectionboolean- Whether you want to add detailed trace attributes for the HTTP connection phase or not. Includes times to connect, DNS querying, and the TLS handshake.Defaults to
false disable_stageboolean- Whether to turn off the traces or not. Setting this to
truemeans stop reporting any data.Defaults tofalse read_payloadboolean- Whether you want to add trace attributes for the response reading payload or not (HTTP connection not taken into account).Defaults to
false report_headersboolean- Whether you want to report the final headers that reached the backend.Defaults to
false round_tripboolean- Whether you want to add trace attributes for the actual HTTP request for the backend or not (manipulation not taken into account). This is the time your backend needs to produce a result.Defaults to
false static_attributesarray- A list of tags or labels you want to associate to these traces.Example:
[{"key":"my_trace_attr","value":"my_trace_val"}]
exporters_overrideobject- Override exporter configuration for this endpoint
metric_exportersarray- Overrides the metrics exporters used in this endpointExample:
["local_prometheus"] metric_reporting_periodinteger- Override how often you want to report and flush the metrics in seconds.
trace_exportersarray- Overrides the trace exporters used in this endpointExample:
["debug_jaeger","newrelic","local_tempo"] trace_sample_ratenumber- Overrides the sample rate for traces defines the percentage of reported traces. This option is key to reduce the amount of data generated (and resource usage), while you still can debug and troubleshoot issues. For instance, a number of
0.25will report a 25% of the traces seen in the system.Example:0.25
proxyobject- Reports the activity at the beginning of the proxy layer, including spawning the required requests to multiple backends, merging, endpoint transformation and any other internals of the proxy between the request processing and the backend communication
disable_metricsboolean- Whether you want to disable all metrics in this endpoint or not.Defaults to
false disable_tracesboolean- Whether you want to disable all traces in this endpoint or not.Defaults to
false metrics_static_attributesarray- Static attributes you want to pass for metrics.
report_headersboolean- Whether you want to report all headers that passed from the request to the proxy layer (
input_headerspolicy in the endpoint plus KrakenD’s headers).Defaults tofalse traces_static_attributesarray- Static attributes you want to pass for traces.
Backend Override of metrics and traces
For instance, you have a specific backend that is adding noise to your dashboards and you’d like to disable all layers:
{
"backend": [
{
"extra_config": {
"telemetry/opentelemetry": {
"proxy": {
"disable_metrics": true,
"disable_traces": true
},
"backend": {
"metrics": {
"disable_stage": true
},
"traces": {
"disable_stage": true
}
}
}
},
"url_pattern": "/noise",
"host": [
"example.com"
]
}
]
}
These are the options:
Options to override OpenTelemetry settings at the backend level
backendobject- Reports the activity between KrakenD and each of your backend services. This is the more granular layer.
metricsobjectdetailed_connectionboolean- Whether you want to enable detailed metrics for the HTTP connection phase or not. Includes times to connect, DNS querying, and the TLS handshake.Defaults to
false disable_stageboolean- Whether to turn off the metrics or not. Setting this to
truemeans stop reporting any data.Defaults tofalse read_payloadboolean- Whether you want to enable metrics for the response reading payload or not (HTTP connection not taken into account).Defaults to
false round_tripboolean- Whether you want to enable metrics for the actual HTTP request for the backend or not (manipulation not taken into account). This is the time your backend needs to produce a result.Defaults to
false static_attributesarray- a list of tags or labels you want to associate with these metrics.
see: https://www.krakend.io/docs/telemetry/opentelemetry/Example:[{"key":"my_metric_attr","value":"my_metric_val"}]Each item of static_attributes accepts the following properties:key* string- the key, tag, or label name you want to use.
see: https://www.krakend.io/docs/telemetry/opentelemetry/ value* string- the static value you want to assign to this key.
see: https://www.krakend.io/docs/telemetry/opentelemetry/
tracesobjectdetailed_connectionboolean- Whether you want to add detailed trace attributes for the HTTP connection phase or not. Includes times to connect, DNS querying, and the TLS handshake.Defaults to
false disable_stageboolean- Whether to turn off the traces or not. Setting this to
truemeans stop reporting any data.Defaults tofalse read_payloadboolean- Whether you want to add trace attributes for the response reading payload or not (HTTP connection not taken into account).Defaults to
false report_headersboolean- Whether you want to report the final headers that reached the backend.Defaults to
false round_tripboolean- Whether you want to add trace attributes for the actual HTTP request for the backend or not (manipulation not taken into account). This is the time your backend needs to produce a result.Defaults to
false static_attributesarray- a list of tags or labels you want to associate with these metrics.
see: https://www.krakend.io/docs/telemetry/opentelemetry/Example:[{"key":"my_metric_attr","value":"my_metric_val"}]Each item of static_attributes accepts the following properties:key* string- the key, tag, or label name you want to use.
see: https://www.krakend.io/docs/telemetry/opentelemetry/ value* string- the static value you want to assign to this key.
see: https://www.krakend.io/docs/telemetry/opentelemetry/
