Skip to content

set service.version for deployment monitoring#191

Open
jay-418 wants to merge 1 commit intomainfrom
jay/service-version
Open

set service.version for deployment monitoring#191
jay-418 wants to merge 1 commit intomainfrom
jay/service-version

Conversation

@jay-418
Copy link
Contributor

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

lantern-box deployments cannot be monitored with others in the deployments dashboard because the service.version attribute is missing.

Copilot AI review requested due to automatic review settings March 21, 2026 01:55
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

Adds a service.version resource attribute to lantern-box OpenTelemetry telemetry so deployments can be grouped/filtered properly in the deployments dashboard.

Changes:

  • Set service.version on the OTEL Resource via semconv.ServiceVersionKey.
  • Derive the version value from Go build metadata (vcs.revision) using runtime/debug.ReadBuildInfo().

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

Comment on lines 98 to 100
semconv.ServiceNameKey.String("lantern-box"),
semconv.ServiceVersionKey.String(vcsRevision()),
}, extras...)
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

buildResource() now adds service.version but there’s no test asserting the attribute is present and that OTEL_RESOURCE_ATTRIBUTES can override it (similar to the existing service.name tests). Adding a unit test will prevent regressions and ensure the dashboard grouping works as expected.

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +116
func vcsRevision() string {
bi, ok := debug.ReadBuildInfo()
if !ok {
return "unknown"
}
for _, s := range bi.Settings {
if s.Key == "vcs.revision" {
return s.Value
}
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

vcsRevision() calls debug.ReadBuildInfo() and scans settings every time buildResource() is called (currently at least for metrics, traces, and crash reporting). Consider memoizing the result (e.g., package-level cached string with sync.Once) to avoid repeated build-info parsing during startup/reporting.

Copilot uses AI. Check for mistakes.
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