Skip to content

[extension/encoding/googlecloudlogentryencoding] accept short ALPN protocol tokens (h2, h3)#47621

Open
alliasgher wants to merge 5 commits intoopen-telemetry:mainfrom
alliasgher:fix-gclog-encoding-h2-protocol
Open

[extension/encoding/googlecloudlogentryencoding] accept short ALPN protocol tokens (h2, h3)#47621
alliasgher wants to merge 5 commits intoopen-telemetry:mainfrom
alliasgher:fix-gclog-encoding-h2-protocol

Conversation

@alliasgher
Copy link
Copy Markdown
Contributor

Fixes #45214. handleHTTPRequestField required exactly one "/" in the protocol string, rejecting "h2" and similar short ALPN tokens that GCP Load Balancers send for HTTP/2. Relax the validation: strings without "/" are stored as the protocol name with no version attribute.

@github-actions
Copy link
Copy Markdown
Contributor

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

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

…otocol tokens

handleHTTPRequestField required exactly one "/" in the protocol string,
rejecting tokens like "h2" that Google Cloud Load Balancers started using
for HTTP/2 in late 2024.  This silently dropped affected log entries.

Relax the check: if the protocol string contains no "/", store it as-is
in network.protocol.name and omit network.protocol.version. If a "/"
is present the existing validation (both sides must be non-empty) still
applies.

Fixes open-telemetry#45214

Signed-off-by: alliasgher <alliasgher123@gmail.com>
@alliasgher alliasgher force-pushed the fix-gclog-encoding-h2-protocol branch from 45cc538 to c774c90 Compare April 15, 2026 10:23
@github-actions github-actions Bot requested a review from constanca-m April 15, 2026 10:24
Comment thread extension/encoding/googlecloudlogentryencodingextension/log_entry.go Outdated
Replace the strings.Count pre-check with a single strings.Cut call,
then use strings.Contains on the version component to detect extra
slashes. This avoids scanning the string twice.

Signed-off-by: Ali <alliasgher123@gmail.com>
Copy link
Copy Markdown
Contributor

@constanca-m constanca-m left a comment

Choose a reason for hiding this comment

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

Thank you @alliasgher !

@constanca-m
Copy link
Copy Markdown
Contributor

/workflow-approve

@constanca-m
Copy link
Copy Markdown
Contributor

Please add a changelog entry @alliasgher so the PR has all approvals to get merged

Comment thread extension/encoding/googlecloudlogentryencodingextension/log_entry.go Outdated
alliasgher and others added 2 commits April 21, 2026 16:21
…okens

Map the bare HTTP/2 and HTTP/3 ALPN identifiers to the canonical
(name, version) pair used for the "HTTP/1.1" form so telemetry stays
consistent across protocol versions. Unknown short ALPN tokens fall
back to the raw value as the protocol name.

Signed-off-by: Ali <alliasgher123@gmail.com>
Copy link
Copy Markdown
Contributor

@constanca-m constanca-m left a comment

Choose a reason for hiding this comment

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

Thanks, change looks good

@constanca-m
Copy link
Copy Markdown
Contributor

/workflow-approve

Signed-off-by: Ali <alliasgher123@gmail.com>
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.

[extension/encoding/googlecloudlogentryencodingextension] Protocol validation does not allow h2

4 participants