fix(cluster-1): data corruption fixes (C4/C5/C8)

- synchandler: combine course date with clock time via time.Date instead
  of adding two absolute Unix epochs, which produced corrupt start times
- tracing: make DeploymentEnvironment configurable via config.Trace
  (defaults to development instead of hardcoded production)
- http: align course handler tracer name to 'kuriweb.http' to match the
  request middleware instrument so spans share the same tracer
This commit is contained in:
2026-06-27 23:54:07 +00:00
parent 84656c6c56
commit 23c29aba1d
4 changed files with 18 additions and 10 deletions

View File

@ -50,7 +50,7 @@ func setupOtelSDK(ctx context.Context, cfg config.Trace) (shutdown shutdownFunc,
return err
}
resource, err := makeServiceResource(ctx)
resource, err := makeServiceResource(ctx, cfg.Environment)
if err != nil {
return shutdown, fmt.Errorf("making service resource: %w", err)
}
@ -102,7 +102,10 @@ type TraceProviderParams struct {
Type config.TraceClientType
}
func makeServiceResource(ctx context.Context) (*resource.Resource, error) {
func makeServiceResource(ctx context.Context, environment string) (*resource.Resource, error) {
if environment == "" {
environment = "development"
}
r, err := resource.New(
ctx,
resource.WithDetectors(
@ -113,7 +116,7 @@ func makeServiceResource(ctx context.Context) (*resource.Resource, error) {
resource.WithHost(),
resource.WithAttributes(
semconv.ServiceName("bigstats:kuriweb"),
semconv.DeploymentEnvironment("production"),
semconv.DeploymentEnvironment(environment),
),
)
if err != nil {