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

Exporters example does not compile: SERVICE_NAME and SERVICE_VERSION are not defined. #4328

Open
garydgregory opened this issue Apr 20, 2024 · 9 comments · May be fixed by #4330
Open

Exporters example does not compile: SERVICE_NAME and SERVICE_VERSION are not defined. #4328

garydgregory opened this issue Apr 20, 2024 · 9 comments · May be fixed by #4330
Labels
bug Something isn't working sig:java

Comments

@garydgregory
Copy link

This line does not compile:

Resource resource = Resource.getDefault().toBuilder().put(SERVICE_NAME, "dice-server").put(SERVICE_VERSION, "0.1.0").build();

from https://opentelemetry.io/docs/languages/java/exporters/

cartermp added a commit that referenced this issue Apr 20, 2024
@cartermp cartermp linked a pull request Apr 20, 2024 that will close this issue
@cartermp cartermp added bug Something isn't working sig:java labels Apr 20, 2024
@theletterf
Copy link
Member

@garydgregory What's your runtime and OS?

+CC @open-telemetry/java-instrumentation-maintainers

@laurit
Copy link

laurit commented Apr 22, 2024

https://github.com/open-telemetry/opentelemetry.io/blob/807fd51093c8ee6b156010ae0c9a70d06cf4d150/content/en/docs/languages/java/instrumentation.md seems to have a similar sample. That sample uses ResourceAttributes.SERVICE_NAME instead of SERVICE_NAME also the import for ResourceAttributes is different.

@garydgregory
Copy link
Author

garydgregory commented Apr 22, 2024

I am using Java 17 on Windows 10 with Maven:

ver && java -version && mvn -version

Microsoft Windows [Version 10.0.19045.4170]
openjdk version "17.0.8" 2023-07-18
OpenJDK Runtime Environment Temurin-17.0.8+7 (build 17.0.8+7)
OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (build 17.0.8+7, mixed mode, sharing)
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: C:\java\apache-maven-3.9.6
Java version: 17.0.8, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-17.0.8.7-hotspot
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

My IDE is Eclipse:

Version: 2024-03 (4.31.0)

This includes Buildship (the Gradle thing that does not really work, see eclipse/buildship#1303)

@garydgregory
Copy link
Author

Both ResourceAttributes.SERVICE_NAME and ResourceAttributes.SERVICE_VERSION are deprecated, so what's supposed to go in these put calls?

@laurit
Copy link

laurit commented Apr 22, 2024

@garydgregory with the latest semconv artifact it is io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME

@garydgregory
Copy link
Author

Hello @laurit
My dependency management section uses:

      <dependency>
        <groupId>io.opentelemetry</groupId>
        <artifactId>opentelemetry-bom</artifactId>
        <version>1.37.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>      

Version "1.37.0" looks like the latest: https://search.maven.org/artifact/io.opentelemetry/opentelemetry-bom

My dependency section uses:

    <dependency>
      <groupId>io.opentelemetry.instrumentation</groupId>
      <artifactId>opentelemetry-log4j-appender-2.17</artifactId>
      <version>2.3.0-alpha</version>
    </dependency>
    <dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-exporter-otlp</artifactId>
    </dependency>

mvn dependency:tree says:

[INFO] +- io.opentelemetry.instrumentation:opentelemetry-log4j-appender-2.17:jar:2.3.0-alpha:compile
[INFO] |  +- io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:jar:2.3.0:compile
[INFO] |  |  +- io.opentelemetry:opentelemetry-api-incubator:jar:1.37.0-alpha:runtime
[INFO] |  |  +- io.opentelemetry.semconv:opentelemetry-semconv:jar:1.25.0-alpha:compile
[INFO] |  |  \- io.opentelemetry.semconv:opentelemetry-semconv-incubating:jar:1.25.0-alpha:compile
[INFO] |  +- io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-incubator:jar:2.3.0-alpha:compile
[INFO] |  \- io.opentelemetry:opentelemetry-api:jar:1.37.0:compile
[INFO] |     \- io.opentelemetry:opentelemetry-context:jar:1.37.0:compile
[INFO] \- io.opentelemetry:opentelemetry-exporter-otlp:jar:1.37.0:compile
[INFO]    +- io.opentelemetry:opentelemetry-sdk-trace:jar:1.37.0:compile
[INFO]    |  \- io.opentelemetry:opentelemetry-sdk-common:jar:1.37.0:compile
[INFO]    +- io.opentelemetry:opentelemetry-sdk-metrics:jar:1.37.0:compile
[INFO]    +- io.opentelemetry:opentelemetry-sdk-logs:jar:1.37.0:compile
[INFO]    +- io.opentelemetry:opentelemetry-exporter-otlp-common:jar:1.37.0:runtime
[INFO]    |  \- io.opentelemetry:opentelemetry-exporter-common:jar:1.37.0:runtime
[INFO]    +- io.opentelemetry:opentelemetry-exporter-sender-okhttp:jar:1.37.0:runtime
[INFO]    |  \- com.squareup.okhttp3:okhttp:jar:4.12.0:runtime
[INFO]    |     +- com.squareup.okio:okio:jar:3.6.0:runtime
[INFO]    |     |  \- com.squareup.okio:okio-jvm:jar:3.6.0:runtime
[INFO]    |     |     \- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.9.10:runtime
[INFO]    |     \- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.8.21:runtime
[INFO]    |        +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.8.21:runtime
[INFO]    |        \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.8.21:runtime
[INFO]    \- io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:jar:1.37.0:runtime
[INFO]       \- io.opentelemetry:opentelemetry-sdk:jar:1.37.0:runtime

The class is in opentelemetry-semconv-1.25.0-alpha.jar which is the latest according to https://search.maven.org/artifact/io.opentelemetry.semconv/opentelemetry-semconv

What am I missing?

TY.

@laurit
Copy link

laurit commented Apr 22, 2024

@garydgregory what is the issue that you have?

@garydgregory
Copy link
Author

garydgregory commented Apr 22, 2024

Hello @laurit

  1. Like the title of the ticket says "Exporters example does not compile", so that needs fixing.
  2. The offered solution uses deprecate code, so what's the supported code supposed to look like?

@svrnm
Copy link
Member

svrnm commented May 2, 2024

@open-telemetry/java-approvers PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sig:java
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants