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
12 changes: 5 additions & 7 deletions charts/lfx-v2-voting-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,12 @@ app:
ID_MAPPING_DISABLED:
value: false

# OpenTelemetry configuration
OTEL_SERVICE_NAME:
value: lfx-v2-voting-service
# yamllint disable rule:comments-indentation
# OpenTelemetry configuration (optional)
# OTEL_SERVICE_NAME:
# value: lfx-v2-voting-service
# OTEL_EXPORTER_OTLP_ENDPOINT:
# value: http://otel-collector.observability.svc.cluster.local:4317
# OTEL_EXPORTER_OTLP_PROTOCOL:
# value: grpc
# OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL, and sampler
# settings are set via ArgoCD production overrides.
# yamllint enable rule:comments-indentation

# Traefik Gateway API routing
Expand Down
22 changes: 22 additions & 0 deletions cmd/voting-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/linuxfoundation/lfx-v2-voting-service/internal/middleware"
"github.com/linuxfoundation/lfx-v2-voting-service/internal/service"
"github.com/linuxfoundation/lfx-v2-voting-service/pkg/constants"
"github.com/linuxfoundation/lfx-v2-voting-service/pkg/utils"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
goahttp "goa.design/goa/v3/http"
)
Expand All @@ -49,6 +50,27 @@ func run() int {
logging.InitStructureLogConfig()
logger := slog.Default()

// Set up OpenTelemetry SDK.
// Environment variable OTEL_SERVICE_VERSION takes precedence over
// the build-time Version variable.
otelConfig := utils.OTelConfigFromEnv()
if otelConfig.ServiceVersion == "" {
otelConfig.ServiceVersion = Version
}
Comment thread
bramwelt marked this conversation as resolved.
otelShutdown, err := utils.SetupOTelSDKWithConfig(context.Background(), otelConfig)
if err != nil {
logger.Error("error setting up OpenTelemetry SDK", "error", err)
return 1
}
// Handle shutdown properly so nothing leaks.
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Second)
defer cancel()
if shutdownErr := otelShutdown(ctx); shutdownErr != nil {
logger.Error("error shutting down OpenTelemetry SDK", "error", shutdownErr)
}
}()

logger.Info("Starting voting service",
"version", Version,
"build_time", BuildTime,
Expand Down
44 changes: 40 additions & 4 deletions go.mod

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This license expression (BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang) is the standard Go patent grant that accompanies all Google-contributed Go dependencies. It is not a code issue — it requires the license policy allowlist to be updated to permit the LicenseRef-scancode-google-patent-license-golang identifier. Leaving this thread open for the policy team to action.

Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,23 @@ require (
github.com/remychantenay/slog-otel v1.3.4
github.com/stretchr/testify v1.11.1
github.com/vmihailenco/msgpack/v5 v5.4.1
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0
go.opentelemetry.io/contrib/exporters/autoexport v0.68.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0
go.opentelemetry.io/contrib/propagators/autoprop v0.68.0
go.opentelemetry.io/otel v1.43.0
go.opentelemetry.io/otel/log v0.19.0
go.opentelemetry.io/otel/sdk v1.43.0
go.opentelemetry.io/otel/sdk/log v0.19.0
go.opentelemetry.io/otel/sdk/metric v1.43.0
goa.design/goa/v3 v3.24.1
golang.org/x/oauth2 v0.35.0
)

require (
github.com/PuerkitoBio/rehttp v1.4.0 // indirect
github.com/antithesishq/antithesis-sdk-go v0.6.0-default-no-op // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
Expand All @@ -36,6 +45,7 @@ require (
github.com/gohugoio/hashstructure v0.6.0 // indirect
github.com/google/go-tpm v0.9.8 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/klauspost/compress v1.18.4 // indirect
github.com/lestrrat-go/blackmagic v1.0.3 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
Expand All @@ -45,19 +55,41 @@ require (
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect
github.com/minio/highwayhash v1.0.4-0.20251030100505-070ab1a87a76 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nats-io/jwt/v2 v2.8.1 // indirect
github.com/nats-io/nkeys v0.4.15 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/otlptranslator v1.0.0 // indirect
github.com/prometheus/procfs v0.20.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.devnw.com/structs v1.0.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel v1.43.0 // indirect
go.opentelemetry.io/contrib/bridges/prometheus v0.68.0 // indirect
go.opentelemetry.io/contrib/propagators/aws v1.43.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.43.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.43.0 // indirect
go.opentelemetry.io/contrib/propagators/ot v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.65.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.19.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.43.0 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
go.opentelemetry.io/otel/trace v1.43.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/mod v0.33.0 // indirect
golang.org/x/net v0.52.0 // indirect
Expand All @@ -66,6 +98,10 @@ require (
golang.org/x/text v0.35.0 // indirect
golang.org/x/time v0.15.0 // indirect
golang.org/x/tools v0.42.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260406210006-6f92a3bedf2d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260406210006-6f92a3bedf2d // indirect
google.golang.org/grpc v1.80.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading