This is documentation for the next version of Grafana Beyla documentation. For the latest stable release, go to the latest version.

Open source

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:

YAML
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.

YAML

environment variable

DescriptionTypeDefault
cloud_submit

GRAFANA_CLOUD_SUBMIT

A list of data types to submit to the OTLP endpoint. Accepts metrics and traces as values.stringtraces
cloud_zone

GRAFANA_CLOUD_ZONE

The cloud zone of your Grafana endpoint used to compose the Grafana OTLP URL. Refer to cloud zone configuration for important details about endpoint overrides.string
cloud_instance_id

GRAFANA_CLOUD_INSTANCE_ID

Your Grafana user name. Usually a number but must be set as a string in the YAML file.string
cloud_api_key

GRAFANA_CLOUD_API_KEY

API key of your Grafana Cloud account.string

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:

YAML
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_histogram
YAML

environment variable

DescriptionTypeDefault
endpoint

OTEL_EXPORTER_OTLP_METRICS_ENDPOINT

The endpoint Beyla sends metrics to.URL
OTEL_EXPORTER_OTLP_ENDPOINTThe shared endpoint for metrics and traces exporters. Beyla adds /v1/metrics path to the URL when sending metrics, following the OpenTelemetry standard. To prevent this behavior, use the metrics specific setting.URL
protocol

OTEL_EXPORTER_OTLP_METRICS_PROTOCOL

The protocol transport/encoding of the OpenTelemetry endpoint, refer to metrics export protocol. Accepted values http/json, http/protobuf, and grpc.stringInferred from port usage
OTEL_EXPORTER_OTLP_PROTOCOLSimilar to the shared endpoint, the protocol for metrics and traces.stringInferred from port usage
insecure_skip_verify

BEYLA_OTEL_INSECURE_SKIP_VERIFY

If true, Beyla skips verifying and accepts any server certificate. Only override this setting for non-production environments.booleanfalse
interval

BEYLA_METRICS_INTERVAL

The duration between exports.Duration60s
features

BEYLA_OTEL_METRICS_FEATURES

The list of metric groups Beyla exports data for, refer to metrics export features. Accepted values application, application_span, application_span_otel, application_host, application_service_graph, application_process, application_runtime, network and network_inter_zone.list of strings["application"]
allow_service_graph_self_references

BEYLA_OTEL_ALLOW_SERVICE_GRAPH_SELF_REFERENCES

Controls if Beyla includes self-referencing services in service graph generation, for example a service that calls itself. Self referencing reduces service graph usefulness and increases data cardinality.booleanfalse
instrumentations

BEYLA_OTEL_METRICS_INSTRUMENTATIONS

The list of metrics instrumentation Beyla collects data for, refer to metrics instrumentation section.list of strings["*"]
bucketsSets how you can override bucket boundaries of diverse histograms, refer to override histogram buckets.(n/a)Object
histogram_aggregation

OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION

Sets the default aggregation Beyla uses for histogram instruments. Accepted values explicit_bucket_histogram or base2_exponential_bucket_histogram.stringexplicit_bucket_histogram

Metrics export protocol

If you don’t set a protocol Beyla sets the protocol as follows:

  • grpc: if the port ends in 4317, for example 4317, 14317, or 24317.
  • http/protobuf: if the port ends in 4318, for example 4318, 14318, or 24318.

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 metrics
  • application_span: Application-level trace span metrics using legacy naming conventions. Deprecated: use application_span_otel instead. The name keeps working, but Beyla logs a deprecation warning at startup and the feature is removed in a future release
  • application_span_otel: Application-level trace span metrics using OpenTelemetry naming conventions. Refer to span metrics formats for differences between application_span and application_span_otel
  • application_span_sizes: Application-level request and response body size metrics for trace spans. Deprecated: there is no direct replacement. The closest equivalents are the http.server.request.body.size and http.server.response.body.size metrics
  • application_host: Application-level host metrics for host based pricing
  • application_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: Low-level process metrics (for example, CPU, memory, disk metrics) for the selected services
  • application_runtime: Go and JVM language runtime metrics. Refer to Application runtime metrics for the full list of exported metrics.
  • network: Network-level metrics, refer to the network metrics configuration documentation to learn more
  • network_inter_zone: Network inter-zone metrics, refer to the network metrics configuration documentation to learn more

Application runtime metrics

When application_runtime is enabled, Beyla collects language runtime metrics for instrumented Go and Java processes.

Go runtime metrics

MetricDescription
go.memory.limitRuntime memory limit configured via GOMEMLIMIT
go.memory.gc.goalHeap size target for the next GC cycle
go.memory.gc.cyclesCumulative count of completed GC cycles
go.memory.gc.pause.durationTotal time spent in GC stop-the-world pauses
go.memory.usedMemory in use by the Go runtime
go.memory.allocatedCumulative bytes allocated by the runtime
go.memory.allocationsCumulative number of heap object allocations
go.cpu.timeCumulative CPU time consumed by the Go process
go.goroutine.countNumber of live goroutines
go.processor.limitGOMAXPROCS value (logical CPU limit)
go.config.gogcCurrent GC target percentage (GOGC)
go.schedule.durationTime goroutines spend waiting on the scheduler run queue

JVM runtime metrics

JVM runtime metrics are collected via eBPF USDT probes on libjvm.so (hotspot:mem__pool__gc__begin and hotspot:mem__pool__gc__end) without requiring any bytecode agent.

MetricDescription
jvm.memory.usedCurrent bytes used in the JVM memory pool
jvm.memory.committedBytes committed (reserved) for the JVM memory pool
jvm.memory.limitMaximum bytes the memory pool can use
jvm.memory.used_after_last_gcBytes used in the pool immediately after the last GC cycle

All JVM metrics carry the attributes jvm.memory.type (for example, heap, non_heap) and jvm.memory.pool.name (for example, G1 Eden Space).

To control how frequently JVM GC events are sampled, refer to JVM runtime metrics.

Span metrics formats

Beyla provides two formats for span metrics:

  • application_span: Legacy format using the metric names traces_spanmetrics_latency and traces_spanmetrics_calls_total. Deprecated: use application_span_otel instead
  • application_span_otel: OpenTelemetry-compliant format using the metric names traces_span_metrics_duration_seconds and traces_span_metrics_calls_total

You can only enable one span metrics format at a time. If you specify both application_span and application_span_otel in the features list, Beyla returns a configuration error. The same applies when one format comes from the top-level metrics section and the other from a per-service discovery metrics.features section, because the exported metric names are selected from the combination of both.

If you select the formats implicitly with all or *, Beyla resolves the conflict automatically in favor of application_span_otel and logs a warning. This resolution also applies to per-service metrics.features sections, so a single service requesting all doesn’t move every service back to the legacy names.

Metrics instrumentation

The list of instrumentation areas Beyla can collection data from:

  • *: all instrumentation, if * is present Beyla ignores other values
  • aerospike: Aerospike database metrics
  • amqp: AMQP message queue metrics
  • couchbase: Couchbase database metrics
  • dns: DNS request metrics
  • genai: Generative AI metrics
  • gpu: GPU operation metrics
  • http: HTTP/HTTPS/HTTP2 application metrics
  • grpc: gRPC application metrics
  • kafka: Kafka client/server message queue metrics
  • memcached: Memcached database metrics
  • mongo: MongoDB client/server database metrics
  • mqtt: MQTT message queue metrics
  • nats: NATS message queue metrics
  • redis: Redis client/server database metrics
  • sql: SQL database client call metrics
  • sunrpc: SunRPC call 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.

YAML
otel_traces_export:
  endpoint: http://jaeger:4317
  protocol: grpc
  instrumentations: ["http", "sql"]
YAML

environment variable

DescriptionTypeDefault
endpoint

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT

OTEL_EXPORTER_OTLP_ENDPOINT

The endpoint Beyla sends traces to. When using OTEL_EXPORTER_OTLP_ENDPOINT, Beyla follows the OpenTelemetry standard and automatically adds /v1/traces path to the URL. If you don’t want this to happen, use the traces specific setting.URL
protocol

OTEL_EXPORTER_OTLP_TRACES_PROTOCOL

OTEL_EXPORTER_OTLP_PROTOCOL

The protocol transport/encoding of the OpenTelemetry endpoint, refer to traces export protocol. Accepted values http/json, http/protobuf, and grpc.stringInferred from port usage
insecure_skip_verify

BEYLA_OTEL_INSECURE_SKIP_VERIFY

If true, Beyla skips verifying and accepts any server certificate. Only override this setting for non-production environments.booleanfalse
instrumentations

BEYLA_OTEL_TRACES_INSTRUMENTATIONS

The list of instrumentation Beyla collects data for, refer to traces instrumentation section.list of strings["http", "grpc", "sql", "redis", "kafka", "mqtt", "nats", "amqp", "mongo", "couchbase", "memcached", "sunrpc", "aerospike"]

Traces export protocol

If you don’t set a protocol Beyla sets the protocol as follows:

  • grpc: if the port ends in 4317, for example 4317, 14317, or 24317.
  • http/protobuf: if the port ends in 4318, for example 4318, 14318, or 24318.

Traces instrumentation

The list of instrumentation areas Beyla can collection data from:

  • *: all instrumentation, if * is present Beyla ignores other values
  • aerospike: Aerospike database traces
  • amqp: AMQP message queue traces
  • couchbase: Couchbase database traces
  • dns: DNS request traces
  • genai: Generative AI traces
  • gpu: GPU operation traces
  • http: HTTP/HTTPS/HTTP2 application traces
  • grpc: gRPC application traces
  • kafka: Kafka client/server message queue traces
  • memcached: Memcached database traces
  • mongo: MongoDB client/server database traces
  • mqtt: MQTT message queue traces
  • nats: NATS message queue traces
  • redis: Redis client/server database traces
  • sql: SQL database client call traces
  • sunrpc: SunRPC call 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.

Note: By default, Beyla enables all supported trace instrumentations except dns, genai, and gpu. You can explicitly enable these instrumentations if needed.

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

Prometheus scrapers override the instance and job labels by default. To preserve the per-process instance identifiers set by Beyla, configure your scraper with honor_labels: true. See the Prometheus documentation or Alloy prometheus.scrape documentation.

YAML
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"]
YAML

environment variable

DescriptionTypeDefault
port

BEYLA_PROMETHEUS_PORT

The HTTP port for the Prometheus scrape endpoint. If unset or 0, no Prometheus endpoint is open.int
path

BEYLA_PROMETHEUS_PATH

The HTTP query path to fetch the list of Prometheus metrics.string/metrics
extra_resource_attributes

BEYLA_PROMETHEUS_EXTRA_RESOURCE_ATTRIBUTES

A list of additional resource attributes to be added to the reported target_info metric. Refer to extra resource attributes for important details about runtime discovered attributes.list of strings
ttl

BEYLA_PROMETHEUS_TTL

The duration after which metric instances are not reported if they haven’t been updated. Used to avoid reporting indefinitely finished application instances.Duration5m
bucketsSets how you can override bucket boundaries of diverse histograms, refer to override histogram buckets.Object
features

BEYLA_PROMETHEUS_FEATURES

The list of metric groups Beyla exports data for, refer to Prometheus export features.list of strings["application"]
allow_service_graph_self_references

BEYLA_PROMETHEUS_ALLOW_SERVICE_GRAPH_SELF_REFERENCES

Does Beyla include self-referencing service in service graph generation. Self referencing isn’t useful for service graphs and increases data cardinality.booleanfalse
instrumentations

BEYLA_PROMETHEUS_INSTRUMENTATIONS

The list of instrumentation Beyla collects data for, refer to Prometheus instrumentation section.list of strings["*"]

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 metrics
  • application_span: Application-level trace span metrics
  • application_host Application-level host metrics for host based pricing
  • application_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: Low-level process metrics (for example, CPU, memory, disk metrics) for the selected services
  • application_runtime: Go and JVM language runtime metrics. Refer to Application runtime metrics for the full list of exported metrics.
  • network: Network-level metrics, refer to the network metrics configuration documentation to learn more
  • network_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 values
  • aerospike: Aerospike database metrics
  • amqp: AMQP message queue metrics
  • couchbase: Couchbase database metrics
  • dns: DNS request metrics
  • genai: Generative AI metrics
  • gpu: GPU operation metrics
  • http: HTTP/HTTPS/HTTP2 application metrics
  • grpc: gRPC application metrics
  • kafka: Kafka client/server message queue metrics
  • memcached: Memcached database metrics
  • mongo: MongoDB client/server database metrics
  • mqtt: MQTT message queue metrics
  • nats: NATS message queue metrics
  • redis: Redis client/server database metrics
  • sql: SQL database client call metrics
  • sunrpc: SunRPC call 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.

Global metrics features

You can set the default features list for all exporters at once using the global metrics configuration block, rather than repeating it under each exporter. The global setting is overridden by any per-exporter features value.

The metrics.features option (environment variable: OTEL_EBPF_METRICS_FEATURES) accepts a list of feature group names. The default is ["application"].

To enable runtime metrics globally for all processes:

YAML
metrics:
  features:
    - application
    - application_runtime

To enable application_runtime only for a specific process, use the per-service metrics.features override in service discovery:

YAML
discovery:
  instrument:
    - name: my-java-service
      metrics:
        features:
          - application_runtime

JVM runtime metrics

When the application_runtime feature is enabled for Java services, Beyla collects JVM memory pool metrics by attaching eBPF USDT probes to hotspot:mem__pool__gc__begin and hotspot:mem__pool__gc__end in libjvm.so.

To prevent excessive data collection on JVMs with high GC frequency, Beyla throttles the collection with a configurable sampling interval.

YAML

environment variable

DescriptionTypeDefault
jvm_runtime_metrics.sampling_interval

OBI_JVM_RUNTIME_METRICS_SAMPLING_INTERVAL

Minimum time between successive JVM runtime metric samples. Must be greater than 0.Duration1s

Example:

YAML
jvm_runtime_metrics:
  sampling_interval: 1s