Skip to content

Commit

Permalink
Stop publishing opentelemetry-sdk-extension-resources artifact (#4828)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg committed Oct 31, 2022
1 parent 140c636 commit 52c37d5
Show file tree
Hide file tree
Showing 35 changed files with 55 additions and 1,298 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -270,7 +270,6 @@ dependency as follows, replacing `{{artifact-id}}` with the value from the "Arti
|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------|
| [SDK Autoconfigure Extension](./sdk-extensions/autoconfigure) | Autoconfigure OpenTelemetry SDK from env vars, system properties, and SPI | `opentelemetry-sdk-extension-autoconfigure` | <!--VERSION_UNSTABLE-->1.19.0-alpha<!--/VERSION_UNSTABLE--> |
| [SDK Autoconfigure SPI](./sdk-extensions/autoconfigure-spi) | Service Provider Interface (SPI) definitions for autoconfigure | `opentelemetry-sdk-extension-autoconfigure-spi` | <!--VERSION_STABLE-->1.19.0<!--/VERSION_STABLE--> |
| [SDK Resources Extension](./sdk-extensions/resources) | Resource providers, including container, host, os, and process (deprecated) | `opentelemetry-sdk-extension-resources` | <!--VERSION_STABLE-->1.19.0<!--/VERSION_STABLE--> |
| [SDK Jaeger Remote Sampler Extension](./sdk-extensions/jaeger-remote-sampler) | Sampler which obtains sampling configuration from remote Jaeger server | `opentelemetry-sdk-extension-jaeger-remote-sampler` | <!--VERSION_STABLE-->1.19.0<!--/VERSION_STABLE--> |
| [SDK Incubator](./sdk-extensions/incubator) | SDK incubator, including YAML based view configuration, LeakDetectingSpanProcessor, and zPages | `opentelemetry-sdk-extension-incubator` | <!--VERSION_UNSTABLE-->1.19.0-alpha<!--/VERSION_UNSTABLE--> |

Expand Down
1 change: 1 addition & 0 deletions all/build.gradle.kts
Expand Up @@ -48,6 +48,7 @@ dependencies {
testImplementation("io.grpc:grpc-protobuf")
testImplementation("io.grpc:grpc-stub")
testImplementation("io.opentelemetry:opentelemetry-extension-annotations")
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-resources")
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-aws")

testImplementation("com.tngtech.archunit:archunit-junit5")
Expand Down
14 changes: 14 additions & 0 deletions all/src/test/java/io/opentelemetry/all/FallbackArtifactsTest.java
Expand Up @@ -27,6 +27,20 @@ void extensionAnnotations() {
classAvailable("io.opentelemetry.extension.annotations.SpanAttribute");
}

@Test
void sdkExtensionResources() {
classAvailable("io.opentelemetry.sdk.extension.resources.ContainerResource");
classAvailable("io.opentelemetry.sdk.extension.resources.ContainerResourceProvider");
classAvailable("io.opentelemetry.sdk.extension.resources.HostResource");
classAvailable("io.opentelemetry.sdk.extension.resources.HostResourceProvider");
classAvailable("io.opentelemetry.sdk.extension.resources.OsResource");
classAvailable("io.opentelemetry.sdk.extension.resources.OsResourceProvider");
classAvailable("io.opentelemetry.sdk.extension.resources.ProcessResource");
classAvailable("io.opentelemetry.sdk.extension.resources.ProcessResourceProvider");
classAvailable("io.opentelemetry.sdk.extension.resources.ProcessRuntimeResource");
classAvailable("io.opentelemetry.sdk.extension.resources.ProcessRuntimeResourceProvider");
}

@Test
void sdkExtensionAws() {
classAvailable("io.opentelemetry.sdk.extension.aws.resource.BeanstalkResource");
Expand Down
1 change: 1 addition & 0 deletions bom/build.gradle.kts
Expand Up @@ -11,4 +11,5 @@ otelBom.projectFilter.set { !it.hasProperty("otel.release") }
// Artifacts that were previously published and included in the BOM for backwards compatibility
otelBom.addFallback("opentelemetry-exporter-jaeger-proto", "1.17.0")
otelBom.addFallback("opentelemetry-extension-annotations", "1.18.0")
otelBom.addFallback("opentelemetry-sdk-extension-resources", "1.19.0")
otelBom.addFallback("opentelemetry-sdk-extension-aws", "1.19.0")

This file was deleted.

1 change: 0 additions & 1 deletion exporters/otlp/common/build.gradle.kts
Expand Up @@ -34,7 +34,6 @@ dependencies {
testImplementation("io.opentelemetry.proto:opentelemetry-proto")

jmhImplementation(project(":sdk:testing"))
jmhImplementation(project(":sdk-extensions:resources"))
jmhImplementation("com.fasterxml.jackson.core:jackson-core")
jmhImplementation("io.opentelemetry.proto:opentelemetry-proto")
jmhImplementation("io.grpc:grpc-netty")
Expand Down
33 changes: 0 additions & 33 deletions sdk-extensions/autoconfigure/build.gradle.kts
Expand Up @@ -85,7 +85,6 @@ testing {
implementation(project(":exporters:otlp:common"))
implementation(project(":exporters:prometheus"))
implementation(project(":exporters:zipkin"))
implementation(project(":sdk-extensions:resources"))
implementation(project(":sdk:testing"))
implementation(project(":sdk:trace-shaded-deps"))
implementation(project(":semconv"))
Expand Down Expand Up @@ -177,38 +176,6 @@ testing {
}
}
}
val testResourceDisabledByProperty by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":sdk-extensions:resources"))
}

targets {
all {
testTask {
jvmArgs("-Dotel.java.disabled.resource-providers=io.opentelemetry.sdk.extension.resources.OsResourceProvider,io.opentelemetry.sdk.extension.resources.ProcessResourceProvider")
// Properties win, this is ignored.
environment("OTEL_JAVA_DISABLED_RESOURCE_PROVIDERS", "io.opentelemetry.sdk.extension.resources.ProcessRuntimeResourceProvider")
environment("OTEL_TRACES_EXPORTER", "none")
environment("OTEL_METRICS_EXPORTER", "none")
}
}
}
}
val testResourceDisabledByEnv by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":sdk-extensions:resources"))
}

targets {
all {
testTask {
environment("OTEL_JAVA_DISABLED_RESOURCE_PROVIDERS", "io.opentelemetry.sdk.extension.resources.OsResourceProvider,io.opentelemetry.sdk.extension.resources.ProcessResourceProvider")
environment("OTEL_TRACES_EXPORTER", "none")
environment("OTEL_METRICS_EXPORTER", "none")
}
}
}
}
val testZipkin by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:zipkin"))
Expand Down
Expand Up @@ -9,7 +9,6 @@

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collections;
Expand All @@ -20,108 +19,82 @@
class ResourceConfigurationTest {

@Test
void resource() {
void configureResource() {
Attributes attributes =
ResourceConfiguration.configureResource(
DefaultConfigProperties.get(Collections.emptyMap()),
ResourceConfigurationTest.class.getClassLoader(),
(r, c) -> r)
.getAttributes();

assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isNotNull();
assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotNull();

assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isNotNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)).isNotNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_COMMAND_LINE)).isNotNull();

assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_NAME)).isNotNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_VERSION)).isNotNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_DESCRIPTION)).isNotNull();
assertThat(attributes.get(AttributeKey.stringKey("animal"))).isNotNull();
assertThat(attributes.get(AttributeKey.stringKey("color"))).isNotNull();
}

@Test
void emptyClassLoader() {
void configureResource_EmptyClassLoader() {
Attributes attributes =
ResourceConfiguration.configureResource(
DefaultConfigProperties.get(Collections.emptyMap()),
new URLClassLoader(new URL[0], null),
(r, c) -> r)
.getAttributes();

assertProcessAttributeIsNull(attributes);
assertThat(attributes.get(AttributeKey.stringKey("animal"))).isNull();
assertThat(attributes.get(AttributeKey.stringKey("color"))).isNull();
}

@Test
void onlyEnabledCustomResourceProvider() {
void configureResource_OnlyEnabled() {
Map<String, String> customConfigs = new HashMap<>(1);
customConfigs.put(
"otel.java.enabled.resource.providers",
"io.opentelemetry.sdk.autoconfigure.ResourceProviderCustomizer");
"io.opentelemetry.sdk.autoconfigure.TestAnimalResourceProvider");
Attributes attributes =
ResourceConfiguration.configureResource(
DefaultConfigProperties.get(customConfigs),
ResourceConfigurationTest.class.getClassLoader(),
(r, c) -> r)
.getAttributes();

assertProcessAttributeIsNull(attributes);
assertThat(attributes.get(AttributeKey.stringKey("animal"))).isEqualTo("cat");
assertThat(attributes.get(AttributeKey.stringKey("color"))).isNull();
}

@Test
void settingEnabledAndDisabledConfiguration() {
void configureResource_EnabledAndDisabled() {
Map<String, String> customConfigs = new HashMap<>(2);
customConfigs.put(
"otel.java.enabled.resource.providers",
"io.opentelemetry.sdk.autoconfigure.ResourceProviderCustomizer,io.opentelemetry.sdk.extension.resources.OsResourceProvider,io.opentelemetry.sdk.extension.resources.ProcessResourceProvider");
"io.opentelemetry.sdk.autoconfigure.TestAnimalResourceProvider");
customConfigs.put(
"otel.java.disabled.resource.providers",
"io.opentelemetry.sdk.extension.resources.OsResourceProvider");
"io.opentelemetry.sdk.extension.resources.TestColorResourceProvider");
Attributes attributes =
ResourceConfiguration.configureResource(
DefaultConfigProperties.get(customConfigs),
ResourceConfigurationTest.class.getClassLoader(),
(r, c) -> r)
.getAttributes();

assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isNull();
assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNull();

assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isNotNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)).isNotNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_COMMAND_LINE)).isNotNull();

assertThat(attributes.get(AttributeKey.stringKey("animal"))).isEqualTo("cat");
assertThat(attributes.get(AttributeKey.stringKey("color"))).isNull();
}

@Test
void onlySettingEnabledConfiguration() {
void configureResource_OnlyDisabled() {
Map<String, String> customConfigs = new HashMap<>(1);
customConfigs.put(
"otel.java.enabled.resource.providers",
"io.opentelemetry.sdk.autoconfigure.ResourceProviderCustomizer");
"otel.java.disabled.resource.providers",
"io.opentelemetry.sdk.autoconfigure.TestColorResourceProvider");
Attributes attributes =
ResourceConfiguration.configureResource(
DefaultConfigProperties.get(customConfigs),
ResourceConfigurationTest.class.getClassLoader(),
(r, c) -> r)
.getAttributes();

assertProcessAttributeIsNull(attributes);
assertThat(attributes.get(AttributeKey.stringKey("animal"))).isEqualTo("cat");
}

void assertProcessAttributeIsNull(Attributes attributes) {
assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isNull();
assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNull();

assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)).isNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_COMMAND_LINE)).isNull();

assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_NAME)).isNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_VERSION)).isNull();
assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_DESCRIPTION)).isNull();
assertThat(attributes.get(AttributeKey.stringKey("color"))).isNull();
}
}
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

public class ResourceProviderCustomizer implements ResourceProvider {
public class TestAnimalResourceProvider implements ResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
return Resource.create(Attributes.of(AttributeKey.stringKey("animal"), "cat"));
Expand Down
@@ -0,0 +1,19 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.autoconfigure;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

public class TestColorResourceProvider implements ResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
return Resource.create(Attributes.of(AttributeKey.stringKey("color"), "blue"));
}
}
@@ -1 +1,2 @@
io.opentelemetry.sdk.autoconfigure.ResourceProviderCustomizer
io.opentelemetry.sdk.autoconfigure.TestAnimalResourceProvider
io.opentelemetry.sdk.autoconfigure.TestColorResourceProvider
54 changes: 0 additions & 54 deletions sdk-extensions/resources/README.md

This file was deleted.

66 changes: 0 additions & 66 deletions sdk-extensions/resources/build.gradle.kts

This file was deleted.

0 comments on commit 52c37d5

Please sign in to comment.