Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if I want to

  • have an aggregation preference for all kinds?
  • have settings that apply for all exporters?

I see that there is a yaml anchor - but I'm not sure this should be the only option to share values

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using anchors makes using the config easier. No need to merge properties from some global exporter config with per-exporter config. And simplifies the schema.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a lesser known and complicated feature

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
166 changes: 106 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,92 @@
],
"title": "OtlpMetric"
},
"AggregationTemporalityPreference": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec says that aggregation temporality should be configurable as a function of instrument kind, but most users will want to use these shorthand options.

This is much simpler / more compact than writing the preference for each instrument kind. In the future, we can add a separate property to give full control over temporality by instrument kind if needed.

"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": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lifting this aggregation type def up from the view stream definition. Its now reused both for view stream config and in exporter default aggregation config.

"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 +320,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 +331,18 @@
}
}
}
},
"ConsoleMetric": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"temporality_preference": {
"$ref": "#/$defs/AggregationTemporalityPreference"
},
"default_aggregation_by_instrument_kind": {
"$ref": "#/$defs/DefaultAggregationByInstrumentKind"
}
}
}
}
}
Loading