Skip to content

Commit

Permalink
Move to io.opentelemetry.semconv package (#13)
Browse files Browse the repository at this point in the history
* Move to io.opentelemetry.semconv.v1 package

* Remove v1 from package
  • Loading branch information
jack-berg authored Aug 31, 2023
1 parent 1fe2538 commit d76b068
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ val generateSemanticAttributes by tasks.registering(Exec::class) {
"--rm",
"-v", "$buildDir/semantic-conventions/model:/source",
"-v", "$projectDir/buildscripts/templates:/templates",
"-v", "$projectDir/src/main/java/io/opentelemetry/semconv/trace/attributes/:/output",
"-v", "$projectDir/src/main/java/io/opentelemetry/semconv/:/output",
"otel/semconvgen:$generatorVersion",
"--only", "span,event,attribute_group,scope",
"-f", "/source", "code",
Expand All @@ -102,7 +102,7 @@ val generateSemanticAttributes by tasks.registering(Exec::class) {
"-Dsemconv=trace",
"-Dclass=SemanticAttributes",
"-DschemaUrl=$schemaUrl",
"-Dpkg=io.opentelemetry.semconv.trace.attributes"))
"-Dpkg=io.opentelemetry.semconv"))
}

val generateResourceAttributes by tasks.registering(Exec::class) {
Expand All @@ -115,15 +115,15 @@ val generateResourceAttributes by tasks.registering(Exec::class) {
"--rm",
"-v", "$buildDir/semantic-conventions/model:/source",
"-v", "$projectDir/buildscripts/templates:/templates",
"-v", "$projectDir/src/main/java/io/opentelemetry/semconv/resource/attributes/:/output",
"-v", "$projectDir/src/main/java/io/opentelemetry/semconv/:/output",
"otel/semconvgen:$generatorVersion",
"--only", "resource",
"-f", "/source", "code",
"--template", "/templates/SemanticAttributes.java.j2",
"--output", "/output/ResourceAttributes.java",
"-Dclass=ResourceAttributes",
"-DschemaUrl=$schemaUrl",
"-Dpkg=io.opentelemetry.semconv.resource.attributes"))
"-Dpkg=io.opentelemetry.semconv"))
}

val generateSemanticConventions by tasks.registering {
Expand Down
12 changes: 6 additions & 6 deletions buildscripts/templates/SemanticAttributes.java.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringArrayKey;
import io.opentelemetry.api.common.AttributeKey;
import java.util.List;

// DO NOT EDIT, this is an Auto-generated file from buildscripts/semantic-convention{{template}}
// DO NOT EDIT, this is an Auto-generated file from buildscripts{{template}}
@SuppressWarnings("unused")
public final class {{class}} {
/**
Expand Down Expand Up @@ -271,14 +271,14 @@ public final class {{class}} {

/**
* The name of the instrumentation scope - ({@code InstrumentationScope.Name} in OTLP).
* @deprecated This item has been moved, use {@link io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_NAME} instead.
* @deprecated This item has been moved, use {@link io.opentelemetry.semconv.ResourceAttributes#OTEL_SCOPE_NAME} instead.
*/
@Deprecated
public static final AttributeKey<String> OTEL_SCOPE_NAME = stringKey("otel.scope.name");

/**
* The version of the instrumentation scope - ({@code InstrumentationScope.Version} in OTLP).
* @deprecated This item has been moved, use {@link io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_VERSION} instead.
* @deprecated This item has been moved, use {@link io.opentelemetry.semconv.ResourceAttributes#OTEL_SCOPE_VERSION} instead.
*/
@Deprecated
public static final AttributeKey<String> OTEL_SCOPE_VERSION = stringKey("otel.scope.version");
Expand All @@ -303,15 +303,15 @@ public final class {{class}} {
/**
* Deprecated.
*
* @deprecated Deprecated, use the {@link io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_NAME} attribute.
* @deprecated Deprecated, use the {@link io.opentelemetry.semconv.ResourceAttributes#OTEL_SCOPE_NAME} attribute.
*/
@Deprecated
public static final AttributeKey<String> OTEL_LIBRARY_NAME = stringKey("otel.library.name");

/**
* Deprecated.
*
* @deprecated Deprecated, use the {@link io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_VERSION} attribute.
* @deprecated Deprecated, use the {@link io.opentelemetry.semconv.ResourceAttributes#OTEL_SCOPE_VERSION} attribute.
*/
@Deprecated
public static final AttributeKey<String> OTEL_LIBRARY_VERSION = stringKey("otel.library.version");
Expand Down Expand Up @@ -688,7 +688,7 @@ public final class {{class}} {
* to retrieve brands and platform individually from the User-Agent Client Hints API. To
* retrieve the value, the legacy {@code navigator.userAgent} API can be used.
* </ul>
* @deprecated This item has been renamed in 1.19.0 version of the semantic conventions. Use {@link io.opentelemetry.semconv.trace.attributes.SemanticAttributes#USER_AGENT_ORIGINAL} instead.
* @deprecated This item has been renamed in 1.19.0 version of the semantic conventions. Use {@link io.opentelemetry.semconv.SemanticAttributes#USER_AGENT_ORIGINAL} instead.
*/
@Deprecated
public static final AttributeKey<String> BROWSER_USER_AGENT = stringKey("browser.user_agent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.semconv.resource.attributes;
package io.opentelemetry.semconv;

import static io.opentelemetry.api.common.AttributeKey.booleanKey;
import static io.opentelemetry.api.common.AttributeKey.longKey;
Expand All @@ -14,7 +14,7 @@
import java.util.List;

// DO NOT EDIT, this is an Auto-generated file from
// buildscripts/semantic-convention/templates/SemanticAttributes.java.j2
// buildscripts/templates/SemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class ResourceAttributes {
/** The URL of the OpenTelemetry schema for these keys and values. */
Expand Down Expand Up @@ -1055,8 +1055,7 @@ private TelemetrySdkLanguageValues() {}
* </ul>
*
* @deprecated This item has been renamed in 1.19.0 version of the semantic conventions. Use
* {@link io.opentelemetry.semconv.trace.attributes.SemanticAttributes#USER_AGENT_ORIGINAL}
* instead.
* {@link io.opentelemetry.semconv.SemanticAttributes#USER_AGENT_ORIGINAL} instead.
*/
@Deprecated
public static final AttributeKey<String> BROWSER_USER_AGENT = stringKey("browser.user_agent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.semconv.trace.attributes;
package io.opentelemetry.semconv;

import static io.opentelemetry.api.common.AttributeKey.booleanKey;
import static io.opentelemetry.api.common.AttributeKey.doubleKey;
Expand All @@ -15,7 +15,7 @@
import java.util.List;

// DO NOT EDIT, this is an Auto-generated file from
// buildscripts/semantic-convention/templates/SemanticAttributes.java.j2
// buildscripts/templates/SemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class SemanticAttributes {
/** The URL of the OpenTelemetry schema for these keys and values. */
Expand Down Expand Up @@ -2454,7 +2454,7 @@ private RpcConnectRpcErrorCodeValues() {}
* The name of the instrumentation scope - ({@code InstrumentationScope.Name} in OTLP).
*
* @deprecated This item has been moved, use {@link
* io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_NAME} instead.
* io.opentelemetry.semconv.ResourceAttributes#OTEL_SCOPE_NAME} instead.
*/
@Deprecated
public static final AttributeKey<String> OTEL_SCOPE_NAME = stringKey("otel.scope.name");
Expand All @@ -2463,8 +2463,7 @@ private RpcConnectRpcErrorCodeValues() {}
* The version of the instrumentation scope - ({@code InstrumentationScope.Version} in OTLP).
*
* @deprecated This item has been moved, use {@link
* io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_VERSION}
* instead.
* io.opentelemetry.semconv.ResourceAttributes#OTEL_SCOPE_VERSION} instead.
*/
@Deprecated
public static final AttributeKey<String> OTEL_SCOPE_VERSION = stringKey("otel.scope.version");
Expand All @@ -2491,7 +2490,7 @@ private RpcConnectRpcErrorCodeValues() {}
* Deprecated.
*
* @deprecated Deprecated, use the {@link
* io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_NAME} attribute.
* io.opentelemetry.semconv.ResourceAttributes#OTEL_SCOPE_NAME} attribute.
*/
@Deprecated
public static final AttributeKey<String> OTEL_LIBRARY_NAME = stringKey("otel.library.name");
Expand All @@ -2500,8 +2499,7 @@ private RpcConnectRpcErrorCodeValues() {}
* Deprecated.
*
* @deprecated Deprecated, use the {@link
* io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_VERSION}
* attribute.
* io.opentelemetry.semconv.ResourceAttributes#OTEL_SCOPE_VERSION} attribute.
*/
@Deprecated
public static final AttributeKey<String> OTEL_LIBRARY_VERSION = stringKey("otel.library.version");
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/opentelemetry/semconv/AvailabilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class AvailabilityTest {

@Test
void available() {
classAvailable("io.opentelemetry.semconv.resource.attributes.ResourceAttributes");
classAvailable("io.opentelemetry.semconv.trace.attributes.SemanticAttributes");
classAvailable("io.opentelemetry.semconv.ResourceAttributes");
classAvailable("io.opentelemetry.semconv.SemanticAttributes");
}

private static void classAvailable(String fqcn) {
Expand Down

0 comments on commit d76b068

Please sign in to comment.