Case Study lastminute.com Case Study: Success Story

Document updated on Oct 18, 2024

Granular OpenTelemetry by endpoint

The OpenTelemetry configuration is declared at the service level, but you can override metrics and traces per endpoint and per backend as follows.

Endpoint override of metrics and traces

The following example overrides properties that could be declared at the service level.

{
    "endpoints": [
        {
            "endpoint": "/example",
            "backend": [
                {
                    "host": [
                        "example.com"
                    ],
                    "url_pattern": "/example"
                }
            ],
            "extra_config": {
                "telemetry/opentelemetry": {
                    "proxy": {
                        "disable_metrics": false,
                        "disable_traces": false,
                        "report_headers": true,
                        "traces_static_attributes": [
                          {
                            "key": "owner",
                            "value": "team-charlie"
                          }
                        ],
                        "metrics_static_attributes": [
                          {
                            "key": "owner",
                            "value": "team-charlie"
                          }
                        ]
                    }
                }
            }
        }
    ]
}

The full list of options is:

OpenTelemetry settings per endpoint
* required fields

proxy object
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_metrics boolean
Whether you want to disable all metrics in this endpoint or not.
Defaults to false
disable_traces boolean
Whether you want to disable all traces in this endpoint or not.
Defaults to false
metrics_static_attributes array
Static attributes you want to pass for metrics.
Each item is an object with the following properties:
key string
The key of the static attribute you want to send
value string
The value of the static attribute you want to send
report_headers boolean
Whether you want to report all headers that passed from the request to the proxy layer (input_headers policy in the endpoint plus KrakenD’s headers).
Defaults to false
traces_static_attributes array
Static attributes you want to pass for traces.
Each item is an object with the following properties:
key string
The key of the static attribute you want to send
value string
The value of the static attribute you want to send

In the Enterprise Edition you have more override options, like override entirely the exporter you want to use.

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:

OpenTelemetry settings per backend
* required fields

backend object
Reports the activity between KrakenD and each of your backend services. This is the more granular layer.
metrics object
detailed_connection boolean
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_stage boolean
Whether to turn off the metrics or not. Setting this to true means stop reporting any data.
Defaults to false
read_payload boolean
Whether you want to enable metrics for the response reading payload or not (HTTP connection not taken into account).
Defaults to false
round_trip boolean
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_attributes array
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"}]
traces object
detailed_connection boolean
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_stage boolean
Whether to turn off the traces or not. Setting this to true means stop reporting any data.
Defaults to false
read_payload boolean
Whether you want to add trace attributes for the response reading payload or not (HTTP connection not taken into account).
Defaults to false
report_headers boolean
Whether you want to report the final headers that reached the backend.
Defaults to false
round_trip boolean
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_attributes array
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"}]

Contribute to KrakenD Documentation. Improve this page »

Scarf

Unresolved issues?

The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.

See all support channels