Skip to content

Commit

Permalink
Configure exporter default aggregation and temporality preference
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg committed Jul 24, 2024
1 parent cc7cd37 commit 548f0f0
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 71 deletions.
4 changes: 3 additions & 1 deletion examples/anchors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ meter_provider:
<<: *otlp-exporter
endpoint: http://localhost:4318/v1/metrics
temporality_preference: delta
default_histogram_aggregation: base2_exponential_bucket_histogram
default_aggregation_by_instrument_kind:
histogram:
base2_exponential_bucket_histogram:

tracer_provider:
processors:
Expand Down
39 changes: 33 additions & 6 deletions examples/kitchen-sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ meter_provider:
# Configure resource attributes to be excluded, in this example attribute service.attr1.
excluded:
- "service.attr1"
# Configure default aggregation as a function of instrument kind.
default_aggregation_by_instrument_kind:
# Configure metric producers.
producers:
# Configure metric producer to be opencensus
Expand Down Expand Up @@ -203,10 +205,13 @@ meter_provider:
#
# Environment variable: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
temporality_preference: delta
# Configure default histogram aggregation.
# Configure default aggregation as a function of instrument kind.
#
# Environment variable: OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION
default_histogram_aggregation: base2_exponential_bucket_histogram
default_aggregation_by_instrument_kind:
# Configure default aggregation for histograms.
histogram:
base2_exponential_bucket_histogram:
# Configure metric producers.
producers:
# Configure metric producer to be prometheus
Expand All @@ -216,7 +221,29 @@ meter_provider:
# Configure exporter.
exporter:
# Configure exporter to be console.
console: {}
console:
# Configure temporality preference.
temporality_preference: delta
# Configure default aggregation as a function of instrument kind.
default_aggregation_by_instrument_kind:
# Configure default aggregation for counters.
counter:
sum:
# Configure default aggregation for histograms.
histogram:
base2_exponential_bucket_histogram:
# Configure default aggregation for observable counters.
observable_counter:
sum:
# Configure default aggregation for observable gauges.
observable_gauge:
last_value:
# Configure default aggregation for observable up down counters.
observable_up_down_counter:
sum:
# Configure default aggregation for up down counters.
up_down_counter:
sum:
# Configure views. Each view has a selector which determines the instrument(s) it applies to, and a configuration for the resulting stream(s).
views:
# Configure a view.
Expand Down Expand Up @@ -442,21 +469,21 @@ instrumentation:
# Instrumenation may merge general config options with the language specific configuration at .instrumentation.<language>.
general:
# Configure instrumentations following the peer semantic conventions.
#
#
# See peer semantic conventions: https://opentelemetry.io/docs/specs/semconv/attributes-registry/peer/
peer:
# Configure the service mapping for instrumentations following peer.service semantic conventions.
#
# Each entry is a key value pair where "peer" defines the IP address and "service" defines the corresponding logical name of the service.
#
#
# See peer.service semantic conventions: https://opentelemetry.io/docs/specs/semconv/general/attributes/#general-remote-service-attributes
service_mapping:
- peer: 1.2.3.4
service: FooService
- peer: 2.3.4.5
service: BarService
# Configure instrumentations following the http semantic conventions.
#
#
# See http semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/
http:
# Configure instrumentations following the http client semantic conventions.
Expand Down
4 changes: 2 additions & 2 deletions examples/sdk-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ meter_provider:
headers: {}
# Configure temporality preference.
temporality_preference: cumulative
# Configure default histogram aggregation.
default_histogram_aggregation: explicit_bucket_histogram
# Configure default aggregation by instrument kind.
default_aggregation_by_instrument_kind:

# Configure logger provider.
logger_provider:
Expand Down
5 changes: 3 additions & 2 deletions examples/sdk-migration-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# - OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_{SIGNAL}_HEADERS
# - OTEL_EXPORTER_OTLP_COMPRESSION
# - OTEL_EXPORTER_OTLP_TIMEOUT
# - OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION

# The file format version
file_format: "0.1"
Expand Down Expand Up @@ -166,8 +167,8 @@ meter_provider:
headers: {}
# Configure temporality preference.
temporality_preference: ${OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:-cumulative}
# Configure default histogram aggregation.
default_histogram_aggregation: ${OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION:-explicit_bucket_histogram}
# Configure default aggregation by instrument kind.
default_aggregation_by_instrument_kind:

# Configure logger provider.
logger_provider:
Expand Down
190 changes: 130 additions & 60 deletions schema/meter_provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"$ref": "#/$defs/OtlpMetric"
},
"console": {
"$ref": "common.json#/$defs/Console"
"$ref": "#/$defs/ConsoleMetric"
},
"prometheus": {
"$ref": "#/$defs/Prometheus"
Expand Down Expand Up @@ -113,6 +113,9 @@
},
"with_resource_constant_labels": {
"$ref": "common.json#/$defs/IncludeExclude"
},
"default_aggregation_by_instrument_kind": {
"$ref": "#/$defs/DefaultAggregationByInstrumentKind"
}
}
},
Expand Down Expand Up @@ -167,14 +170,10 @@
"minimum": 0
},
"temporality_preference": {
"type": ["string", "null"]
"$ref": "#/$defs/AggregationTemporalityPreference"
},
"default_histogram_aggregation": {
"type": ["string", "null"],
"enum": [
"explicit_bucket_histogram",
"base2_exponential_bucket_histogram"
]
"default_aggregation_by_instrument_kind": {
"$ref": "#/$defs/DefaultAggregationByInstrumentKind"
},
"insecure": {
"type": ["boolean", "null"]
Expand All @@ -186,6 +185,116 @@
],
"title": "OtlpMetric"
},
"AggregationTemporalityPreferenceByInstrumentKind": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"counter": {
"$ref": "#/$defs/AggregationTemporality"
},
"histogram": {
"$ref": "#/$defs/AggregationTemporality"
},
"observable_counter": {
"$ref": "#/$defs/AggregationTemporality"
},
"observable_gauge": {
"$ref": "#/$defs/AggregationTemporality"
},
"observable_up_down_counter": {
"$ref": "#/$defs/AggregationTemporality"
},
"up_down_counter": {
"$ref": "#/$defs/AggregationTemporality"
}
}
},
"AggregationTemporalityPreference": {
"type": ["string", "null"],
"enum": [
"delta",
"cumulative",
"low_memory"
]
},
"DefaultAggregationByInstrumentKind": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"counter": {
"$ref": "#/$defs/Aggregation"
},
"histogram": {
"$ref": "#/$defs/Aggregation"
},
"observable_counter": {
"$ref": "#/$defs/Aggregation"
},
"observable_gauge": {
"$ref": "#/$defs/Aggregation"
},
"observable_up_down_counter": {
"$ref": "#/$defs/Aggregation"
},
"up_down_counter": {
"$ref": "#/$defs/Aggregation"
}
}
},
"Aggregation": {
"type": ["object", "null"],
"additionalProperties": false,
"minProperties": 1,
"maxProperties": 1,
"properties": {
"default": {
"type": ["object", "null"],
"additionalProperties": false
},
"drop": {
"type": ["object", "null"],
"additionalProperties": false
},
"explicit_bucket_histogram": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"boundaries": {
"type": "array",
"items": {
"type": "number"
}
},
"record_min_max": {
"type": ["boolean", "null"]
}
}
},
"base2_exponential_bucket_histogram": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"max_scale": {
"type": ["integer", "null"]
},
"max_size": {
"type": ["integer", "null"]
},
"record_min_max": {
"type": ["boolean", "null"]
}
}
},
"last_value": {
"type": ["object", "null"],
"additionalProperties": false
},
"sum": {
"type": ["object", "null"],
"additionalProperties": false
}
}
},
"View": {
"type": ["object", "null"],
"additionalProperties": false,
Expand Down Expand Up @@ -235,58 +344,7 @@
"type": ["string", "null"]
},
"aggregation": {
"type": ["object", "null"],
"additionalProperties": false,
"minProperties": 1,
"maxProperties": 1,
"properties": {
"default": {
"type": ["object", "null"],
"additionalProperties": false
},
"drop": {
"type": ["object", "null"],
"additionalProperties": false
},
"explicit_bucket_histogram": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"boundaries": {
"type": "array",
"items": {
"type": "number"
}
},
"record_min_max": {
"type": ["boolean", "null"]
}
}
},
"base2_exponential_bucket_histogram": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"max_scale": {
"type": ["integer", "null"]
},
"max_size": {
"type": ["integer", "null"]
},
"record_min_max": {
"type": ["boolean", "null"]
}
}
},
"last_value": {
"type": ["object", "null"],
"additionalProperties": false
},
"sum": {
"type": ["object", "null"],
"additionalProperties": false
}
}
"$ref": "#/$defs/Aggregation"
},
"attribute_keys": {
"type": "array",
Expand All @@ -297,6 +355,18 @@
}
}
}
},
"ConsoleMetric": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"temporality_preference": {
"$ref": "#/$defs/AggregationTemporalityPreference"
},
"default_aggregation_by_instrument_kind": {
"$ref": "#/$defs/DefaultAggregationByInstrumentKind"
}
}
}
}
}

0 comments on commit 548f0f0

Please sign in to comment.