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:
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user