Skip to content

refactor: improve telemetry api receiver listener initialization logic#2096

Merged
wpessers merged 2 commits intoopen-telemetry:mainfrom
herin049:refactor/improve-telemetryreceiver-listener
Mar 14, 2026
Merged

refactor: improve telemetry api receiver listener initialization logic#2096
wpessers merged 2 commits intoopen-telemetry:mainfrom
herin049:refactor/improve-telemetryreceiver-listener

Conversation

@herin049
Copy link
Contributor

Improves the Telemetry API receiver listener initialization logic to more closely match the logic used elsewhere in the layer. Updated the default behavior to listen on :0 by default to eliminate the need of manually specifying ports and eliminate the possibility of encountering Error: address already in use errors that are very rare and difficult to debug. The listener now handles shutdown properly by closing the HTTP listener, and several incorrect log statements have been updated with a few additional ones added.

@herin049 herin049 requested a review from a team as a code owner December 26, 2025 19:51
if err != nil {
return nil, "", err
}
addr := fmt.Sprintf("%s:%d", l.Addr().Network(), l.Addr().(*net.TCPAddr).Port)
Copy link
Member

Choose a reason for hiding this comment

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

Looks like l.Addr().Network() returns the network type string "tcp". So wouldn't this produce an address like tcp:53421 instead of sandbox.localdomain:53421?

That would mean the subscribe URI passed to the Telemetry API ends up as http://tcp:53421/, which Lambda wouldn't be able to resolve to deliver events to I think?

For reference, the internal listener at internal/telemetryapi/listener.go uses the listenerAddr variable directly for this and I think a lot of the logic we already have there is directly applicable here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, this must have been a typo, or I made this change very late at night. I can update this, and add a test, since I'm surprised this managed to slip through.

@wpessers
Copy link
Member

wpessers commented Mar 1, 2026

@herin049 if you get a chance to check out the feedback again, we can merge this sometime soon.

@herin049
Copy link
Contributor Author

herin049 commented Mar 1, 2026

@herin049 if you get a chance to check out the feedback again, we can merge this sometime soon.

@wpessers Sorry, had this on hold for a bit, will fix all of the issues by tomorrow!

@wpessers
Copy link
Member

wpessers commented Mar 1, 2026

@wpessers Sorry, had this on hold for a bit, will fix all of the issues by tomorrow!

No rush! Just wanted to make sure it’s still on your radar.

@herin049 herin049 force-pushed the refactor/improve-telemetryreceiver-listener branch from bde0377 to 46ecc39 Compare March 12, 2026 20:28
@herin049 herin049 force-pushed the refactor/improve-telemetryreceiver-listener branch from 1bc885f to fce77c2 Compare March 14, 2026 03:58
@wpessers wpessers merged commit 05db121 into open-telemetry:main Mar 14, 2026
14 checks passed
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.

2 participants