Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Telemetry attributes: follow rules in https://github.com/getlantern/semconv/blob/main/AGENTS.md
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ require (
github.com/getlantern/kindling v0.0.0-20260319225424-4736208dd171
github.com/getlantern/lantern-box v0.0.52
github.com/getlantern/pluriconfig v0.0.0-20251126214241-8cc8bc561535
github.com/getlantern/semconv v0.0.0-20260327040646-21845dda05cb
github.com/getlantern/timezone v0.0.0-20210901200113-3f9de9d360c9
github.com/go-resty/resty/v2 v2.16.5
github.com/goccy/go-yaml v1.19.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ github.com/getlantern/pluriconfig v0.0.0-20251126214241-8cc8bc561535 h1:rtDmW8YL
github.com/getlantern/pluriconfig v0.0.0-20251126214241-8cc8bc561535/go.mod h1:WKJEdjMOD4IuTRYwjQHjT4bmqDl5J82RShMLxPAvi0Q=
github.com/getlantern/samizdat v0.0.3-0.20260310125445-325cf1bd1b60 h1:m9eXjDK9vllbVH467+QXbrxUFFM9Yp7YJ90wZLw4dwU=
github.com/getlantern/samizdat v0.0.3-0.20260310125445-325cf1bd1b60/go.mod h1:uEeykQSW2/6rTjfPlj3MTTo59poSHXfAHTGgzYDkbr0=
github.com/getlantern/semconv v0.0.0-20260327040646-21845dda05cb h1:c5YM7b3a4r2J8Eh89KkI6M/iTFe6Bi+b8AJlfkKdFq4=
github.com/getlantern/semconv v0.0.0-20260327040646-21845dda05cb/go.mod h1:GkPT5P9JoOTIRXRmFWxYgu1hhXgTFFTNc2hoG7WQc3g=
github.com/getlantern/sing v0.7.18-lantern h1:QKGgIUA3LwmKYP/7JlQTRkxj9jnP4cX2Q/B+nd8XEjo=
github.com/getlantern/sing v0.7.18-lantern/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
github.com/getlantern/sing-box-minimal v1.12.19-lantern h1:Tntq+Udsvyv6A/mjxfSoZ8NhvhXRSX6i/CICKGPFhAY=
Expand Down
23 changes: 15 additions & 8 deletions telemetry/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ import (
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
"google.golang.org/grpc/credentials"

semconv "github.com/getlantern/semconv"

rcommon "github.com/getlantern/radiance/common"
"github.com/getlantern/radiance/common/env"
"github.com/getlantern/radiance/common/settings"
"github.com/getlantern/radiance/config"
)
Expand Down Expand Up @@ -137,21 +139,26 @@ func Close(ctx context.Context) error {
}

func buildResources(serviceName string, a Attributes) []attribute.KeyValue {
e := "prod"
if v, ok := env.Get[string](env.ENV); ok {
e = v
}
return []attribute.KeyValue{
semconv.ServiceNameKey.String(serviceName),
semconv.ServiceVersionKey.String(a.AppVersion),
attribute.String("device.id", a.DeviceID),
attribute.String("geo.country", a.GeoCountry),
semconv.DeploymentEnvironmentNameKey.String(e),
semconv.OSNameKey.String(a.OSName),
Comment on lines 141 to +150
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.

buildResources derives deployment.environment.name by reading RADIANCE_ENV directly and defaulting to "prod" without normalizing case or aligning with the canonical environment logic in common.Env()/common.Prod() (which treat unset as production). This can lead to inconsistent environment values across the app/telemetry (e.g., "production" vs "prod" vs ""). Consider reusing the common environment helpers and normalizing to a single canonical value before setting the resource attribute.

Copilot uses AI. Check for mistakes.
semconv.OSVersionKey.String(a.OSVersion),
semconv.HostArchKey.String(a.OSArch),
semconv.GeoCountryISOCodeKey.String(a.GeoCountry),
semconv.ClientDeviceIDKey.String(a.DeviceID),
semconv.ClientPlatformKey.String(a.Platform),
semconv.ClientIsProKey.Bool(a.Pro),
attribute.String("library.language", "go"),
attribute.String("library.language.version", a.GoVersion),
attribute.String("locale.language", a.LocaleLanguage),
attribute.String("locale.country", a.LocaleCountry),
attribute.String("platform", a.Platform),
attribute.String("os.name", a.OSName),
attribute.String("os.arch", a.OSArch),
attribute.String("os.version", a.OSVersion),
attribute.String("timezone", a.Timezone),
attribute.Bool("is_pro", a.Pro),
}
}

Expand Down
2 changes: 1 addition & 1 deletion vpn/ipc/middlewares.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/go-chi/chi/v5/middleware"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/propagation"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
semconv "github.com/getlantern/semconv"
"go.opentelemetry.io/otel/trace"

"github.com/getlantern/radiance/internal"
Expand Down
Loading