opencensus-java
opencensus-java copied to clipboard
StackdriverStatsExporter.createAndRegister takes 10 seconds
Please answer these questions before submitting a bug report.
What version of OpenCensus are you using?
0.28.3
What JVM are you using (java -version)?
11.0.13
What did you do?
If possible, provide a recipe for reproducing the error.
The following line of code is taking 10 seconds to execute, and the document suggests running this on the main thread at startup. This delay is causing K8S to kill the pods before they startup.
StackdriverStatsExporter.createAndRegister(
StackdriverStatsConfiguration.builder()
.setMetricNamePrefix("custom.googleapis.com/<redacted>/")
.build()
)
Additional context
Add any other context about the problem here.
We're running on GKE using distroless-java docker images
In my case, sometimes it took 5 minutes.
@EventListener(ApplicationPreparedEvent.class)
private void initializeOpenCensusCore() {
StackdriverStatsExporter.createAndRegister(StackdriverStatsConfiguration.builder()
.setExportInterval(Duration.fromMillis(EXPORT_INTERVAL))
.build());
...
build.gradle
compile 'io.opencensus:opencensus-api:0.30.0'
compile 'io.opencensus:opencensus-exporter-stats-stackdriver:0.30.0'
runtime 'io.opencensus:opencensus-impl:0.30.0'
java -version
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Homebrew (build 11.0.12+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.12+0, mixed mode)