Skip to content

Conversation

@MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Sep 26, 2025

In order to add gRPC server attributes for exporter observability, this information needs to be parsed into a host and port. The added generated files provides ParseCanonicalTarget for this functionality.

This is added as a generated template as it is expected to be needed for all OTLP exporters (e.g. #7404, #7353).

Split from work added to #7404

cc @yumosx

Benchamarks

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
                                 │ otlptracegrpc-observ-target.bmark.result │
                                 │                  sec/op                  │
ParseTarget/HostName-8                                         80.90n ±  1%
ParseTarget/HostPort-8                                         123.2n ±  4%
ParseTarget/IPv4WithoutPort-8                                  94.25n ±  2%
ParseTarget/IPv4WithPort-8                                     136.2n ±  1%
ParseTarget/IPv6Bare-8                                         195.5n ±  2%
ParseTarget/IPv6Bracket-8                                      191.2n ±  3%
ParseTarget/IPv6WithPort-8                                     128.6n ±  4%
ParseTarget/UnixSocket-8                                       15.73n ±  4%
ParseTarget/UnixAbstractSocket-8                               15.71n ±  6%
ParseTarget/Passthrough-8                                      129.3n ± 18%
geomean                                                        84.98n

                                 │ otlptracegrpc-observ-target.bmark.result │
                                 │                   B/op                   │
ParseTarget/HostName-8                                         48.00 ± 0%
ParseTarget/HostPort-8                                         48.00 ± 0%
ParseTarget/IPv4WithoutPort-8                                  16.00 ± 0%
ParseTarget/IPv4WithPort-8                                     48.00 ± 0%
ParseTarget/IPv6Bare-8                                         16.00 ± 0%
ParseTarget/IPv6Bracket-8                                      16.00 ± 0%
ParseTarget/IPv6WithPort-8                                     48.00 ± 0%
ParseTarget/UnixSocket-8                                       0.000 ± 0%
ParseTarget/UnixAbstractSocket-8                               0.000 ± 0%
ParseTarget/Passthrough-8                                      48.00 ± 0%
geomean                                                                   ¹
¹ summaries must be >0 to compute geomean

                                 │ otlptracegrpc-observ-target.bmark.result │
                                 │                allocs/op                 │
ParseTarget/HostName-8                                         1.000 ± 0%
ParseTarget/HostPort-8                                         1.000 ± 0%
ParseTarget/IPv4WithoutPort-8                                  1.000 ± 0%
ParseTarget/IPv4WithPort-8                                     1.000 ± 0%
ParseTarget/IPv6Bare-8                                         1.000 ± 0%
ParseTarget/IPv6Bracket-8                                      1.000 ± 0%
ParseTarget/IPv6WithPort-8                                     1.000 ± 0%
ParseTarget/UnixSocket-8                                       0.000 ± 0%
ParseTarget/UnixAbstractSocket-8                               0.000 ± 0%
ParseTarget/Passthrough-8                                      1.000 ± 0%
geomean                                                                   ¹
¹ summaries must be >0 to compute geomean

In order to add gRPC server attributes for exporter observability, this
information needs to be parsed into a host and port. The added generated
files provides ParseCanonicalTarget for this functionality.

This is added as a generated template as it is expected to be needed for
all OTLP exporters (e.g. open-telemetry#7404, open-telemetry#7353).
@MrAlias MrAlias added this to the v1.39.0 milestone Sep 26, 2025
@MrAlias MrAlias added Skip Changelog PRs that do not require a CHANGELOG.md entry pkg:exporter:otlp Related to the OTLP exporter package labels Sep 26, 2025
@codecov
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.5%. Comparing base (81aeace) to head (fb9cbbb).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #7424   +/-   ##
=====================================
  Coverage   85.5%   85.5%           
=====================================
  Files        278     279    +1     
  Lines      24654   24714   +60     
=====================================
+ Hits       21089   21146   +57     
- Misses      3186    3189    +3     
  Partials     379     379           
Files with missing lines Coverage Δ
.../otlptrace/otlptracegrpc/internal/observ/target.go 100.0% <100.0%> (ø)

... and 2 files with indirect coverage changes

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

@MrAlias MrAlias marked this pull request as ready for review September 26, 2025 20:47
@yumosx
Copy link
Member

yumosx commented Sep 27, 2025

LGTM

@MrAlias MrAlias merged commit 6cb0e90 into open-telemetry:main Sep 29, 2025
31 checks passed
@MrAlias MrAlias deleted the otlptracegrpc-observ-target branch September 29, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:exporter:otlp Related to the OTLP exporter package Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants