Skip to content

Use stable network attributes - #49465

Open
avy252004 wants to merge 7 commits into
open-telemetry:mainfrom
avy252004:useStableNetworkAttributes
Open

Use stable network attributes#49465
avy252004 wants to merge 7 commits into
open-telemetry:mainfrom
avy252004:useStableNetworkAttributes

Conversation

@avy252004

Copy link
Copy Markdown
Contributor

Description

This PR updates the "use of stable network attributes from deprecated ones" for the tcp_input and udp_input operators to reflect the migration from deprecated net.* attributes to the stable network.* semantic conventions.

When the StanzaUseStableNetworkAttributesFeatureGate configuration is enabled, users can now opt-in to the stable attributes via a new feature flag.

When the feature flag is enabled, the following attributes are replaced:

Deprecated Stable Replacement
net.transport network.transport ("tcp" / "udp")
net.peer.ip network.peer.address
net.peer.port network.peer.port
net.host.ip network.local.address
net.host.port network.local.port

Please note that net.peer.name and net.host.name are being dropped and do not have stable replacements under the new feature flag.

  • Why: The stable semantic conventions currently lack a generic, socket-level equivalent for reverse-DNS hostnames. The closest existing attributes (client.address and server.address) are HTTP-flavored and require making assumptions about which side of the socket is the "client" versus the "server". Such assumptions we cannot safely make for TCP/UDP inputs.
  • Effect: When the stanza.useStableNetworkAttributes feature flag is enabled, these two attributes will no longer be emitted. Users relying on these attributes for reverse-DNS hostname resolution will need to account for their absence in downstream processing.

Link to tracking issue

Fixes #49051

Testing

setStableNetworkAttributesGate function added to both tcp/udp_test.go files.

Documentation

pkg/stanza/documentation.md changed and added the
Added details for stanza.useStableNetworkAttributes in the relevant operator READMEs / feature flag registry.

Authorship

  • I, a human, wrote this pull request description myself.

@avy252004
avy252004 requested review from a team and andrzej-stencel as code owners July 4, 2026 07:14
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

  • Read our Contributing Guidelines.
  • Sign the CLA if you haven't already.
  • First-time contributors should have at most one PR not marked as draft until their first PR is merged.
  • If your change isn't one of our priority components, reviews may take more time.
  • Give reviewers at least a few days before pinging them for feedback.
  • If you need help or struggle to move your PR forward:

@singhvibhanshu

Copy link
Copy Markdown
Member

/workflow-approve

@avy252004
avy252004 force-pushed the useStableNetworkAttributes branch from 1a92092 to 8bf8838 Compare July 10, 2026 17:14
@@ -1 +1 @@
invalid ruok No newline at end of file
git stash push -u -m "stable network attributes WIP"invalid ruok No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🙅

Suggested change
git stash push -u -m "stable network attributes WIP"invalid ruok
invalid ruok

| `logs.jsonParserArray` | beta | When enabled, allows usage of `json_array_parser`. | v0.93.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/30321) |
| `parser.uri.ecscompliant` | alpha | When enabled resulting map will be in semconv compliant format. | v0.103.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/32906) |
| `stanza.synchronousLogEmitter` | alpha | Prevents possible data loss in Stanza-based receivers by emitting logs synchronously. | v0.122.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35456) |
| `stanza.useStableNetworkAttributes` | alpha | When enabled, the `tcp_input` and `udp_input` operators emit stable `network.*` semantic convention attributes instead of the deprecated `net.*` attributes when `add_attributes` is enabled. | v0.156.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/49051) |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I'd prefer a separate feature gate for TCP and UDP.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I understood but the problem is syslog receiver also reuses the same stanza TCP/UDP input.go implementations. So if we make two gates then for syslog receiver we will get mixed attribute names logs. That will make inconsistent entries.
for example:
TCP logs using network.* while UDP logs still use net.*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

From what I understand, I guess this PR should only focus to the TCP logs. 🙂
While changes related to UDP logs should handle in a separate PR which is IMO is this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I initially thought the same that we need feature gate for the TCP logs but again when i found UDP use the same existing network attribute logic and syslog is also dependent on the TCP & UDP input files then i thought shared gate is much better for consistency.

But i m open to get review and make changes if this approach is not ideal.

Comment thread pkg/stanza/operator/input/tcp/input.go Outdated
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 13, 2026

Copy link
Copy Markdown

Pull request dashboard status

Status last refreshed: 2026-07-27 23:19:48 UTC.

  • Waiting on: Reviewers
  • Next step: Review the latest changes.

This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected.

@avy252004
avy252004 force-pushed the useStableNetworkAttributes branch from 5d8171e to cd18a0c Compare July 14, 2026 00:37
Comment thread pkg/stanza/metadata.yaml Outdated
avy252004 and others added 2 commits July 14, 2026 17:55
@avy252004

avy252004 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@andrzej-stencel , @antonblock , @akats7 can you review the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[receiver/tcp_log] Emit stable network attributes on add_attributes: true

3 participants