Closed wagnerww closed 1 year ago
You should be able to follow the setup guide in https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/tree/main/exporters/auto#auto-configuration-for-opentelemetry-in-google-cloud to use auto-instrumentation with the GCP exporter. Let me know if you have further questions.
For a working example that uses opentelemetry-auto-instrumentation to instrument a sample app and publish traces to Google Cloud, you can take a look at our auto-intstrument example.
@wagnerww did the above comments answered your question ?
@psx95 The integration worked, locally. But, I wanted to put opentTelemetry together with Anthos Service Mesh. I couldn't find any documentation on how to do this. Do you have any examples or tips?
@wagnerww We currently do not have any example showcasing Anthos with OpenTelemetry, but the OTel auto-instrumentation should "just work" with Anthos Service Mesh - without any extra configuration.
If you set up context propagation in your apps, you will get end-to-end traces consisting of mesh spans. If you set up trace export in your apps in addition to propagation, you will get additional spans with details from your app.
@psx95 In this case, would I have to apply the agent and the exporter in the docker image?
Another question....for the exporter and the opentelemetry agent, what is the minimum java version?
I did some tests with the image "openjdk:17-alpine", without success. But with "openjdk:17" it worked.
@wagnerww Yes, I think you would add both JARs (auto-exporter and the agent) as JVM arguments to the docker container and it should start giving you telemetry data. You can refer to this configuration. This configuration contains jvmFlags that configure both the JARs.
All of our examples use java 11, but they should work with Java 17 too. I think it maybe because Alpine is a lightweight image so it may be missing a few libraries required to run our exporters.
We recently increased the gradle version in this PR for this repo to be compatible with Java 17. So we may upgrade the examples to use 17 in future.
@wagnerww if you have a scenario that fails reproducibly under openjdk:17-alpine
, please create a separate issue with details.
If I opt for auto-instrumentation, do I still need this google dependency in case I need to generate a span or metric?
I'm having trouble generating the trace, and I don't have an example that works: wARN io.opentelemetry.api.GlobalOpenTelemetry - You are currently using the OpenTelemetry Instrumentation Java Agent; all GlobalOpenTelemetry.set calls are ignored - the agent provides the global OpenTelemetry object used by your application. java.lang.Throwable at io.pentelemetry.api.GlobalOpenTelemetry.set(GlobalOpenTelemetry.java:97)