Skip to content

Commit 04d80c7

Browse files
Merge branch 'main' into add-splunk-rolling-restart-metric
2 parents 8ad893e + 64777a4 commit 04d80c7

25 files changed

+352
-194
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
change_type: new_component
2+
3+
component: googlecloudlogentryencodingextension
4+
5+
note: Update stability to alpha.
6+
7+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
8+
issues: [37531]
9+
10+
change_logs: [user]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
change_type: deprecation
2+
3+
component: googlecloudpubsubreceiver
4+
5+
note: Add deprecation warning for the build-in encoders
6+
7+
issues: [39371]
8+
9+
subtext: |
10+
The build-in encoders `cloud_logging` and `raw_text` both have encoding extension alternatives and will be removed
11+
in version v0.132.0 of the collector.
12+
13+
change_logs: [user]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
change_type: breaking
2+
3+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
4+
component: googlecloudpubsubreceiver
5+
6+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
7+
note: Add `ignore_encoding_error` configuration to ignore decoding failures from the configured encoder
8+
9+
issues: [38164]
10+
11+
subtext: |
12+
Introduce a setting to ignore errors when the configured encoder. It's advised to set this to `true` when using
13+
a custom encoder, and use the new `receiver.googlecloudpubsub.encoding_error` metric to monitor the number of errors.
14+
Ignoring the error will cause the receiver to drop the message.
15+
16+
change_logs: [user]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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: receiver/prometheus
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Upgrade `receiver.prometheusreceiver.RemoveLegacyResourceAttributes` feature gate to `beta` stability (enabled by default)
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: [32814]
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+
Disable the `receiver.promtheusreceiver.RemoveLegacyResourceAttributes` feature gate to restore previous behavior. This feature gate will be removed in a future release.
20+
The feature gate is used to replace the following legacy resource attributes:
21+
`net.host.name` -> `server.address`
22+
`net.host.port` -> `server.port`
23+
`http.scheme` -> `url.scheme`
24+
25+
# If your change doesn't affect end users or the exported elements of any package,
26+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
27+
# Optional: The change log or logs in which this entry should be included.
28+
# e.g. '[user]' or '[user, api]'
29+
# Include 'user' if the change is relevant to end users.
30+
# Include 'api' if there is a change to a library API.
31+
# Default: '[user]'
32+
change_logs: []

cmd/otelcontribcol/builder-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ extensions:
5454
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/textencodingextension v0.125.0
5555
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/zipkinencodingextension v0.125.0
5656
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/skywalkingencodingextension v0.125.0
57+
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/googlecloudlogentryencodingextension v0.125.0
5758
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/k8sleaderelector v0.125.0
5859
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/cgroupruntimeextension v0.125.0
5960

exporter/prometheusexporter/end_to_end_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func TestEndToEndSummarySupport(t *testing.T) {
144144
`test_up.instance="127.0.0.1:.*",job="otel-collector". 1 .*`,
145145
`. HELP test_target_info Target metadata`,
146146
`. TYPE test_target_info gauge`,
147-
`test_target_info.http_scheme=\"http\",instance="127.0.0.1:.*",job="otel-collector",net_host_port=".*,server_port=".*",url_scheme="http". 1`,
147+
`test_target_info.instance="127.0.0.1:.*",job="otel-collector",server_port=".*",url_scheme="http". 1`,
148148
}
149149

150150
// 5.5: Perform a complete line by line prefix verification to ensure we extract back the inputs

extension/encoding/googlecloudlogentryencodingextension/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
<!-- status autogenerated section -->
44
| Status | |
55
| ------------- |-----------|
6-
| Stability | [development] |
7-
| Distributions | [] |
6+
| Stability | [alpha] |
7+
| Distributions | [contrib] |
88
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fgooglecloudlogentryencoding%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fgooglecloudlogentryencoding) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fgooglecloudlogentryencoding%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fgooglecloudlogentryencoding) |
99
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@alexvanboxel](https://www.github.com/alexvanboxel) |
1010

11-
[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development
11+
[alpha]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#alpha
12+
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
1213
<!-- end autogenerated section -->
1314

1415
This extension can be used fo unmarshaling a [Cloud Logging] [LogEntry] message type.

extension/encoding/googlecloudlogentryencodingextension/internal/metadata/generated_status.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension/encoding/googlecloudlogentryencodingextension/metadata.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ type: googlecloudlogentry_encoding
33
status:
44
class: extension
55
stability:
6-
development: [ extension ]
7-
distributions: [ ]
6+
alpha: [ extension ]
7+
distributions: [ contrib ]
88
codeowners:
99
active: [ alexvanboxel ]
1010

receiver/googlecloudpubsubreceiver/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ The following configuration options are supported:
3030
or switching between [global and regional service endpoints](https://cloud.google.com/pubsub/docs/reference/service_apis_overview#service_endpoints).
3131
* `insecure` (Optional): allows performing “insecure” SSL connections and transfers, useful when connecting to a local
3232
emulator instance. Only has effect if Endpoint is not ""
33+
* `ignore_encoding_error` (Optional): Ignore errors when the configured encoder fails to decoding a PubSub messages.
34+
It's advised to set this to `true` when using a custom encoder, and use `receiver.googlecloudpubsub.encoding_error`
35+
metric to monitor the number of errors. Ignoring the error will cause the receiver to drop the message.
3336

3437
```yaml
3538
receivers:
@@ -74,11 +77,12 @@ Extensions. The non OTLP build in encodings will be deprecated as soon as extens
7477
| raw_text | Wrap in an OTLP log message |
7578

7679
With `cloud_logging`, the receiver can be used to bring Cloud Logging messages into an OpenTelemetry pipeline. You'll
77-
first need to [set up a logging sink][sink-docs] with a Pub/Sub topic as its destination. Note that the `cloud_logging`
78-
integration is considered **alpha** as the semantic convention on some of the conversion are not stabilized yet.
80+
first need to [set up a logging sink][sink-docs] with a Pub/Sub topic as its destination. The build-in encoding is
81+
**deprecated** and will be removed in v0.132.0: Use the `googlecloudlogentry` encoding extension instead.
7982

8083
With `raw_text`, the receiver can be used for ingesting arbitrary text message on a Pubsub subscription, wrapping them
81-
in OTLP Log messages.
84+
in OTLP Log messages. The build-in encoding is **deprecated** and will be removed in v0.132.0: Use the `text` encoding
85+
extension instead.
8286

8387
When no encoding is specified, the receiver will try to discover the type of the data by looking at the `ce-type` and
8488
`content-type` attributes of the message. These message attributes are set by the `googlepubsubexporter`.

receiver/googlecloudpubsubreceiver/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ type Config struct {
3131
// Lock down the compression of the payload, leave empty for attribute based detection
3232
Compression string `mapstructure:"compression"`
3333

34+
// Ignore errors when the configured encoder fails to decoding a PubSub messages
35+
IgnoreEncodingError bool `mapstructure:"ignore_encoding_error"`
36+
3437
// The client id that will be used by Pubsub to make load balancing decisions
3538
ClientID string `mapstructure:"client_id"`
3639
}

receiver/googlecloudpubsubreceiver/documentation.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66

77
The following telemetry is emitted by this component.
88

9+
### otelcol_receiver.googlecloudpubsub.encoding_error
10+
11+
Number of times a message couldn't be decoded by the configured encoder
12+
13+
The receiver reads messages from Google Cloud Pub/Sub and tries to decode the message using the configured
14+
encoder. Each time a message fails to decoded the counter is increased.
15+
16+
17+
| Unit | Metric Type | Value Type | Monotonic |
18+
| ---- | ----------- | ---------- | --------- |
19+
| 1 | Sum | Int | true |
20+
921
### otelcol_receiver.googlecloudpubsub.stream_restarts
1022

1123
Number of times the stream (re)starts due to a Pub/Sub servers connection close

receiver/googlecloudpubsubreceiver/internal/metadata/generated_telemetry.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/googlecloudpubsubreceiver/internal/metadatatest/generated_telemetrytest.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/googlecloudpubsubreceiver/internal/metadatatest/generated_telemetrytest_test.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/googlecloudpubsubreceiver/metadata.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ telemetry:
2121
The receiver uses the Google Cloud Pub/Sub StreamingPull API and keeps a open connection. The Pub/Sub servers
2222
recurrently close the connection after a time period to avoid a long-running sticky connection. This metric
2323
counts the number of the resets that occurred during the lifetime of the container.
24+
receiver.googlecloudpubsub.encoding_error:
25+
enabled: true
26+
description: Number of times a message couldn't be decoded by the configured encoder
27+
unit: "1"
28+
sum:
29+
value_type: int
30+
monotonic: true
31+
extended_documentation: |
32+
The receiver reads messages from Google Cloud Pub/Sub and tries to decode the message using the configured
33+
encoder. Each time a message fails to decoded the counter is increased.
2434
2535
tests:
2636
config:

receiver/googlecloudpubsubreceiver/receiver.go

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
"go.opentelemetry.io/collector/pdata/ptrace"
2424
"go.opentelemetry.io/collector/receiver"
2525
"go.opentelemetry.io/collector/receiver/receiverhelper"
26+
"go.opentelemetry.io/otel/attribute"
27+
"go.opentelemetry.io/otel/metric"
2628

2729
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding"
2830
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudpubsubreceiver/internal"
@@ -181,8 +183,10 @@ func (receiver *pubsubReceiver) setMarshallerFromEncodingID(encodingID buildInEn
181183
case otlpProtoLog:
182184
receiver.logsUnmarshaler = &plog.ProtoUnmarshaler{}
183185
case rawTextLog:
186+
receiver.settings.Logger.Warn("build-in raw_text encoding is deprecated and will be removed in v0.132.0, use the text encoding extension instead")
184187
receiver.logsUnmarshaler = unmarshalLogStrings{}
185188
case cloudLogging:
189+
receiver.settings.Logger.Warn("build-in cloud_logging encoding is deprecated and will be removed in v0.132.0, use the googlecloudlogentry encoding extension instead")
186190
receiver.logsUnmarshaler = unmarshalCloudLoggingLogEntry{}
187191
default:
188192
return fmt.Errorf("cannot start receiver: build in encoding %s is not supported for logs", receiver.config.Encoding)
@@ -279,10 +283,14 @@ func (receiver *pubsubReceiver) handleTrace(ctx context.Context, payload []byte,
279283
return err
280284
}
281285
otlpData, err := receiver.tracesUnmarshaler.UnmarshalTraces(payload)
282-
count := otlpData.SpanCount()
283286
if err != nil {
287+
receiver.increaseEncodingErrorMetric(ctx, "traces")
288+
if receiver.config.IgnoreEncodingError {
289+
return nil
290+
}
284291
return err
285292
}
293+
count := otlpData.SpanCount()
286294
ctx = receiver.obsrecv.StartTracesOp(ctx)
287295
err = receiver.tracesConsumer.ConsumeTraces(ctx, otlpData)
288296
receiver.obsrecv.EndTracesOp(ctx, reportFormatProtobuf, count, err)
@@ -295,10 +303,14 @@ func (receiver *pubsubReceiver) handleMetric(ctx context.Context, payload []byte
295303
return err
296304
}
297305
otlpData, err := receiver.metricsUnmarshaler.UnmarshalMetrics(payload)
298-
count := otlpData.MetricCount()
299306
if err != nil {
307+
receiver.increaseEncodingErrorMetric(ctx, "metrics")
308+
if receiver.config.IgnoreEncodingError {
309+
return nil
310+
}
300311
return err
301312
}
313+
count := otlpData.MetricCount()
302314
ctx = receiver.obsrecv.StartMetricsOp(ctx)
303315
err = receiver.metricsConsumer.ConsumeMetrics(ctx, otlpData)
304316
receiver.obsrecv.EndMetricsOp(ctx, reportFormatProtobuf, count, err)
@@ -311,16 +323,29 @@ func (receiver *pubsubReceiver) handleLog(ctx context.Context, payload []byte, c
311323
return err
312324
}
313325
otlpData, err := receiver.logsUnmarshaler.UnmarshalLogs(payload)
314-
count := otlpData.LogRecordCount()
315326
if err != nil {
327+
receiver.increaseEncodingErrorMetric(ctx, "logs")
328+
if receiver.config.IgnoreEncodingError {
329+
return nil
330+
}
316331
return err
317332
}
333+
count := otlpData.LogRecordCount()
318334
ctx = receiver.obsrecv.StartLogsOp(ctx)
319335
err = receiver.logsConsumer.ConsumeLogs(ctx, otlpData)
320336
receiver.obsrecv.EndLogsOp(ctx, reportFormatProtobuf, count, err)
321337
return nil
322338
}
323339

340+
func (receiver *pubsubReceiver) increaseEncodingErrorMetric(ctx context.Context, signal string) {
341+
receiver.telemetryBuilder.ReceiverGooglecloudpubsubEncodingError.Add(ctx, 1,
342+
metric.WithAttributes(
343+
attribute.String("otelcol.component.kind", "receiver"),
344+
attribute.String("otelcol.component.id", receiver.settings.ID.String()),
345+
attribute.String("otelcol.signal", signal),
346+
))
347+
}
348+
324349
func (receiver *pubsubReceiver) detectEncoding(attributes map[string]string) (otlpEncoding buildInEncoding, otlpCompression buildInCompression) {
325350
otlpEncoding = unknown
326351
otlpCompression = uncompressed

receiver/prometheusreceiver/internal/prom_to_otlp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const removeOldSemconvFeatureGateID = "receiver.prometheusreceiver.RemoveLegacyR
1818

1919
var removeOldSemconvFeatureGate = featuregate.GlobalRegistry().MustRegister(
2020
removeOldSemconvFeatureGateID,
21-
featuregate.StageAlpha,
21+
featuregate.StageBeta,
2222
featuregate.WithRegisterFromVersion("v0.101.0"),
2323
featuregate.WithRegisterDescription("When enabled, the net.host.name, net.host.port, and http.scheme resource attributes are no longer added to metrics. Use server.address, server.port, and url.scheme instead."),
2424
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32814"),

receiver/prometheusreceiver/metrics_receiver_labels_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,7 @@ func verifyHonorLabelsTrue(t *testing.T, td *testData, rms []pmetric.ResourceMet
628628
expectedResourceAttributes.PutStr("service.name", "honor_labels_test")
629629
expectedResourceAttributes.PutStr("service.instance.id", "hostname:8080")
630630
expectedResourceAttributes.PutStr("server.port", "8080")
631-
expectedResourceAttributes.PutStr("net.host.port", "8080")
632631
expectedResourceAttributes.PutStr("server.address", "hostname")
633-
expectedResourceAttributes.PutStr("net.host.name", "hostname")
634632

635633
expectedScrapeConfigAttributes := td.attributes
636634

@@ -748,9 +746,7 @@ func verifyRelabelJobInstance(t *testing.T, td *testData, rms []pmetric.Resource
748746
wantAttributes.PutStr("service.name", "not-target1")
749747
wantAttributes.PutStr("service.instance.id", "relabeled-instance")
750748
wantAttributes.PutStr("server.port", "")
751-
wantAttributes.PutStr("net.host.port", "")
752749
wantAttributes.PutStr("server.address", "relabeled-instance")
753-
wantAttributes.PutStr("net.host.name", "relabeled-instance")
754750

755751
metrics1 := rms[0].ScopeMetrics().At(0).Metrics()
756752
ts1 := metrics1.At(0).Gauge().DataPoints().At(0).Timestamp()

receiver/receivercreator/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ the Pod level hints are used as a fallback (see detailed example below).
605605

606606
The current implementation relies on the implementation of `k8sobserver` extension and specifically
607607
the [pod_endpoint](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.111.0/extension/observer/k8sobserver/pod_endpoint.go).
608-
The hints are evaluated per container by extracting the annotations from each [`Pod Container` endpoint](#Pod Container) that is emitted.
608+
The hints are evaluated per container by extracting the annotations from each [`Pod Container` endpoint](#pod-container) that is emitted.
609609

610610

611611
### Examples
@@ -748,4 +748,4 @@ spec:
748748
- name: redis
749749
containerPort: 6379
750750
protocol: TCP
751-
```
751+
```

0 commit comments

Comments
 (0)