Metricsaslogs Connector
Overview
This connector converts OpenTelemetry metrics into logs, creating one log entry per metric data point. Each metric data point is transformed into a structured log record with configurable JSON body format.Current Limitations
⚠️ Current implementation discards the following metric features:- Metric exemplars
- Advanced metadata
Configuration
The following settings can be optionally configured:include_resource_attributes(default =true): Whether to include resource attributes in the generated logsinclude_scope_info(default =true): Whether to include instrumentation scope information in the generated logs
Log Body Format
The connector always generates log bodies in the following JSON format:$NAMEis the actual metric name$VALUEis the metric value (simple values for gauge/sum, complex JSON for histogram/summary)
Example Usage
Basic Configuration
Advanced Configuration
Example Metric Conversions
For a gauge metriccpu_usage with value 85.2:
request_duration:
Output Structure
Each metric data point is converted to a log record with:- Body: Fixed JSON format:
{"metric_name": "$NAME", "value": "$VALUE"} - Timestamp: Metric data point timestamp
- Observed Timestamp: Metric data point start timestamp (if available)
- Attributes:
- Original metric data point attributes (labels)
metric.name: The metric namemetric.type: The metric type (Gauge, Sum, Histogram, etc.)metric.description: Metric description (if available)metric.unit: Metric unit (if available)- Additional type-specific attributes:
- For Sum metrics:
metric.is_monotonic,metric.aggregation_temporality - For Histogram/ExponentialHistogram:
metric.aggregation_temporality
- For Sum metrics:
- Resource attributes (if
include_resource_attributesis true) - Instrumentation scope information (if
include_scope_infois true)
Supported Metric Types
All OpenTelemetry metric types are supported:- Gauge: Point-in-time measurements
- Sum: Cumulative or delta measurements
- Histogram: Distribution of measurements with buckets
- Exponential Histogram: Distribution with exponentially sized buckets
- Summary: Distribution with quantile values
Value Encoding
Thevalue field in the JSON body contains:
- For simple metrics (Gauge, Sum): numeric value as string
- For complex metrics (Histogram, etc.): JSON-encoded object as string
Last generated: 2026-04-13