Skip to content

Commit 3657e5a

Browse files
atoulmeFiery-Fenix
authored andcommitted
[exporter/prometheusremotewrite] remove export_created_metric (open-telemetry#38662)
#### Description Removing `export_created_metric` per note in README. See open-telemetry#35003 for reference.
1 parent 6673e9c commit 3657e5a

19 files changed

+57
-160
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: prometheusremotewriteexporter
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Remove `export_created_metric` config option
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [35003]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

exporter/prometheusremotewriteexporter/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ The following settings can be optionally configured:
5959
- `enabled` (default = false): If `enabled` is `true`, all the resource attributes will be converted to metric labels by default.
6060
- `target_info`: customize `target_info` metric
6161
- `enabled` (default = true): If `enabled` is `true`, a `target_info` metric will be generated for each resource metric (see https://github.com/open-telemetry/opentelemetry-specification/pull/2381).
62-
- `export_created_metric`: `WARNING` Deprecated and planned for removal in v0.116.0. See [related issue](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35003) for more information.
63-
- `enabled` (default = false): If `enabled` is `true`, a `_created` metric is
64-
exported for Summary, Histogram, and Monotonic Sum metric points if
65-
`StartTimeUnixNano` is set.
6662
- `max_batch_size_bytes` (default = `3000000` -> `~2.861 mb`): Maximum size of a batch of
6763
samples to be sent to the remote write endpoint. If the batch size is larger
6864
than this value, it will be split into multiple batches.

exporter/prometheusremotewriteexporter/config.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ type Config struct {
4747
// TargetInfo allows customizing the target_info metric
4848
TargetInfo *TargetInfo `mapstructure:"target_info,omitempty"`
4949

50-
// CreatedMetric allows customizing creation of _created metrics
51-
// Deprecated[0.114.0]: The feature doesn't provide the expected behavior. Use Prometheus remote-write v2 to enable sending Created Timestamps.
52-
// This feature is planned to be removed in v0.116.0
53-
CreatedMetric *CreatedMetric `mapstructure:"export_created_metric,omitempty"`
54-
5550
// AddMetricSuffixes controls whether unit and type suffixes are added to metrics on export
5651
AddMetricSuffixes bool `mapstructure:"add_metric_suffixes"`
5752

@@ -111,11 +106,6 @@ func (cfg *Config) Validate() error {
111106
Enabled: true,
112107
}
113108
}
114-
if cfg.CreatedMetric == nil {
115-
cfg.CreatedMetric = &CreatedMetric{
116-
Enabled: false,
117-
}
118-
}
119109
if cfg.MaxBatchSizeBytes < 0 {
120110
return fmt.Errorf("max_batch_byte_size must be greater than 0")
121111
}

exporter/prometheusremotewriteexporter/config_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func TestLoadConfig(t *testing.T) {
8181
TargetInfo: &TargetInfo{
8282
Enabled: true,
8383
},
84-
CreatedMetric: &CreatedMetric{Enabled: true},
8584
},
8685
},
8786
{

exporter/prometheusremotewriteexporter/exporter.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,16 @@ func newPRWExporter(cfg *Config, set exporter.Settings) (*prwExporter, error) {
158158
retrySettings: cfg.BackOffConfig,
159159
retryOnHTTP429: retryOn429FeatureGate.IsEnabled(),
160160
exporterSettings: prometheusremotewrite.Settings{
161-
Namespace: cfg.Namespace,
162-
ExternalLabels: sanitizedLabels,
163-
DisableTargetInfo: !cfg.TargetInfo.Enabled,
164-
ExportCreatedMetric: cfg.CreatedMetric.Enabled,
165-
AddMetricSuffixes: cfg.AddMetricSuffixes,
166-
SendMetadata: cfg.SendMetadata,
161+
Namespace: cfg.Namespace,
162+
ExternalLabels: sanitizedLabels,
163+
DisableTargetInfo: !cfg.TargetInfo.Enabled,
164+
AddMetricSuffixes: cfg.AddMetricSuffixes,
165+
SendMetadata: cfg.SendMetadata,
167166
},
168167
telemetry: telemetry,
169168
batchStatePool: sync.Pool{New: func() any { return newBatchTimeServicesState() }},
170169
}
171170

172-
if prwe.exporterSettings.ExportCreatedMetric {
173-
prwe.settings.Logger.Warn("export_created_metric is deprecated and will be removed in a future release")
174-
}
175-
176171
prwe.wal = newWAL(cfg.WAL, prwe.export)
177172
return prwe, nil
178173
}

exporter/prometheusremotewriteexporter/exporter_concurrency_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ func Test_PushMetricsConcurrent(t *testing.T) {
109109
TargetInfo: &TargetInfo{
110110
Enabled: true,
111111
},
112-
CreatedMetric: &CreatedMetric{
113-
Enabled: false,
114-
},
115112
BackOffConfig: retrySettings,
116113
}
117114

exporter/prometheusremotewriteexporter/exporter_test.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ func Test_NewPRWExporter(t *testing.T) {
5656
TargetInfo: &TargetInfo{
5757
Enabled: true,
5858
},
59-
CreatedMetric: &CreatedMetric{
60-
Enabled: false,
61-
},
6259
}
6360
buildInfo := component.BuildInfo{
6461
Description: "OpenTelemetry Collector",
@@ -152,9 +149,6 @@ func Test_Start(t *testing.T) {
152149
TargetInfo: &TargetInfo{
153150
Enabled: true,
154151
},
155-
CreatedMetric: &CreatedMetric{
156-
Enabled: false,
157-
},
158152
}
159153
buildInfo := component.BuildInfo{
160154
Description: "OpenTelemetry Collector",
@@ -497,7 +491,7 @@ func Test_PushMetrics(t *testing.T) {
497491
name: "intSum_case",
498492
metrics: intSumBatch,
499493
reqTestFunc: checkFunc,
500-
expectedTimeSeries: 4,
494+
expectedTimeSeries: 2,
501495
httpResponseCode: http.StatusAccepted,
502496
},
503497
{
@@ -721,9 +715,6 @@ func Test_PushMetrics(t *testing.T) {
721715
TargetInfo: &TargetInfo{
722716
Enabled: true,
723717
},
724-
CreatedMetric: &CreatedMetric{
725-
Enabled: true,
726-
},
727718
BackOffConfig: retrySettings,
728719
}
729720

@@ -948,9 +939,6 @@ func TestWALOnExporterRoundTrip(t *testing.T) {
948939
TargetInfo: &TargetInfo{
949940
Enabled: true,
950941
},
951-
CreatedMetric: &CreatedMetric{
952-
Enabled: false,
953-
},
954942
}
955943

956944
set := exportertest.NewNopSettings(metadata.Type)
@@ -1309,7 +1297,6 @@ func benchmarkPushMetrics(b *testing.B, numMetrics, numConsumers int) {
13091297
RemoteWriteQueue: RemoteWriteQueue{NumConsumers: numConsumers},
13101298
BackOffConfig: retrySettings,
13111299
TargetInfo: &TargetInfo{Enabled: true},
1312-
CreatedMetric: &CreatedMetric{Enabled: false},
13131300
}
13141301
exporter, err := newPRWExporter(cfg, set)
13151302
require.NoError(b, err)

exporter/prometheusremotewriteexporter/factory.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,5 @@ func createDefaultConfig() component.Config {
116116
TargetInfo: &TargetInfo{
117117
Enabled: true,
118118
},
119-
CreatedMetric: &CreatedMetric{
120-
Enabled: false,
121-
},
122119
}
123120
}

exporter/prometheusremotewriteexporter/testdata/config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ prometheusremotewrite/2:
2121
key2: value2
2222
resource_to_telemetry_conversion:
2323
enabled: true
24-
export_created_metric:
25-
enabled: true
2624
remote_write_queue:
2725
queue_size: 2000
2826
num_consumers: 10

exporter/prometheusremotewriteexporter/wal_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ func TestExportWithWALEnabled(t *testing.T) {
166166
WAL: &WALConfig{
167167
Directory: t.TempDir(),
168168
},
169-
TargetInfo: &TargetInfo{}, // Declared just to avoid nil pointer dereference.
170-
CreatedMetric: &CreatedMetric{}, // Declared just to avoid nil pointer dereference.
169+
TargetInfo: &TargetInfo{}, // Declared just to avoid nil pointer dereference.
171170
}
172171
buildInfo := component.BuildInfo{
173172
Description: "OpenTelemetry Collector",

0 commit comments

Comments
 (0)