Skip to content

align attribute names#665

Merged
jay-418 merged 9 commits intomainfrom
jay/semconv
Mar 27, 2026
Merged

align attribute names#665
jay-418 merged 9 commits intomainfrom
jay/semconv

Conversation

@jay-418
Copy link
Copy Markdown
Contributor

@jay-418 jay-418 commented Mar 21, 2026

jay-418 and others added 2 commits March 26, 2026 19:46
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jay-418
Copy link
Copy Markdown
Contributor Author

jay-418 commented Mar 27, 2026

Possible new keys for semconv/jay-otel-std

These raw strings in http-proxy don't have semconv constants yet:

Needed key Current raw string Used in
NetworkIODirectionKey (re-export from otel) instrument.go — still using otelsc.NetworkIODirectionKey
ClientPlatformVersionKey "client.platform_version" ProxiedBytes metric
ClientKernelArchKey "client.kernel_arch" ProxiedBytes metric
ClientLibraryVersionKey "client.library_version" ReportProxiedBytes, ReportOriginBytes spans
ClientLocaleKey "client.locale" ReportProxiedBytes span
ProxyLegacyKey "legacy" otel.go resource
ProxyDCKey "dc" otel.go resource
ProxyFrontendDCKey "frontend.dc" otel.go resource
DatacapCohortKey "datacap_cohort" ProxiedBytes metric
ProbingErrorKey "probing.error" ReportProxiedBytes span

@jay-418 jay-418 marked this pull request as ready for review March 27, 2026 04:16
@jay-418 jay-418 self-assigned this Mar 27, 2026
@jay-418 jay-418 requested a review from Copilot March 27, 2026 04:36
@jay-418 jay-418 requested a review from garmr-ulfr March 27, 2026 04:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes OpenTelemetry resource/metric/span attribute keys by switching to the shared github.com/getlantern/semconv definitions (per engineering issue #3035), reducing ad-hoc attribute naming across the proxy.

Changes:

  • Replace locally-defined/string OTEL attribute keys with github.com/getlantern/semconv keys in OTEL resource construction and instrumentation.
  • Update dependency set to include github.com/getlantern/semconv and bump several Go module versions.
  • Add an AGENTS.md convention pointer for telemetry attribute rules.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
otel/otel.go Uses getlantern/semconv keys for resource attributes and adjusts resource attribute assembly/logging.
instrument/instrument.go Aligns metric/span attributes to semconv keys and simplifies attribute construction.
go.mod Adds github.com/getlantern/semconv and bumps several module versions (including OTEL API modules).
go.sum Adds checksums for the new/updated modules.
AGENTS.md Documents the convention to follow semconv rules for telemetry attributes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +74 to +75
log.Debugf("Resource attributes: %v", attrs)
return resource.NewWithAttributes(semconv.SchemaURL, attrs...)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

buildResource() now logs the full resource attributes slice, but this function is invoked for both the tracer provider and the meter provider, so it will emit the same log line multiple times and rebuild the resource twice. Consider caching the built *resource.Resource (or logging only once) to avoid duplicated work/log noise at startup.

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +68
go.opentelemetry.io/otel v1.38.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0
go.opentelemetry.io/otel/metric v1.36.0
go.opentelemetry.io/otel/metric v1.38.0
go.opentelemetry.io/otel/sdk v1.35.0
go.opentelemetry.io/otel/sdk/metric v1.35.0
go.opentelemetry.io/otel/trace v1.36.0
go.opentelemetry.io/otel/trace v1.38.0
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

OpenTelemetry module versions are now skewed (go.opentelemetry.io/otel, /metric, /trace at v1.38.0 while /sdk and OTLP exporters remain v1.35.0). Keeping these modules aligned to the same release line reduces upgrade risk and avoids potential cross-module API/type drift; consider bumping the remaining OTEL modules to v1.38.0 (or documenting why the split is required).

Copilot uses AI. Check for mistakes.
@jay-418 jay-418 merged commit 4d6241c into main Mar 27, 2026
5 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.

3 participants