Skip to content

Commit fdb2762

Browse files
authored
Merge branch 'main' into custom_receiverhelper
2 parents cb2796a + 59a1166 commit fdb2762

File tree

10 files changed

+249
-59
lines changed

10 files changed

+249
-59
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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: deprecation
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: pdata/profile
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Replace AddAttribute with the PutAttribute helper method to modify the content of attributable records.
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [12798]
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+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: [api]

.github/workflows/utils/cspell.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"Helmuth",
3939
"Hostfeature",
4040
"Islamov",
41-
"Jaegar",
4241
"Jaglowski",
4342
"Janotti",
4443
"Juraci",
@@ -63,7 +62,6 @@
6362
"Punya",
6463
"RCPC",
6564
"Rahul",
66-
"Reques",
6765
"SASL",
6866
"SPECPATH",
6967
"SPECTAG",
@@ -110,9 +108,7 @@
110108
"cmux",
111109
"codeboten",
112110
"codeowners",
113-
"cofig",
114111
"componenterror",
115-
"componentest",
116112
"componenthelper",
117113
"componentprofiles",
118114
"componentstatus",
@@ -143,7 +139,6 @@
143139
"connectorprofiles",
144140
"connectortest",
145141
"consumerdata",
146-
"consumereerrorprofiles",
147142
"consumererror",
148143
"consumererrorprofiles",
149144
"consumerfanout",
@@ -169,7 +164,6 @@
169164
"dmathieu",
170165
"dmitryax",
171166
"dokey",
172-
"enadled",
173167
"envmapprovider",
174168
"envprovider",
175169
"exampleexporter",
@@ -208,7 +202,6 @@
208202
"filterset",
209203
"fluentbit",
210204
"fluentforward",
211-
"fluentfoward",
212205
"forwardconnector",
213206
"fsnotify",
214207
"funcs",
@@ -242,8 +235,6 @@
242235
"httpprovider",
243236
"httpsprovider",
244237
"httptest",
245-
"htttp",
246-
"identfier",
247238
"illumos",
248239
"incorrectclass",
249240
"incorrectcomponent",
@@ -254,7 +245,6 @@
254245
"invalidaggregation",
255246
"invalidtype",
256247
"iruntime",
257-
"jaegar",
258248
"jaegerexporter",
259249
"jaegerreceiver",
260250
"jmacd",
@@ -265,7 +255,6 @@
265255
"kafkareceiver",
266256
"keepalive",
267257
"koanf",
268-
"lables",
269258
"ldflags",
270259
"limitermiddleware",
271260
"localhostgate",
@@ -286,7 +275,6 @@
286275
"metricsgenerationprocessor",
287276
"metricstransformprocessor",
288277
"middleware",
289-
"mininum",
290278
"mostynb",
291279
"muehle",
292280
"multiclient",
@@ -305,8 +293,6 @@
305293
"nopreceiver",
306294
"nosuchprocessor",
307295
"notls",
308-
"obsereporttest",
309-
"obserporttest",
310296
"obsreceiver",
311297
"obsreport",
312298
"obsreporttest",
@@ -376,7 +362,6 @@
376362
"receiverhelper",
377363
"receiverprofiles",
378364
"receivertest",
379-
"repeate",
380365
"resourcedetection",
381366
"resourcedetectionprocessor",
382367
"resourceprocessor",

CHANGELOG-API.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ If you are looking for user-facing changes, check out [CHANGELOG.md](./CHANGELOG
288288

289289
### 💡 Enhancements 💡
290290

291-
- `componenttest`: Add helper to get a metric for componentest.Telemetry (#12215)
291+
- `componenttest`: Add helper to get a metric for componenttest.Telemetry (#12215)
292292
- `componenttest`: Extract componenttest.Telemetry as generic struct for telemetry testing (#12151)
293293
- `mdatagen`: Generate assert function for each metric in mdatagen (#12179)
294294
- `metadatatest`: Generate NewSettings that accepts componenttest.Telemetry (#12216)
@@ -461,14 +461,14 @@ If you are looking for user-facing changes, check out [CHANGELOG.md](./CHANGELOG
461461
Factory.CreateExtension -> Factory.Create |
462462
Factory.ExtensionStability -> Factory.Stability
463463

464-
- `exporter`: Deprecate funcs that repeate exporter in name (#11370)
464+
- `exporter`: Deprecate funcs that repeat exporter in name (#11370)
465465
Factory.Create[Traces|Metrics|Logs|Profiles]Exporter -> Factory.Create[Traces|Metrics|Logs|Profiles] |
466466
Factory.[Traces|Metrics|Logs|Profiles]ExporterStability -> Factory.[Traces|Metrics|Logs|Profiles]Stability
467467

468468

469469
### 🚀 New components 🚀
470470

471-
- `consumererrorprofiles`: Add new module consumereerrorprofiles for consumer error profiles. (#11131)
471+
- `consumererrorprofiles`: Add new module consumererrorprofiles for consumer error profiles. (#11131)
472472

473473
### 💡 Enhancements 💡
474474

@@ -995,7 +995,7 @@ Use the `ProviderFactories` and `ConverterFactories` fields instead.
995995
- obsreporttest.TestTelemetry -> componenttest.TestTelemetry
996996
- obsreporttest.SetupTelemetry -> componenttest.SetupTelemetry
997997
- obsreporttest.CheckScraperMetrics -> TestTelemetry.CheckScraperMetrics
998-
- obserporttest.TestTelemetry.TelemetrySettings -> componenttest.TestTelemetry.TelemetrySettings()
998+
- obsreporttest.TestTelemetry.TelemetrySettings -> componenttest.TestTelemetry.TelemetrySettings()
999999

10001000
- `confignet`: Deprecates `DialContext` and `ListenContext` functions. Use `Dial` and `Listen` instead. (#9258)
10011001
Unlike the previous `Dial` and `Listen` functions, the new `Dial` and `Listen` functions take a `context.Context` like `DialContext` and `ListenContext`.

CHANGELOG.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ This release includes 2 very important breaking changes.
10561056
- `configcompression`: Mark module as Stable. (#9571)
10571057
- `cmd/mdatagen`: Use go package name for the scope name by default and add an option to provide the scope name in metadata.yaml. (#9693)
10581058
- `cmd/mdatagen`: Generate the lifecycle tests for components by default. (#9683)
1059-
It's encouraged to have lifecycle tests for all components enadled, but they can be disabled if needed
1059+
It's encouraged to have lifecycle tests for all components enabled, but they can be disabled if needed
10601060
in metadata.yaml with `skip_lifecycle: true` and `skip_shutdown: true` under `tests` section.
10611061

10621062
- `cmd/mdatagen`: optimize the mdatagen for the case like batchprocessor which use a common struct to implement consumer.Traces, consumer.Metrics, consumer.Logs in the meantime. (#9688)
@@ -1714,8 +1714,8 @@ This release includes 2 very important breaking changes.
17141714
- `componenttest`: Remove deprecated funcs from componenttest (#6836)
17151715
- `batchprocessor`: Remove deprecated batchprocessor.MetricViews and batchprocessor.OtelMetricViews (#6861)
17161716
- `component`: Remove deprecated component.[Factories|MakeProcessorFactoryMap] and componenttest.NewNopFactories (#6835)
1717-
- `config`: Remove deprecated cofig.*Settings (#6837)
1718-
- `obsereporttest`: Remove deprecated obsereporttest.SetupTelemetryWithID (#6861)
1717+
- `config`: Remove deprecated config.*Settings (#6837)
1718+
- `obsreporttest`: Remove deprecated obsreporttest.SetupTelemetryWithID (#6861)
17191719
- `component`: Remove deprecated component [Traces|Metrics|Logs]Processor and ProcessorFactory (#6884)
17201720
- `service`: Remove deprecated service service.ConfigService and service.ConfigServicePipeline (#6859)
17211721

@@ -2651,7 +2651,7 @@ There isn't a valid core binary for this release. Use v0.57.2 instead.
26512651
- Update OTLP to v0.17.0 (#5335)
26522652
- Add optional min/max fields to histograms (#5399)
26532653
- User-defined Resource attributes can be specified under `service.telemetry.resource`
2654-
configuration key and will be included as metric lables for own telemetry.
2654+
configuration key and will be included as metric labels for own telemetry.
26552655
If `service.instance.id` is not specified it will be auto-generated. Previously
26562656
`service.instance.id` was always auto-generated, so the default of the new
26572657
behavior matches the old behavior. (#5402)
@@ -2799,9 +2799,9 @@ There isn't a valid core binary for this release. Use v0.57.2 instead.
27992799
- Deprecate global flag in `featuregates` (#5060)
28002800
- Deprecate last funcs/structs in componenthelper (#5069)
28012801
- Change structs in otlpgrpc to follow standard go encoding interfaces (#5062)
2802-
- Deprecate `UnmarshalJSON[Traces|Metrics|Logs][Reques|Response]` in favor of `UnmarshalJSON`.
2803-
- Deprecate `[Traces|Metrics|Logs][Reques|Response].Marshal` in favor of `MarshalProto`.
2804-
- Deprecate `UnmarshalJSON[Traces|Metrics|Logs][Reques|Response]` in favor of `UnmarshalProto`.
2802+
- Deprecate `UnmarshalJSON[Traces|Metrics|Logs][Request|Response]` in favor of `UnmarshalJSON`.
2803+
- Deprecate `[Traces|Metrics|Logs][Request|Response].Marshal` in favor of `MarshalProto`.
2804+
- Deprecate `UnmarshalJSON[Traces|Metrics|Logs][Request|Response]` in favor of `UnmarshalProto`.
28052805
- Deprecating following pdata methods/types following OTLP v0.15.0 upgrade (#5076):
28062806
- InstrumentationLibrary is now InstrumentationScope
28072807
- NewInstrumentationLibrary is now NewInstrumentationScope
@@ -3047,7 +3047,7 @@ There isn't a valid core binary for this release. Use v0.57.2 instead.
30473047

30483048
- Remove reference to `defaultcomponents` in core and deprecate `include_core` flag (#4087)
30493049
- Remove `config.NewConfigMapFrom[File|Buffer]`, add testonly version (#4502)
3050-
- `configtls`: TLS 1.2 is the new default mininum version (#4503)
3050+
- `configtls`: TLS 1.2 is the new default minimum version (#4503)
30513051
- `confighttp`: `ToServer` now accepts a `component.Host`, in line with gRPC's counterpart (#4514)
30523052
- CORS configuration for OTLP/HTTP receivers has been moved into a `cors:` block, instead of individual `cors_allowed_origins` and `cors_allowed_headers` settings (#4492)
30533053

@@ -3841,7 +3841,7 @@ This release is marked as "bad" since the metrics pipelines will produce bad dat
38413841
- Add `CustomRoundTripper` function to httpclientconfig (#2085)
38423842
- Allow for more logging options to be passed to `service` (#2132)
38433843
- Add config parameters for `jaeger` receiver (#2068)
3844-
- Map unset status code for `jaegar` translator as per spec (#2134)
3844+
- Map unset status code for `jaeger` translator as per spec (#2134)
38453845
- Add more trace annotations to the queue-retry logic (#2136)
38463846
- Add config settings for component telemetry (#2148)
38473847
- Use net.SplitHostPort for IPv6 support in `prometheus` receiver (#2154)
@@ -4091,7 +4091,7 @@ This release is marked as "bad" since the metrics pipelines will produce bad dat
40914091
### 🚀 New components 🚀
40924092

40934093
- Receivers
4094-
- `fluentfoward` runs a TCP server that accepts events via the [Fluent Forward protocol](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1) (#1173)
4094+
- `fluentforward` runs a TCP server that accepts events via the [Fluent Forward protocol](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1) (#1173)
40954095
- Exporters
40964096
- `kafka` exports traces to Kafka (#1439)
40974097
- Extensions
@@ -4162,7 +4162,7 @@ This release is marked as "bad" since the metrics pipelines will produce bad dat
41624162
of different versions
41634163
- Make "--new-metrics" command line flag the default (#1148)
41644164
- Change `endpoint` to `url` in Zipkin exporter config (#1186)
4165-
- Change `tls_credentials` to `tls_settings` in Jaegar receiver config (#1233)
4165+
- Change `tls_credentials` to `tls_settings` in Jaeger receiver config (#1233)
41664166
- OTLP receiver config change for `protocols` to support mTLS (#1223)
41674167
- Remove `export_resource_labels` flag from Zipkin exporter (#1163)
41684168

cmd/mdatagen/metadata-schema.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,28 @@ metrics:
117117
# Optional: array of attributes that were defined in the attributes section that are emitted by this metric.
118118
attributes: [string]
119119

120+
# Optional: map of event names with the key being the event name and value
121+
# being described below.
122+
events:
123+
<event.name>:
124+
# Required: whether the event is collected by default.
125+
enabled: bool
126+
# Required: event description.
127+
description:
128+
# Optional: extended documentation of the event.
129+
extended_documentation:
130+
# Optional: warnings that will be shown to user under specified conditions.
131+
warnings:
132+
# A warning that will be displayed if the event is enabled in user config.
133+
# Should be used for deprecated default events that will be removed soon.
134+
if_enabled:
135+
# A warning that will be displayed if `enabled` field is not set explicitly in user config.
136+
if_enabled_not_set:
137+
# A warning that will be displayed if the event is configured by user in any way.
138+
if_configured:
139+
# Optional: array of attributes that were defined in the attributes section that are emitted by this event.
140+
attributes: [string]
141+
120142
# Lifecycle tests generated for this component.
121143
tests:
122144
config: # {} by default, specific testing configuration for lifecycle tests.

exporter/exporterhelper/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The following configuration options can be modified:
2626
- `batch` disabled by default if not defined
2727
- `flush_timeout`: time after which a batch will be sent regardless of its size. Must be a non-zero value
2828
- `min_size`: the minimum size of a batch.
29-
- `max_size`: the maximum size of a batch, enables batch splitting. The maximum size of a batch should be greater than or equal to the mininum size of a batch.
29+
- `max_size`: the maximum size of a batch, enables batch splitting. The maximum size of a batch should be greater than or equal to the minimum size of a batch.
3030
- `timeout` (default = 5s): Time to wait per individual attempt to send data to a backend
3131

3232
The `initial_interval`, `max_interval`, `max_elapsed_time`, and `timeout` options accept

pdata/pprofile/attributes.go

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type attributable interface {
1717

1818
// FromAttributeIndices builds a [pcommon.Map] containing the attributes of a
1919
// record.
20-
// The record can by any struct that implements an `AttributeIndices` method.
20+
// The record can be any struct that implements an `AttributeIndices` method.
2121
// Updates made to the return map will not be applied back to the record.
2222
func FromAttributeIndices(table AttributeTableSlice, record attributable) pcommon.Map {
2323
m := pcommon.NewMap()
@@ -31,9 +31,7 @@ func FromAttributeIndices(table AttributeTableSlice, record attributable) pcommo
3131
return m
3232
}
3333

34-
// AddAttribute updates an AttributeTable and a record's AttributeIndices to
35-
// add a new attribute.
36-
// The record can by any struct that implements an `AttributeIndices` method.
34+
// Deprecated: [v0.126.0] Use PutAttribute instead.
3735
func AddAttribute(table AttributeTableSlice, record attributable, key string, value pcommon.Value) error {
3836
for i := range table.Len() {
3937
a := table.At(i)
@@ -66,3 +64,80 @@ func AddAttribute(table AttributeTableSlice, record attributable, key string, va
6664

6765
return nil
6866
}
67+
68+
var errTooManyTableEntries = errors.New("too many entries in AttributeTable")
69+
70+
// PutAttribute updates an AttributeTable and a record's AttributeIndices to
71+
// add or update an attribute.
72+
// The assumption is that attributes are a map as for other signals (metrics, logs, etc.), thus
73+
// the same key must not appear twice in a list of attributes / attribute indices.
74+
// The record can be any struct that implements an `AttributeIndices` method.
75+
func PutAttribute(table AttributeTableSlice, record attributable, key string, value pcommon.Value) error {
76+
for i := range record.AttributeIndices().Len() {
77+
idx := int(record.AttributeIndices().At(i))
78+
if idx < 0 || idx >= table.Len() {
79+
return fmt.Errorf("index value %d out of range in AttributeIndices[%d]", idx, i)
80+
}
81+
attr := table.At(idx)
82+
if attr.Key() == key {
83+
if attr.Value().Equal(value) {
84+
// Attribute already exists, nothing to do.
85+
return nil
86+
}
87+
88+
// If the attribute table already contains the key/value pair, just update the index.
89+
for j := range table.Len() {
90+
a := table.At(j)
91+
if a.Key() == key && a.Value().Equal(value) {
92+
if j > math.MaxInt32 {
93+
return errTooManyTableEntries
94+
}
95+
record.AttributeIndices().SetAt(i, int32(j)) //nolint:gosec // overflow checked
96+
return nil
97+
}
98+
}
99+
100+
if table.Len() >= math.MaxInt32 {
101+
return errTooManyTableEntries
102+
}
103+
104+
// Add the key/value pair as a new attribute to the table...
105+
entry := table.AppendEmpty()
106+
entry.SetKey(key)
107+
value.CopyTo(entry.Value())
108+
109+
// ...and update the existing index.
110+
record.AttributeIndices().SetAt(i, int32(table.Len()-1)) //nolint:gosec // overflow checked
111+
return nil
112+
}
113+
}
114+
115+
if record.AttributeIndices().Len() >= math.MaxInt32 {
116+
return errors.New("too many entries in AttributeIndices")
117+
}
118+
119+
for j := range table.Len() {
120+
a := table.At(j)
121+
if a.Key() == key && a.Value().Equal(value) {
122+
if j > math.MaxInt32 {
123+
return errTooManyTableEntries
124+
}
125+
// Add the index of the existing attribute to the indices.
126+
record.AttributeIndices().Append(int32(j)) //nolint:gosec // overflow checked
127+
return nil
128+
}
129+
}
130+
131+
if table.Len() >= math.MaxInt32 {
132+
return errTooManyTableEntries
133+
}
134+
135+
// Add the key/value pair as a new attribute to the table...
136+
entry := table.AppendEmpty()
137+
entry.SetKey(key)
138+
value.CopyTo(entry.Value())
139+
140+
// ...and add a new index to the indices.
141+
record.AttributeIndices().Append(int32(table.Len() - 1)) //nolint:gosec // overflow checked
142+
return nil
143+
}

0 commit comments

Comments
 (0)