diff --git a/.chloggen/fix_prometheus_panic.yaml b/.chloggen/fix_prometheus_panic.yaml new file mode 100755 index 000000000000..386604edfc52 --- /dev/null +++ b/.chloggen/fix_prometheus_panic.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: prometheusexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix panic when exporter mutates data + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [29574] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/exporter/prometheusexporter/factory.go b/exporter/prometheusexporter/factory.go index ab1581e4a872..b29253fe0f8c 100644 --- a/exporter/prometheusexporter/factory.go +++ b/exporter/prometheusexporter/factory.go @@ -8,6 +8,7 @@ import ( "time" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exporterhelper" @@ -52,6 +53,7 @@ func createMetricsExporter( prometheus.ConsumeMetrics, exporterhelper.WithStart(prometheus.Start), exporterhelper.WithShutdown(prometheus.Shutdown), + exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: true}), ) if err != nil { return nil, err diff --git a/exporter/prometheusexporter/go.mod b/exporter/prometheusexporter/go.mod index 9daf822750b0..6d6c40eb3078 100644 --- a/exporter/prometheusexporter/go.mod +++ b/exporter/prometheusexporter/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/config/confighttp v0.90.2-0.20231201205146-6e2fdc755b34 go.opentelemetry.io/collector/config/configtls v0.90.2-0.20231201205146-6e2fdc755b34 go.opentelemetry.io/collector/confmap v0.90.2-0.20231201205146-6e2fdc755b34 + go.opentelemetry.io/collector/consumer v0.90.2-0.20231201205146-6e2fdc755b34 go.opentelemetry.io/collector/exporter v0.90.2-0.20231201205146-6e2fdc755b34 go.opentelemetry.io/collector/pdata v1.0.1-0.20231201205146-6e2fdc755b34 go.opentelemetry.io/collector/receiver v0.90.2-0.20231201205146-6e2fdc755b34 @@ -140,7 +141,6 @@ require ( go.opentelemetry.io/collector/config/configopaque v0.90.2-0.20231201205146-6e2fdc755b34 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.90.2-0.20231201205146-6e2fdc755b34 // indirect go.opentelemetry.io/collector/config/internal v0.90.2-0.20231201205146-6e2fdc755b34 // indirect - go.opentelemetry.io/collector/consumer v0.90.2-0.20231201205146-6e2fdc755b34 // indirect go.opentelemetry.io/collector/extension v0.90.2-0.20231201205146-6e2fdc755b34 // indirect go.opentelemetry.io/collector/extension/auth v0.90.2-0.20231201205146-6e2fdc755b34 // indirect go.opentelemetry.io/collector/featuregate v1.0.1-0.20231201205146-6e2fdc755b34 // indirect