Skip to content

Commit

Permalink
feat: add a low default sample ratio (#28)
Browse files Browse the repository at this point in the history
* feat: add a low default sample ratio

* refactor: diff sample rate per env
  • Loading branch information
DimosPagakis authored Dec 5, 2024
1 parent 8da12e5 commit abac513
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/kotlin/com/monta/otel/extension/Customizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.opentelemetry.semconv.ServiceAttributes;
import io.opentelemetry.semconv.UrlAttributes;

import java.util.Objects;
import java.util.UUID;

/**
Expand Down Expand Up @@ -60,7 +61,8 @@ private static Sampler getSampler() {
return Sampler.alwaysOff();
}
} else {
return Sampler.alwaysOn();
double rate = Objects.equals(System.getenv("STAGE"), "production") ? 0.1 : 1.0;
return Sampler.traceIdRatioBased(rate);
}
}
}

0 comments on commit abac513

Please sign in to comment.