Configure Beyla Prometheus and OpenTelemetry data export
Beyla can export OpenTelemetry metrics and traces to a OTLP endpoint.
To send metrics directly to the Grafana Cloud OpenTelemetry endpoint, see the Grafana Cloud OTLP endpoint configuration.
Grafana Cloud OTLP endpoint
YAML section: grafana.otlp
You can configure the component under the grafana.otlp section of your YAML configuration or via environment variables.
You can configure Beyla to submit OpenTelemetry data to the Grafana Cloud OTEL endpoint using custom variables, allowing an easier setup of the endpoint and the authentication.
For more information on the Grafana Cloud OTLP endpoint, refer to the Send data to the Grafana Cloud OTLP endpoint documentation.
For example:
grafana:
otlp:
cloud_submit: ["metrics", "traces"]
cloud_zone: "eu-west-23"
cloud_instance_id: "12345"
cloud_api_key: "abcde"You can also use the standard OpenTelemetry variables to submit the metrics and traces to any standard OpenTelemetry endpoint, including Grafana Cloud.
Cloud zone configuration
If any of the OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT variables are defined, they override the destination endpoint, and Beyla ignores the cloud_zone configuration option.
OpenTelemetry metrics exporter component
YAML section: otel_metrics_export
Enable the OpenTelemetry metrics export component by setting the endpoint attribute in your configuration file or via an environment variable, refer to metric export configuration options.
Configure the component under the otel_metrics_export section of your YAML configuration or via environment variables.
In addition to the configuration documented in this article, the component supports environment variables from the standard OpenTelemetry exporter configuration.
For example:
otel_metrics_export:
ttl: 5m
endpoint: http://otelcol:4318
protocol: grpc
features: ["network", "network_inter_zone"]
buckets:
duration_histogram: [0, 1, 2]
histogram_aggregation: base2_exponential_bucket_histogramMetrics export protocol
If you don’t set a protocol Beyla sets the protocol as follows:
grpc: if the port ends in4317, for example4317,14317, or24317.http/protobuf: if the port ends in4318, for example4318,14318, or24318.
Metrics export features
The Beyla metrics exporter can export the following metrics data groups for processes matching entries in the metrics discovery configuration.
application: Application-level metricsapplication_spanApplication-level trace span metricsapplication_hostApplication-level host metrics for host based pricingapplication_service_graph: Application-level service graph metrics. It’s recommended to use a DNS for service discovery and to ensure the DNS names match the OpenTelemetry service names Beyla uses. In Kubernetes environments, the OpenTelemetry service name set by the service name discovery is the best choice for service graph metrics.application_process: Metrics about the processes that runs the instrumented applicationnetwork: Network-level metrics, refer to the network metrics configuration documentation to learn morenetwork_inter_zone: Network inter-zone metrics, refer to the network metrics configuration documentation to learn more
Metrics instrumentation
The list of instrumentation areas Beyla can collection data from:
*: all instrumentation, if*is present Beyla ignores other valueshttp: HTTP/HTTPS/HTTP2 application metricsgrpc: gRPC application metricssql: SQL database client call metricsredis: Redis client/server database metricskafka: Kafka client/server message queue metricsmongodb: MongoDB client/server database metrics
For example, setting the instrumentations option to: http,grpc enables the collection of HTTP/HTTPS/HTTP2 and gRPC application metrics, and disables other instrumentation.
OpenTelemetry traces exporter component
YAML section: otel_traces_export
You can configure the component under the otel_traces_export section of your YAML configuration or via environment variables.
In addition to the configuration documented in this article, the component supports the environment variables from the standard OpenTelemetry exporter configuration.
otel_traces_export:
endpoint: http://jaeger:4317
protocol: grpc
instrumentations: ["http, "sql"]Traces export protocol
If you don’t set a protocol Beyla sets the protocol as follows:
grpc: if the port ends in4317, for example4317,14317, or24317.http/protobuf: if the port ends in4318, for example4318,14318, or24318.
Traces instrumentation
The list of instrumentation areas Beyla can collection data from:
*: all instrumentation, if*is present Beyla ignores other valueshttp: HTTP/HTTPS/HTTP2 application tracesgrpc: gRPC application tracessql: SQL database client call tracesredis: Redis client/server database traceskafka: Kafka client/server message queue tracesmongodb: MongoDB client/server database traces
For example, setting the instrumentations option to: http,grpc enables the collection of HTTP/HTTPS/HTTP2 and gRPC application traces, and disables other instrumentation.
Prometheus exporter component
YAML section: prometheus_export
You can configure the component under the prometheus_export section of your YAML configuration or via environment variables.
This component opens an HTTP endpoint in the auto-instrumentation tool that allows any external scraper to pull metrics in Prometheus format. It is enabled if the port property is set.
Note
The Prometheus scraper might override the values of the
instanceandjoblabels. To keep the original values as set by Beyla, refer to the Grafana Alloy Prometheus scraper component documentation.
prometheus_export:
port: 8999
path: /metrics
extra_resource_attributes: ["deployment_environment"]
ttl: 1s
buckets:
request_size_histogram: [0, 10, 20, 22]
response_size_histogram: [0, 10, 20, 22]
features:
- application
- network
- application_process
- application_span
- application_service_graph
instrumentations: ["http, "sql"]Prometheus extra resource attributes
Due to internal limitations of the Prometheus API client, Beyla needs to know beforehand which attributes are exposed for each metric. This would cause that some attributes that are discovered at runtime, during instrumentation, won’t be visible by default. For example, attributes defined on each application via Kubernetes annotations, or in the target application’s OTEL_RESOURCE_ATTRIBUTES environment variable.
For example, an application defining the OTEL_RESOURCE_ATTRIBUTES=deployment.environment=production as environment variable, the target_info{deployment.environment="production"} attribute would be visible by default if the metrics are exported via OpenTelemetry but not if they are exported via Prometheus.
To make deployment_environment visible in Prometheus, you need to add it to the extra_resource_attributes list.
Prometheus export features
The Prometheus metrics exporter can export the following metrics data groups:
application: Application-level metricsapplication_span: Application-level trace span metricsapplication_hostApplication-level host metrics for host based pricingapplication_service_graph: Application-level service graph metrics. It’s recommended to use a DNS for service discovery and to ensure the DNS names match the OpenTelemetry service names Beyla uses. In Kubernetes environments, the OpenTelemetry service name set by the service name discovery is the best choice for service graph metrics.application_process: Metrics about the processes that runs the instrumented applicationnetwork: Network-level metrics, refer to the network metrics configuration documentation to learn morenetwork_inter_zone: Network inter-zone metrics, refer to the network metrics configuration documentation to learn more
Prometheus instrumentation
The list of instrumentation areas Beyla can collection data from:
*: all instrumentation, if*is present Beyla ignores other valueshttp: HTTP/HTTPS/HTTP2 application metricsgrpc: gRPC application metricssql: SQL database client call metricsredis: Redis client/server database metricskafka: Kafka client/server message queue metrics
For example, setting the instrumentations option to: http,grpc enables the collection of HTTP/HTTPS/HTTP2 and gRPC application metrics, and disables other instrumentation.



