Skip to main content

Metrics

Export Metrics on your APIs with Traefik Hub & Open Telemetry


Introduction

Traefik Hub uses OpenTelemetry (sometimes referred to as OTel). Open Telemetry is an open-source observability framework that allows you to collect, process, and export telemetry data from applications and infrastructure. Open Telemetry helps you get insights into system performance and behavior.

Read More

At any point while reading this documentation you need additional information on OpenTelemetry, you can refer to its official documentation.

Metrics are used to measure and record quantitative data about the performance and behavior of your APIs. Metrics are aggregated over time, allowing you to understand trends and patterns.

Traefik Hub exposes different kinds of metrics:

Good to know

Metrics do not provide detailed information about individual requests or transactions. Metrics provide aggregated information about the overall system or application.

Configuration

To enable OpenTelemetry, you have to adjust the default configuration of your Traefik Hub Gateway Helm Chart with the dedicated options, like in the following examples.

Traefik Hub Gateway Helm Chart values.yaml
metrics:
otlp:
enabled: true
http:
enabled: true
endpoint: "http://myotlpcollector:4318"

Adjust the Configuration

To adjust the default configuration, please refer to the values files of the Chart.


Dataflow Metrics

MetricTypeDescription
traefik_hub_api_requests_totalCounterThe number of handled API requests.
traefik_hub_api_requests_duration_milliseconds_sum traefik_hub_api_requests_duration_milliseconds_count traefik_hub_api_requests_duration_milliseconds_bucketHistogramProcessing duration histograms.
traefik_hub_api_requests_bytes_totalCounterRequests size (in bytes) handled by APIs (body size).
traefik_hub_api_responses_bytes_totalCounterResponses size (in bytes) handled by APIs (body size).

Labels

Labels, also known as tags or dimensions, are key-value pairs that provide context to metrics. Labels add additional information to your metrics and traces, allowing you to segment and filter data to gain more insights.

LabelDescriptionExample
codeRequest code"200"
methodRequest Method"GET"
protocolRequest protocol"http", "grpc", ...
user_idUnique user identifier"645133c75d2aee16b07ef3da"
The user_id holds the internal ID or the JWT ID, depending on where the user comes from.
emailUser email"[email protected]"
The owner of the API Key or Application consuming the API.
token_nameName of the API key used to authenticate."my-test-token"
api_nameName of the API."flight-api"
api_version_nameThe version of the API."flight-api-v2"
api_namespaceNamespace of the API."airlines"
tls_versionTLS version used for the request."1.0"
tls_cipherTLS cipher used for the request."TLS_FALLBACK_SCSV"

API Management Metrics

MetricTypeLabelsDescription
traefik_hub_apis_ratioGaugeapi_namespaceNumber of APIs.
traefik_hub_apis_bundle_ratioGauge-Number of API Bundles.
traefik_hub_apis_plans_ratioGauge-Number of API Plans.
traefik_hub_api_portal_apis_ratioGauge-Number of APIs published on API Portals.