Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stackdriver meter registry gax.grpc exception #307

Open
exmoria opened this issue Oct 26, 2021 · 0 comments
Open

Stackdriver meter registry gax.grpc exception #307

exmoria opened this issue Oct 26, 2021 · 0 comments

Comments

@exmoria
Copy link

exmoria commented Oct 26, 2021

Expected Behavior

The application should not throw an exception when using the micrometer stackdriver exporter alongside with the micronaut-gcp-tracing dependency.

<dependency>
    <groupId>io.micronaut.micrometer</groupId>
    <artifactId>micronaut-micrometer-registry-stackdriver</artifactId>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>io.micronaut.gcp</groupId>
    <artifactId>micronaut-gcp-tracing</artifactId>
     <scope>compile</scope>
</dependency>

Actual Behaviour

The application throws an exception on startup when both dependencies are included.

I have been able to sidestep this issue by including the latest version of the gax-grpc dependency in my pom.xml.

 <dependency>
    <groupId>com.google.api</groupId>
    <artifactId>gax-grpc</artifactId>
    <version>2.6.1</version>
 </dependency>

Steps To Reproduce

  1. Set-up a Google Cloud test project using cloud SDK.
export STACKDRIVER_PROJECT_ID=stackdriver-exporter-issue

# Obtain access credentials and create a new project.
gcloud auth login
gcloud projects create $STACKDRIVER_PROJECT_ID

# Acquire user credentials.
gcloud auth application-default login
  1. Generate a Java application via the micronaut CLI with the following arguments:
mn create-app stackdriver-exporter-issue \
    --lang=java \
    --jdk=17 \
    --build=maven \
    --features=gcp-cloud-trace,micrometer-stackdriver \
    && cd stackdriver-exporter-issue
  1. Start the application and observe the exception.
./mvnw mn:run

Stacktrace:

[ForkJoinPool.commonPool-worker-3] ERROR i.m.s.StackdriverMeterRegistry - unable to create stackdriver client
java.lang.IllegalStateException: getTransportChannel() called when needsExecutor() is true
        at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:186)
        at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:205)
        at com.google.cloud.monitoring.v3.stub.GrpcMetricServiceStub.create(GrpcMetricServiceStub.java:176)
        at com.google.cloud.monitoring.v3.stub.MetricServiceStubSettings.createStub(MetricServiceStubSettings.java:192)
        at com.google.cloud.monitoring.v3.MetricServiceClient.<init>(MetricServiceClient.java:157)
        at com.google.cloud.monitoring.v3.MetricServiceClient.create(MetricServiceClient.java:138)
        at io.micrometer.stackdriver.StackdriverMeterRegistry.start(StackdriverMeterRegistry.java:119)
        at io.micrometer.stackdriver.StackdriverMeterRegistry.<init>(StackdriverMeterRegistry.java:105)
        at io.micrometer.stackdriver.StackdriverMeterRegistry.<init>(StackdriverMeterRegistry.java:88)
        at io.micronaut.configuration.metrics.micrometer.stackdriver.StackdriverMeterRegistryFactory.stackdriverMeterRegistry(StackdriverMeterRegistryFactory.java:58)
        at io.micronaut.configuration.metrics.micrometer.stackdriver.$StackdriverMeterRegistryFactory$StackdriverMeterRegistry0$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2341)
        at io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:3700)
        at io.micronaut.context.DefaultBeanContext.getBeanRegistrations(DefaultBeanContext.java:3602)
        at io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:1381)
        at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBeansOfType(AbstractInitializableBeanDefinition.java:1663)
        at io.micronaut.context.AbstractInitializableBeanDefinition.getBeansOfTypeForConstructorArgument(AbstractInitializableBeanDefinition.java:1102)
        at io.micronaut.configuration.metrics.micrometer.$MeterRegistryFactory$CompositeMeterRegistry0$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2341)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3289)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3275)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2825)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2787)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1643)
        at io.micronaut.inject.provider.BeanProviderDefinition$1.get(BeanProviderDefinition.java:66)
        at io.micronaut.configuration.metrics.binder.executor.ExecutorServiceMetricsBinder.onCreated(ExecutorServiceMetricsBinder.java:77)
        at io.micronaut.configuration.metrics.binder.executor.ExecutorServiceMetricsBinder.onCreated(ExecutorServiceMetricsBinder.java:48)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2398)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3289)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3275)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2825)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2787)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1643)
        at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:1566)
        at io.micronaut.context.AbstractInitializableBeanDefinition.getBeanForConstructorArgument(AbstractInitializableBeanDefinition.java:1044)
        at io.micronaut.scheduling.$ScheduledExecutorTaskScheduler$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2341)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3289)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3275)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2825)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2787)
        at io.micronaut.context.DefaultBeanContext.findBean(DefaultBeanContext.java:1709)
        at io.micronaut.context.DefaultBeanContext.findBean(DefaultBeanContext.java:1683)
        at io.micronaut.context.DefaultBeanContext.findBean(DefaultBeanContext.java:910)
        at io.micronaut.scheduling.processor.ScheduledMethodProcessor.process(ScheduledMethodProcessor.java:104)
        at io.micronaut.context.DefaultBeanContext.lambda$null$28(DefaultBeanContext.java:2006)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Environment Information

  • Operating System: Arch Linux - 5.14.14-arch1-1
  • JDK Version: Zulu17.28.13-CA

Example Application

No response

Version

3.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant