diff --git a/.chloggen/codeboten_dep-metricsstarttime.yaml b/.chloggen/codeboten_dep-metricsstarttime.yaml new file mode 100644 index 0000000000000..72c93ec859289 --- /dev/null +++ b/.chloggen/codeboten_dep-metricsstarttime.yaml @@ -0,0 +1,4 @@ +change_type: 'deprecation' +component: processor/metric_start_time +note: Introduce new snake case compliant name `metric_start_time` +issues: [46777] diff --git a/.chloggen/config.yaml b/.chloggen/config.yaml index a12915a68e13c..404d00108e8cc 100644 --- a/.chloggen/config.yaml +++ b/.chloggen/config.yaml @@ -202,8 +202,8 @@ components: - processor/logdedup - processor/logstransform - processor/lookup + - processor/metric_start_time - processor/metricsgeneration - - processor/metricstarttime - processor/metricstransform - processor/novadetector - processor/oracleclouddetector diff --git a/processor/metricstarttimeprocessor/README.md b/processor/metricstarttimeprocessor/README.md index 4e3f1310e297d..9a4c268a55a23 100644 --- a/processor/metricstarttimeprocessor/README.md +++ b/processor/metricstarttimeprocessor/README.md @@ -1,7 +1,7 @@ # Metric Start Time Processor -The Metric Start Time Processor (`metricstarttime`) is used to set the start +The Metric Start Time Processor (`metric_start_time`) is used to set the start time for metric points with a cumulative aggregation temporality. It is commonly used with the `prometheus` receiver, which usually produces metric points without a start time. @@ -12,7 +12,7 @@ points without a start time. | Stability | [beta]: metrics | | Distributions | [contrib] | | Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aprocessor%2Fmetricstarttime%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aprocessor%2Fmetricstarttime) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aprocessor%2Fmetricstarttime%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aprocessor%2Fmetricstarttime) | -| Code coverage | [![codecov](https://codecov.io/github/open-telemetry/opentelemetry-collector-contrib/graph/main/badge.svg?component=processor_metricstarttime)](https://app.codecov.io/gh/open-telemetry/opentelemetry-collector-contrib/tree/main/?components%5B0%5D=processor_metricstarttime&displayType=list) | +| Code coverage | [![codecov](https://codecov.io/github/open-telemetry/opentelemetry-collector-contrib/graph/main/badge.svg?component=processor_metric_start_time)](https://app.codecov.io/gh/open-telemetry/opentelemetry-collector-contrib/tree/main/?components%5B0%5D=processor_metric_start_time&displayType=list) | | [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dashpole](https://www.github.com/dashpole), [@ridwanmsharif](https://www.github.com/ridwanmsharif) | [beta]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#beta @@ -39,12 +39,12 @@ Example configurations: ```yaml processors: - metricstarttime: + metric_start_time: ``` ```yaml processors: - metricstarttime: + metric_start_time: strategy: start_time_metric gc_interval: 1h start_time_metric_regex: "^.+_start_time$" @@ -106,7 +106,7 @@ This strategy should only be used in limited circumstances: * When your application has a metric with the start time in Unix nanoseconds, such as `process_start_time`. -* The metricstarttime processor is used _before_ any batching, so that the +* The `metric_start_time` processor is used _before_ any batching, so that the batch of metrics all originate from a single application. * This strategy can be used when the collector is run as a sidecar to the application, where the collector's start time is a good approximation of the diff --git a/processor/metricstarttimeprocessor/factory.go b/processor/metricstarttimeprocessor/factory.go index df7f5e201a01b..d7335b3adfc16 100644 --- a/processor/metricstarttimeprocessor/factory.go +++ b/processor/metricstarttimeprocessor/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processorhelper" + "go.opentelemetry.io/collector/processor/xprocessor" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstarttimeprocessor/internal/metadata" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstarttimeprocessor/internal/starttimemetric" @@ -20,10 +21,12 @@ import ( // NewFactory creates a new metric start time processor factory. func NewFactory() processor.Factory { - return processor.NewFactory( + return xprocessor.NewFactory( metadata.Type, createDefaultConfig, - processor.WithMetrics(createMetricsProcessor, metadata.MetricsStability)) + xprocessor.WithMetrics(createMetricsProcessor, metadata.MetricsStability), + xprocessor.WithDeprecatedTypeAlias(metadata.DeprecatedType), + ) } // createMetricsProcessor creates a metrics processor based on provided config. diff --git a/processor/metricstarttimeprocessor/generated_component_test.go b/processor/metricstarttimeprocessor/generated_component_test.go index 88beaddc8531e..6a007ae4f64a7 100644 --- a/processor/metricstarttimeprocessor/generated_component_test.go +++ b/processor/metricstarttimeprocessor/generated_component_test.go @@ -20,7 +20,7 @@ import ( "go.opentelemetry.io/collector/processor/processortest" ) -var typ = component.MustNewType("metricstarttime") +var typ = component.MustNewType("metric_start_time") func TestComponentFactoryType(t *testing.T) { require.Equal(t, typ, NewFactory().Type()) diff --git a/processor/metricstarttimeprocessor/go.mod b/processor/metricstarttimeprocessor/go.mod index b228eced245d0..2263def31b56e 100644 --- a/processor/metricstarttimeprocessor/go.mod +++ b/processor/metricstarttimeprocessor/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/processor v1.53.1-0.20260306010043-a44ab254898b go.opentelemetry.io/collector/processor/processorhelper v0.147.1-0.20260306010043-a44ab254898b go.opentelemetry.io/collector/processor/processortest v0.147.1-0.20260306010043-a44ab254898b + go.opentelemetry.io/collector/processor/xprocessor v0.147.1-0.20260306010043-a44ab254898b go.opentelemetry.io/otel v1.41.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.1 @@ -48,7 +49,6 @@ require ( go.opentelemetry.io/collector/pdata/testdata v0.147.1-0.20260306010043-a44ab254898b // indirect go.opentelemetry.io/collector/pdata/xpdata v0.147.1-0.20260306010043-a44ab254898b // indirect go.opentelemetry.io/collector/pipeline v1.53.1-0.20260306010043-a44ab254898b // indirect - go.opentelemetry.io/collector/processor/xprocessor v0.147.1-0.20260306010043-a44ab254898b // indirect go.opentelemetry.io/otel/metric v1.41.0 // indirect go.opentelemetry.io/otel/sdk v1.41.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.41.0 // indirect diff --git a/processor/metricstarttimeprocessor/internal/metadata/generated_status.go b/processor/metricstarttimeprocessor/internal/metadata/generated_status.go index 48216e0d97fea..e07bda3b75fbb 100644 --- a/processor/metricstarttimeprocessor/internal/metadata/generated_status.go +++ b/processor/metricstarttimeprocessor/internal/metadata/generated_status.go @@ -7,8 +7,9 @@ import ( ) var ( - Type = component.MustNewType("metricstarttime") - ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstarttimeprocessor" + Type = component.MustNewType("metric_start_time") + DeprecatedType = component.MustNewType("metricstarttime") + ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstarttimeprocessor" ) const ( diff --git a/processor/metricstarttimeprocessor/metadata.yaml b/processor/metricstarttimeprocessor/metadata.yaml index 67bdd2e54934c..c36496c8cc16d 100644 --- a/processor/metricstarttimeprocessor/metadata.yaml +++ b/processor/metricstarttimeprocessor/metadata.yaml @@ -1,9 +1,10 @@ display_name: Metric Start Time Processor -type: metricstarttime +type: metric_start_time +deprecated_type: metricstarttime description: | - The Metric Start Time Processor (`metricstarttime`) is used to set the start + The Metric Start Time Processor (`metric_start_time`) is used to set the start time for metric points with a cumulative aggregation temporality. It is commonly used with the `prometheus` receiver, which usually produces metric points without a start time. diff --git a/processor/metricstarttimeprocessor/testdata/config.yaml b/processor/metricstarttimeprocessor/testdata/config.yaml index 4bfe0531df041..5074c94e3fbb8 100644 --- a/processor/metricstarttimeprocessor/testdata/config.yaml +++ b/processor/metricstarttimeprocessor/testdata/config.yaml @@ -1,28 +1,28 @@ -metricstarttime: +metric_start_time: -metricstarttime/subtract_initial_point: +metric_start_time/subtract_initial_point: strategy: subtract_initial_point -metricstarttime/gc_interval: +metric_start_time/gc_interval: gc_interval: 1h -metricstarttime/negative_interval: +metric_start_time/negative_interval: gc_interval: -1h -metricstarttime/true_reset_point: +metric_start_time/true_reset_point: strategy: true_reset_point -metricstarttime/start_time_metric: +metric_start_time/start_time_metric: strategy: start_time_metric start_time_metric_regex: "^.+_process_start_time_seconds$" -metricstarttime/invalid_regex: +metric_start_time/invalid_regex: strategy: start_time_metric start_time_metric_regex: "((((" -metricstarttime/invalid_strategy: +metric_start_time/invalid_strategy: strategy: bad -metricstarttime/regex_with_subtract_initial_point: +metric_start_time/regex_with_subtract_initial_point: strategy: subtract_initial_point start_time_metric_regex: "^.+_process_start_time_seconds$" \ No newline at end of file diff --git a/receiver/prometheusreceiver/documentation.md b/receiver/prometheusreceiver/documentation.md index 953ec134357d3..4f9273b03b10a 100644 --- a/receiver/prometheusreceiver/documentation.md +++ b/receiver/prometheusreceiver/documentation.md @@ -12,7 +12,7 @@ This component has the following feature gates: | `receiver.prometheusreceiver.EnableNativeHistograms` | stable | Converts scraped Prometheus native histograms into OpenTelemetry exponential histograms. You still need to configure 'scrape_native_histograms: true' in your Prometheus scrape config to actually scrape native histograms. For mixed histograms (both classic and native), only the native histogram buckets are used. | v0.142.0 | v0.145.0 | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/34473) | | `receiver.prometheusreceiver.EnableReportExtraScrapeMetrics` | deprecated | Enables reporting of extra Prometheus scrape metrics. This gate is deprecated, use the `extra_scrape_metrics` Prometheus scrape configuration instead. | v0.143.0 | v0.148.0 | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/44181) | | `receiver.prometheusreceiver.RemoveReportExtraScrapeMetricsConfig` | stable | This gate is always enabled and cannot be turned off. The 'report_extra_scrape_metrics' configuration option is always ignored. The extra scrape metrics are controlled by the EnableReportExtraScrapeMetrics feature gate, unless otherwise specified in the Prometheus scrape configuration. | v0.143.0 | v0.148.0 | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/44181) | -| `receiver.prometheusreceiver.RemoveStartTimeAdjustment` | stable | When enabled, the Prometheus receiver will leave the start time unset. Use the metricstarttime processor instead if you need this functionality. | v0.121.0 | v0.142.0 | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/36364) | +| `receiver.prometheusreceiver.RemoveStartTimeAdjustment` | stable | When enabled, the Prometheus receiver will leave the start time unset. Use the metric_start_time processor instead if you need this functionality. | v0.121.0 | v0.142.0 | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/36364) | | `receiver.prometheusreceiver.UseCreatedMetric` | deprecated | When enabled, the Prometheus receiver will retrieve the start time for Summary, Histogram and Sum metrics from _created metric. | v0.89.0 | v0.141.0 | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/21909) | For more information about feature gates, see the [Feature Gates](https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md) documentation. diff --git a/receiver/prometheusreceiver/internal/metadata/generated_feature_gates.go b/receiver/prometheusreceiver/internal/metadata/generated_feature_gates.go index 7b10e4937ead4..508f14b962a65 100644 --- a/receiver/prometheusreceiver/internal/metadata/generated_feature_gates.go +++ b/receiver/prometheusreceiver/internal/metadata/generated_feature_gates.go @@ -44,7 +44,7 @@ var ReceiverPrometheusreceiverRemoveReportExtraScrapeMetricsConfigFeatureGate = var ReceiverPrometheusreceiverRemoveStartTimeAdjustmentFeatureGate = featuregate.GlobalRegistry().MustRegister( "receiver.prometheusreceiver.RemoveStartTimeAdjustment", featuregate.StageStable, - featuregate.WithRegisterDescription("When enabled, the Prometheus receiver will leave the start time unset. Use the metricstarttime processor instead if you need this functionality."), + featuregate.WithRegisterDescription("When enabled, the Prometheus receiver will leave the start time unset. Use the metric_start_time processor instead if you need this functionality."), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/36364"), featuregate.WithRegisterFromVersion("v0.121.0"), featuregate.WithRegisterToVersion("v0.142.0"), diff --git a/receiver/prometheusreceiver/metadata.yaml b/receiver/prometheusreceiver/metadata.yaml index 0e299a30b9c59..76b3f623b2caf 100644 --- a/receiver/prometheusreceiver/metadata.yaml +++ b/receiver/prometheusreceiver/metadata.yaml @@ -67,7 +67,7 @@ feature_gates: stage: stable description: >- When enabled, the Prometheus receiver will leave the start time unset. - Use the metricstarttime processor instead if you need this functionality. + Use the metric_start_time processor instead if you need this functionality. from_version: v0.121.0 to_version: v0.142.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/36364 diff --git a/reports/distributions/contrib.yaml b/reports/distributions/contrib.yaml index 0afe4d579a451..84b2cf93d3f5f 100644 --- a/reports/distributions/contrib.yaml +++ b/reports/distributions/contrib.yaml @@ -111,8 +111,8 @@ components: - isolationforest - k8s_attributes - logdedup + - metric_start_time - metricsgeneration - - metricstarttime - metricstransform - probabilistic_sampler - redaction