Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ repositories {

//https://github.com/gradle/gradle/issues/15383
val catalog = extensions.getByType<VersionCatalogsExtension>().named("catalog")

configurations.all {
resolutionStrategy {
// Force the semconv version to be the one we explicitly set into version catalog and override
// the upstream version, hence allowing to use a different version than upstream.
force(
"io.opentelemetry.semconv:opentelemetry-semconv:${catalog.findVersion("opentelemetrySemconv").get()}",
"io.opentelemetry.semconv:opentelemetry-semconv-incubating:${catalog.findVersion("opentelemetrySemconvAlpha").get()}"
)
}
}

dependencies {

implementation(platform(catalog.findLibrary("opentelemetryInstrumentationAlphaBom").get()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package co.elastic.otel;

import static io.opentelemetry.semconv.DeploymentAttributes.DEPLOYMENT_ENVIRONMENT_NAME;

import co.elastic.otel.config.ConfigLoggingAgentListener;
import co.elastic.otel.dynamicconfig.BlockableLogRecordExporter;
import co.elastic.otel.dynamicconfig.BlockableMetricExporter;
Expand Down Expand Up @@ -59,8 +61,6 @@ public class ElasticAutoConfigurationCustomizerProvider

private static final AttributeKey<String> DEPLOYMENT_LEGACY =
AttributeKey.stringKey("deployment.environment");
private static final AttributeKey<String> DEPLOYMENT =
AttributeKey.stringKey("deployment.environment.name");
private static final String OTEL_JAVAAGENT_EXPERIMENTAL_INDY = "otel.javaagent.experimental.indy";

@Override
Expand Down Expand Up @@ -118,8 +118,8 @@ static BiFunction<Resource, ConfigProperties, Resource> resourceProviders() {

// duplicate deprecated deployment.environment to deployment.environment.name as a convenience
String deploymentLegacy = resource.getAttribute(DEPLOYMENT_LEGACY);
if (deploymentLegacy != null && resource.getAttribute(DEPLOYMENT) == null) {
resource = resource.toBuilder().put(DEPLOYMENT, deploymentLegacy).build();
if (deploymentLegacy != null && resource.getAttribute(DEPLOYMENT_ENVIRONMENT_NAME) == null) {
resource = resource.toBuilder().put(DEPLOYMENT_ENVIRONMENT_NAME, deploymentLegacy).build();
}

return resource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.javaagent.tooling.AgentVersion;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes;
import io.opentelemetry.semconv.TelemetryAttributes;

public class ElasticDistroResource {

Expand All @@ -40,9 +40,9 @@ public static Resource get() {
}
return Resource.create(
Attributes.of(
TelemetryIncubatingAttributes.TELEMETRY_DISTRO_NAME,
TelemetryAttributes.TELEMETRY_DISTRO_NAME,
"elastic",
TelemetryIncubatingAttributes.TELEMETRY_DISTRO_VERSION,
TelemetryAttributes.TELEMETRY_DISTRO_VERSION,
AgentVersion.VERSION));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package co.elastic.otel.dynamicconfig;

import static io.opentelemetry.semconv.DeploymentAttributes.DEPLOYMENT_ENVIRONMENT_NAME;

import co.elastic.otel.compositesampling.DynamicCompositeParentBasedTraceIdRatioBasedSampler;
import co.elastic.otel.config.ConfigLoggingAgentListener;
import co.elastic.otel.dynamicconfig.internal.OpampManager;
Expand Down Expand Up @@ -138,7 +140,7 @@ static String getServiceName(ConfigProperties properties) {
@Nullable
static String getServiceEnvironment(ConfigProperties properties) {
Map<String, String> resourceMap = properties.getMap("otel.resource.attributes");
String environment = resourceMap.get("deployment.environment.name"); // semconv
String environment = resourceMap.get(DEPLOYMENT_ENVIRONMENT_NAME.getKey());
if (environment != null) {
return environment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package co.elastic.otel.dynamicconfig.internal;

import static io.opentelemetry.semconv.DeploymentAttributes.DEPLOYMENT_ENVIRONMENT_NAME;

import com.dslplatform.json.DslJson;
import com.dslplatform.json.JsonReader;
import com.dslplatform.json.MapConverter;
Expand Down Expand Up @@ -85,7 +87,8 @@ public void start(CentralConfigurationProcessor processor) {
builder.putIdentifyingAttribute("service.name", configuration.serviceName);
}
if (configuration.environment != null) {
builder.putIdentifyingAttribute("deployment.environment.name", configuration.environment);
builder.putIdentifyingAttribute(
DEPLOYMENT_ENVIRONMENT_NAME.getKey(), configuration.environment);
}
PeriodicDelay retryDelay = RetryPeriodicDelay.create(configuration.pollingInterval);
builder.setRequestService(HttpRequestService.create(httpSender, pollingDelay, retryDelay));
Expand Down
37 changes: 0 additions & 37 deletions custom/src/test/java/co/elastic/otel/SemconvTest.java

This file was deleted.

7 changes: 7 additions & 0 deletions docs/changelog/1093.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
prs:
- "1093"
type: enhancement
products:
- product: edot-java
lifecycle: ga
title: semconv 1.41.0 update
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ opentelemetryContribAlpha = "1.55.0-alpha"
# updated from upstream agent with .ci/update-upstream.sh
# While the semconv stable/incubating artifacts are provided as transitive dependencies, keeping
# an explicit version here allows to easily override to a not-yet-released version.
opentelemetrySemconv = "1.40.0"
opentelemetrySemconvAlpha = "1.40.0-alpha"
opentelemetrySemconv = "1.41.0"
opentelemetrySemconvAlpha = "1.41.0-alpha"

[libraries]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_INSTANCE_ID;
import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME;
import static io.opentelemetry.semconv.TelemetryAttributes.TELEMETRY_DISTRO_NAME;
import static io.opentelemetry.semconv.TelemetryAttributes.TELEMETRY_DISTRO_VERSION;
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_ID;
import static io.opentelemetry.semconv.incubating.HostIncubatingAttributes.HOST_ARCH;
import static io.opentelemetry.semconv.incubating.HostIncubatingAttributes.HOST_NAME;
import static io.opentelemetry.semconv.incubating.OsIncubatingAttributes.OS_TYPE;
import static io.opentelemetry.semconv.incubating.OsIncubatingAttributes.OS_VERSION;
import static io.opentelemetry.semconv.incubating.ProcessIncubatingAttributes.PROCESS_COMMAND_ARGS;
import static io.opentelemetry.semconv.incubating.ProcessIncubatingAttributes.PROCESS_PID;
import static io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes.TELEMETRY_DISTRO_NAME;
import static io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes.TELEMETRY_DISTRO_VERSION;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes;
import io.opentelemetry.semconv.TelemetryAttributes;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand All @@ -43,16 +43,16 @@ public void checkDistroName() {

if (isRunningDistro) {
assertThat(resource.getAttributes())
.containsEntry(TelemetryIncubatingAttributes.TELEMETRY_DISTRO_NAME, "elastic");
.containsEntry(TelemetryAttributes.TELEMETRY_DISTRO_NAME, "elastic");
assertThat(resource.getAttributes())
.containsKey(TelemetryIncubatingAttributes.TELEMETRY_DISTRO_VERSION);
.containsKey(TelemetryAttributes.TELEMETRY_DISTRO_VERSION);
} else {
// we are running with the vanilla agent as extension: we should not be setting the distro
// name
assertThat(resource.getAttributes())
.doesNotContainKey(TelemetryIncubatingAttributes.TELEMETRY_DISTRO_NAME);
.doesNotContainKey(TelemetryAttributes.TELEMETRY_DISTRO_NAME);
assertThat(resource.getAttributes())
.doesNotContainKey(TelemetryIncubatingAttributes.TELEMETRY_DISTRO_VERSION);
.doesNotContainKey(TelemetryAttributes.TELEMETRY_DISTRO_VERSION);
}
}
}
Loading