Skip to content

Redact headers when exporting internal telemetry through OTLP#14756

Merged
mx-psi merged 5 commits intoopen-telemetry:mainfrom
jade-guiton-dd:redact-internal-telemetry-headers
Apr 6, 2026
Merged

Redact headers when exporting internal telemetry through OTLP#14756
mx-psi merged 5 commits intoopen-telemetry:mainfrom
jade-guiton-dd:redact-internal-telemetry-headers

Conversation

@jade-guiton-dd
Copy link
Copy Markdown
Contributor

@jade-guiton-dd jade-guiton-dd commented Mar 11, 2026

Description

Currently, when exporting the Collector's internal telemetry through OTLP, headers defined on the OTLP exporter will be marshaled in plain text when the Collector's configuration is exported (through the OpAMP extension, for instance). This PR adds a confmap.Marshaler implementation to the configuration structs which overwrites the header values with [REDACTED], as if the fields used configopaque.String (which would be hard to implement since they are defined in the external otelconf package).

To be honest I'm not super pleased with the dynamic way I implemented it in terms of performance, but I think it's the most reasonable way to implement it without adding too much complexity for something that should ideally be fixed at the otelconf level. It should also be adaptable to other cases where we need to redact marshaled configs after the fact, if necessary.

The changes to the existing test data were done to accommodate the new Marshal test (in some cases, assert.Equal will complain that a value isn't an untyped nil, but there is no way to produce one with our unmarshaling process), and to avoid making the input and output look unnecessarily different (e.g. for the capitalization of the verbosity levels).

Testing

I added some tests to otelconftelemetry/internal/migration which check the output of marshaling the configuration.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 76.47059% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.22%. Comparing base (76ede07) to head (2351ad4).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...try/otelconftelemetry/internal/migration/v0.3.0.go 66.66% 3 Missing and 3 partials ⚠️
...try/otelconftelemetry/internal/migration/redact.go 87.50% 1 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (76.47%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14756      +/-   ##
==========================================
- Coverage   91.24%   91.22%   -0.02%     
==========================================
  Files         697      698       +1     
  Lines       44647    44681      +34     
==========================================
+ Hits        40738    40761      +23     
- Misses       2769     2775       +6     
- Partials     1140     1145       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jade-guiton-dd
Copy link
Copy Markdown
Contributor Author

The two failing tests seem to also be failing on main.

@jade-guiton-dd jade-guiton-dd marked this pull request as ready for review March 11, 2026 16:39
@jade-guiton-dd jade-guiton-dd requested a review from a team as a code owner March 11, 2026 16:39
@jade-guiton-dd jade-guiton-dd requested a review from mx-psi March 11, 2026 16:39
Copy link
Copy Markdown
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't deeply check which keys need to be redacted, but overall this looks good to me.

Comment thread service/telemetry/otelconftelemetry/internal/migration/redact.go Outdated
Comment thread service/telemetry/otelconftelemetry/internal/migration/testdata/v0.3.0_logs.yaml Outdated
@jade-guiton-dd jade-guiton-dd added area:service collector-telemetry healthchecker and other telemetry collection issues ready-to-merge Code review completed; ready to merge by maintainers labels Mar 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions Bot added the Stale label Apr 1, 2026
@mx-psi mx-psi added this pull request to the merge queue Apr 6, 2026
Merged via the queue into open-telemetry:main with commit 26800af Apr 6, 2026
65 of 66 checks passed
TimoBehrendt pushed a commit to TimoBehrendt/tracebasedlogsampler that referenced this pull request Apr 22, 2026
…ocessortest to v0.150.0 (#57)

This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [go.opentelemetry.io/collector/processor/processortest](https://github.com/open-telemetry/opentelemetry-collector) | `v0.149.0` → `v0.150.0` | ![age](https://developer.mend.io/api/mc/badges/age/go/go.opentelemetry.io%2fcollector%2fprocessor%2fprocessortest/v0.150.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/go/go.opentelemetry.io%2fcollector%2fprocessor%2fprocessortest/v0.149.0/v0.150.0?slim=true) |

---

### Release Notes

<details>
<summary>open-telemetry/opentelemetry-collector (go.opentelemetry.io/collector/processor/processortest)</summary>

### [`v0.150.0`](https://github.com/open-telemetry/opentelemetry-collector/blob/HEAD/CHANGELOG.md#v1560v01500)

[Compare Source](open-telemetry/opentelemetry-collector@v0.149.0...v0.150.0)

##### 💡 Enhancements 💡

- `all`: Update semconv package from 1.38.0 to 1.40.0 ([#&#8203;15095](open-telemetry/opentelemetry-collector#15095))
- `cmd/mdatagen`: Only allow the `ToVersion` feature flag attribute to be set for the `Stable` and `Deprecated` stages. ([#&#8203;15040](open-telemetry/opentelemetry-collector#15040))
  To better match the feature flag README
  (<https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md#feature-lifecycle>).

##### 🧰 Bug fixes 🧰

- `exporter/debug`: Guard from out of bounds profiles dictionary indices ([#&#8203;14803](open-telemetry/opentelemetry-collector#14803))

- `pdata/pprofile`: create a copy when the input is marked as read-only ([#&#8203;15080](open-telemetry/opentelemetry-collector#15080))

- `pkg/otelcol`: Fix missing default values in unredacted print-config command by introducing confmap.WithUnredacted MarshalOption. ([#&#8203;14750](open-telemetry/opentelemetry-collector#14750))
  Resolves an issue where the unredacted mode output omitted all default-valued options. By introducing a new MarshalOption to disable redaction directly at the confmap encoding level, the unredacted mode now preserves all component defaults natively without requiring post-processing.

- `pkg/service`: Headers on the internal telemetry OTLP exporter are now redacted when the configuration is marshaled ([#&#8203;14756](open-telemetry/opentelemetry-collector#14756))

<!-- previous-version -->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My41LjQiLCJ1cGRhdGVkSW5WZXIiOiI0My41LjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://gitea.t000-n.de/t.behrendt/tracebasedlogsampler/pulls/57
Reviewed-by: t.behrendt <t.behrendt@noreply.localhost>
Co-authored-by: Renovate Bot <renovate@t00n.de>
Co-committed-by: Renovate Bot <renovate@t00n.de>
TimoBehrendt pushed a commit to TimoBehrendt/tracebasedlogsampler that referenced this pull request Apr 23, 2026
…1.56.0 (#52)

This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [go.opentelemetry.io/collector/confmap](https://github.com/open-telemetry/opentelemetry-collector) | `v1.55.0` → `v1.56.0` | ![age](https://developer.mend.io/api/mc/badges/age/go/go.opentelemetry.io%2fcollector%2fconfmap/v1.56.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/go/go.opentelemetry.io%2fcollector%2fconfmap/v1.55.0/v1.56.0?slim=true) |

---

### Release Notes

<details>
<summary>open-telemetry/opentelemetry-collector (go.opentelemetry.io/collector/confmap)</summary>

### [`v1.56.0`](https://github.com/open-telemetry/opentelemetry-collector/blob/HEAD/CHANGELOG.md#v1560v01500)

##### 💡 Enhancements 💡

- `all`: Update semconv package from 1.38.0 to 1.40.0 ([#&#8203;15095](open-telemetry/opentelemetry-collector#15095))
- `cmd/mdatagen`: Only allow the `ToVersion` feature flag attribute to be set for the `Stable` and `Deprecated` stages. ([#&#8203;15040](open-telemetry/opentelemetry-collector#15040))
  To better match the feature flag README
  (<https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md#feature-lifecycle>).

##### 🧰 Bug fixes 🧰

- `exporter/debug`: Guard from out of bounds profiles dictionary indices ([#&#8203;14803](open-telemetry/opentelemetry-collector#14803))

- `pdata/pprofile`: create a copy when the input is marked as read-only ([#&#8203;15080](open-telemetry/opentelemetry-collector#15080))

- `pkg/otelcol`: Fix missing default values in unredacted print-config command by introducing confmap.WithUnredacted MarshalOption. ([#&#8203;14750](open-telemetry/opentelemetry-collector#14750))
  Resolves an issue where the unredacted mode output omitted all default-valued options. By introducing a new MarshalOption to disable redaction directly at the confmap encoding level, the unredacted mode now preserves all component defaults natively without requiring post-processing.

- `pkg/service`: Headers on the internal telemetry OTLP exporter are now redacted when the configuration is marshaled ([#&#8203;14756](open-telemetry/opentelemetry-collector#14756))

<!-- previous-version -->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My41LjQiLCJ1cGRhdGVkSW5WZXIiOiI0My41LjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://gitea.t000-n.de/t.behrendt/tracebasedlogsampler/pulls/52
Reviewed-by: t.behrendt <t.behrendt@noreply.localhost>
Co-authored-by: Renovate Bot <renovate@t00n.de>
Co-committed-by: Renovate Bot <renovate@t00n.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:service collector-telemetry healthchecker and other telemetry collection issues ready-to-merge Code review completed; ready to merge by maintainers Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants