Skip to content

examples, agent instructions, and additional keys#8

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

examples, agent instructions, and additional keys#8
jay-418 merged 4 commits intomainfrom
jay/semconv

Conversation

@jay-418
Copy link
Contributor

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

Has matching changes in lantern-box and http-proxy

@jay-418 jay-418 marked this pull request as ready for review March 27, 2026 00:59
Copilot AI review requested due to automatic review settings March 27, 2026 00:59
@jay-418 jay-418 self-assigned this Mar 27, 2026
Copy link
Contributor

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

Updates the semconv module to support broader cross-service telemetry comparisons by adding additional client attribute keys and improving documentation around how the package should be used.

Changes:

  • Add new client attribute keys for ISP and app.
  • Expand README.md with usage examples and reference links.
  • Add AGENTS.md describing repository rules/structure and expected resource attributes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
semconv.go Adds client.isp and client.app attribute keys under Client Info.
README.md Rewrites README to position the module as a standard+custom key source and adds usage examples.
AGENTS.md Introduces contributor/agent guidance and documents expected resource attributes.

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

ClientVersionKey attribute.Key = "client.version"
ClientPreferredRegionKey attribute.Key = "client.preferred_region"
ClientIsProKey attribute.Key = "client.is_pro"
ClientISPKey attribute.Key = "client.isp"
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.

ClientISPKey introduces a new exported identifier with an initialism style that differs from nearby client keys (e.g., ClientAsnKey). Since these constants are part of the public API, pick one consistent initialism convention for client attributes (e.g., use ClientIspKey to match ClientAsnKey, or rename the existing client initialisms to match Go initialism casing) before this gets depended on across services.

Suggested change
ClientISPKey attribute.Key = "client.isp"
ClientIspKey attribute.Key = "client.isp"

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +27
Standard OTel keys may have convenience functions, but custom keys do not.

```go
attrs := map[attribute.Key]attribute.Value{
semconv.GeoCountryISOCodeKey: attribute.StringValue("US"), // standard
semconv.HostNameKey: attribute.StringValue("phost-abcd"), // standard
semconv.TrackNameKey: attribute.StringValue("nidoran"), // custom
semconv.ProxyProtocolKey: attribute.StringValue("HTTPS"), // custom
}
```

```go
attrs := []attribute.KeyValue{
semconv.GeoCountryISOCode("US"),
semconv.HostName("phost-abcd"),
attribute.KeyValue{
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.

The README examples/reference imply that standard OTel semconv keys/functions are available as semconv.GeoCountryISOCodeKey, semconv.HostNameKey, and semconv.GeoCountryISOCode(...). With the current implementation, the dot-import of go.opentelemetry.io/otel/semconv/... does not re-export those identifiers from this module, so these examples won't compile for consumers. Either update the README to instruct importing upstream OTel semconv for standard keys, or add explicit re-export/forwarding declarations in this package.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +31
This package defines the canonical attribute keys for all telemetry (metrics,
traces, logs) across Lantern services. It re-exports standard OTel semconv and
adds custom keys for Lantern-specific concepts.

## Rules

1. **Never hardcode attribute key strings.** Always use `semconv.*` constants.
2. **Prefer standard OTel keys** when one exists for the concept. Only use
custom keys for Lantern-specific domains (proxies, routes, tracks, bandit,
clients, EIPs).
3. **Align with existing usage.** Before adding a new key, check `semconv.go`
and grep across services for how similar resources are already described.
4. **Naming matters for incident response.** These keys power dashboards and
alerts. Consistent naming lets on-call engineers query across services.

## Structure

- `semconv.go` — all key definitions, grouped by domain
- Standard OTel keys are available via dot-import of
`go.opentelemetry.io/otel/semconv/v1.37.0`

## Expected Resources

Every service must set these on its telemetry resource. Dashboards and alerts
depend on them for filtering and grouping during incident response.

- `semconv.ServiceNameKey` — identifies the service
- `semconv.ServiceVersionKey` — deployment error rate monitoring
- `semconv.DeploymentEnvironmentNameKey` — environment (prod/staging/dev)
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.

This file states that the package "re-exports standard OTel semconv" and that services should set resources like semconv.ServiceNameKey / semconv.ServiceVersionKey. With the current Go implementation (dot-import in semconv.go), upstream semconv identifiers are not actually exported from this module, so references like semconv.ServiceNameKey won't be available to consumers. Either adjust this guidance to use go.opentelemetry.io/otel/semconv/... for standard keys, or implement explicit re-exports in this package to match the documented contract.

Copilot uses AI. Check for mistakes.
@jay-418 jay-418 changed the title more keys for cross comparison examples, agent instructions, and additional keys Mar 27, 2026
@jay-418 jay-418 merged commit c560ef3 into main Mar 27, 2026
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