Skip to content

Commit

Permalink
[exporter/prometheus] add with_resource_constant_labels (#67)
Browse files Browse the repository at this point in the history
This add support for the following from the spec:

> A Prometheus Exporter MAY offer configuration to add
> resource attributes as metric attributes. By default,
> it MUST NOT add any resource attributes as metric
> attributes. The configuration SHOULD allow the user
> to select which resource attributes to copy (e.g.
> include / exclude or regular expression based). Copied
> Resource attributes MUST NOT be excluded from target_info.

Signed-off-by: Alex Boten <aboten@lightstep.com>
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten committed May 8, 2024
1 parent b450ea7 commit a87ec9e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/kitchen-sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ meter_provider:
without_type_suffix: false
# Configure Prometheus Exporter to produce metrics without a scope info metric.
without_scope_info: false
# Configure Prometheus Exporter to add resource attributes as metrics attributes.
with_resource_constant_labels:
# Configure resource attributes to be included, in this example attributes starting with service.
included:
- "service*"
# Configure resource attributes to be excluded, in this example attribute service.attr1.
excluded:
- "service.attr1"
# Configure a periodic metric reader.
- periodic:
# Configure delay interval (in milliseconds) between start of two consecutive exports.
Expand Down
18 changes: 18 additions & 0 deletions schema/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@
}
}
},
"IncludeExclude": {
"type": "object",
"additionalProperties": false,
"properties": {
"included": {
"type": "array",
"items": {
"type": "string"
}
},
"excluded": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Otlp": {
"type": "object",
"additionalProperties": false,
Expand Down
3 changes: 3 additions & 0 deletions schema/meter_provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
},
"without_scope_info": {
"type": "boolean"
},
"with_resource_constant_labels": {
"$ref": "common.json#/$defs/IncludeExclude"
}
}
},
Expand Down

0 comments on commit a87ec9e

Please sign in to comment.