fix: critical bugs from code review (data corruption, error contract, HTTP hardening) (#5)

Co-authored-by: hermes <hermes@noreply.localhost>
Co-committed-by: hermes <hermes@noreply.localhost>
This commit is contained in:
2026-06-28 14:04:25 +00:00
committed by Aleksandr Trushkin
parent 84656c6c56
commit 5c529ef060
20 changed files with 138 additions and 86 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 {