Skip to content

feat: Allow configuration of additional headers#1771

Merged
mterhar merged 13 commits intomainfrom
mterhar.additional-headers
Feb 13, 2026
Merged

feat: Allow configuration of additional headers#1771
mterhar merged 13 commits intomainfrom
mterhar.additional-headers

Conversation

@mterhar
Copy link
Contributor

@mterhar mterhar commented Jan 9, 2026

Which problem is this PR solving?

If running Refinery in an environment that requires mTLS, we need to be able to configure a header to let the proxy know where to pass the traffic along.

Short description of the changes

Adds a configuration that injects headers into each of the signals that comes out of Refinery that are destined for Honeycomb.

  1. Telemetry data flowing through the sampling proxy has it added to the DirectTransport http client
  2. Logs from the Honeycomb logger have it added to the libhoney-go as a Round Tripper
  3. Metrics coming from the OpenTelemetry metrics emitter have them added to the exporter
  4. Experimental internal tracing has them added as well, just for troubleshooting if it's ever necessary

@mterhar mterhar requested a review from a team as a code owner January 9, 2026 22:37
@mterhar
Copy link
Contributor Author

mterhar commented Jan 9, 2026

Had to make a tweak to the markdown/yaml generator that uses the configMeta.yaml file. The example I made has 2 colons and since we don't use colon+space to delimit like yaml does, I had to make a splitter function that just looks for the first delimiter and stops trying to split afterwards.

mterhar pushed a commit that referenced this pull request Jan 14, 2026
## Which problem is this PR solving?

I was playing with the tests to get to know the changes in #1771. The
result is mostly the same, but I propose we maintain this version.

## Short description of the changes

The multiple commits show my fiddling, but the major changes are:

* a single table-driven test
* the lock for synchronizing the captured headers is hidden by using an
atomic type
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

A couple of thoughts; I'll leave to @robbkidd for final approval.

Copy link
Member

@robbkidd robbkidd left a comment

Choose a reason for hiding this comment

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

I tried this branch out sending locally. I gave it one of the reserved headers and …

❯ go run ./cmd/refinery --config ./config.yaml --rules_config rules.yaml
cannot override reserved Honeycomb header "X-Honeycomb-Team" in Network.AdditionalHeaders
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x108 pc=0x102c43be0]

goroutine 1 [running]:
github.com/honeycombio/refinery/logger.GetLoggerImplementation({0x0?, 0x0?})
        .../refinery/logger/logger.go:32 +0x20
main.main()
        .../refinery/cmd/refinery/main.go:114 +0x464
exit status 2

The automated tests don't exercise main where the panic happens. This has me realize that this config validation is happening entirely outside of our existing config validation process … which is ideally where it ought to occur.

mterhar pushed a commit that referenced this pull request Feb 6, 2026
## Which problem is this PR solving?

I was playing with the tests to get to know the changes in #1771. The
result is mostly the same, but I propose we maintain this version.

## Short description of the changes

The multiple commits show my fiddling, but the major changes are:

* a single table-driven test
* the lock for synchronizing the captured headers is hidden by using an
atomic type
@mterhar mterhar force-pushed the mterhar.additional-headers branch from 2d6117e to 8b2dfff Compare February 6, 2026 14:55
mterhar and others added 7 commits February 12, 2026 19:49
## Which problem is this PR solving?

I was playing with the tests to get to know the changes in #1771. The
result is mostly the same, but I propose we maintain this version.

## Short description of the changes

The multiple commits show my fiddling, but the major changes are:

* a single table-driven test
* the lock for synchronizing the captured headers is hidden by using an
atomic type
@mterhar mterhar force-pushed the mterhar.additional-headers branch from 3f38a1c to 8ef48ab Compare February 12, 2026 19:58
@robbkidd
Copy link
Member

I tried this branch out sending locally. [… and it panicked]

I can't reproduce this any more, so disregard!

IGNORE ME

@mterhar mterhar merged commit 332bdb2 into main Feb 13, 2026
6 checks passed
@mterhar mterhar deleted the mterhar.additional-headers branch February 13, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants