Skip to content

Commit

Permalink
Deprecate opentelemetry-sdk-extension-resources (#4748)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg authored Oct 1, 2022
1 parent 3456e6b commit e1519bd
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ 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.18.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.18.0<!--/VERSION_STABLE--> |
| [SDK Resources Extension](./sdk-extensions/resources) | Resource providers, including container, host, os, and process | `opentelemetry-sdk-extension-resources` | <!--VERSION_STABLE-->1.18.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.18.0<!--/VERSION_STABLE--> |
| [SDK AWS Extension](./sdk-extensions/aws) | AWS resource providers, including beanstalk, ec2, ecs, eks, and lambda | `opentelemetry-sdk-extension-aws` | <!--VERSION_STABLE-->1.18.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.18.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.18.0-alpha<!--/VERSION_UNSTABLE--> |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
Comparing source compatibility of against
No changes.
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.ContainerResource (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC io.opentelemetry.sdk.extension.resources.ContainerResourceProvider (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.HostResource (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.HostResourceProvider (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.OsResource (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.OsResourceProvider (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.ProcessResource (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.ProcessResourceProvider (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.ProcessRuntimeResource (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
=== UNCHANGED CLASS: PUBLIC FINAL io.opentelemetry.sdk.extension.resources.ProcessRuntimeResourceProvider (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW ANNOTATION: java.lang.Deprecated
6 changes: 6 additions & 0 deletions sdk-extensions/resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

[![Javadocs][javadoc-image]][javadoc-url]

> **NOTICE**: This artifact is deprecated and its contents have been moved
> to [io.opentelemetry.instrumentation:opentelemetry-resources](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources).
> Version 1.19.0 will be the last minor version published. However, it will continue to receive
> patches for security vulnerabilities, and `io.opentelemetry:opentelemetry-bom` will reference the
> last published version.
This package includes some standard `ResourceProvider`s for filling in attributes related to
common environments. Currently the resources provide the following semantic conventions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
import javax.annotation.Nullable;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;

/** Factory for {@link Resource} retrieving Container ID information. */
/**
* Factory for {@link Resource} retrieving Container ID information.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class ContainerResource {

private static final Logger logger = Logger.getLogger(ContainerResource.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link ResourceProvider}. */
/**
* {@link ResourceProvider} for automatically configuring {@link ResourceProvider}.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public class ContainerResourceProvider implements ResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
import java.net.InetAddress;
import java.net.UnknownHostException;

/** Factory for a {@link Resource} which provides information about the host info. */
/**
* Factory for a {@link Resource} which provides information about the host info.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class HostResource {

private static final Resource INSTANCE = buildResource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link HostResource}. */
/**
* {@link ResourceProvider} for automatically configuring {@link HostResource}.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class HostResourceProvider implements ResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import javax.annotation.Nullable;

/** Factory of a {@link Resource} which provides information about the current operating system. */
/**
* Factory of a {@link Resource} which provides information about the current operating system.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class OsResource {

private static final Resource INSTANCE = buildResource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link OsResource}. */
/**
* {@link ResourceProvider} for automatically configuring {@link OsResource}.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class OsResourceProvider implements ResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
import java.lang.management.RuntimeMXBean;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;

/** Factory of a {@link Resource} which provides information about the current running process. */
/**
* Factory of a {@link Resource} which provides information about the current running process.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class ProcessResource {

private static final Resource INSTANCE = buildResource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link ProcessResource}. */
/**
* {@link ResourceProvider} for automatically configuring {@link ProcessResource}.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class ProcessResourceProvider implements ResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;

/** Factory of a {@link Resource} which provides information about the Java runtime. */
/**
* Factory of a {@link Resource} which provides information about the Java runtime.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class ProcessRuntimeResource {

private static final Resource INSTANCE = buildResource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link ProcessRuntimeResource}. */
/**
* {@link ResourceProvider} for automatically configuring {@link ProcessRuntimeResource}.
*
* @deprecated Moved to <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/resources">io.opentelemetry.instrumentation:opentelemetry-resources</a>.
*/
@Deprecated
public final class ProcessRuntimeResourceProvider implements ResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package io.opentelemetry.sdk.extension.resources;

import static io.opentelemetry.sdk.extension.resources.ContainerResource.buildResource;
import static org.assertj.core.api.Assertions.assertThat;

import io.opentelemetry.sdk.resources.Resource;
Expand All @@ -17,6 +16,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

@SuppressWarnings("deprecation") // Moved to instrumentation
class ContainerResourceTest {

@Test
Expand All @@ -26,18 +26,18 @@ void buildResource_Invalid(@TempDir Path tempFolder) throws IOException {
createCGroup(
tempFolder.resolve("cgroup1"),
"13:name=systemd:/podruntime/docker/kubepods/ac679f8a8319c8cf7d38e1adf263bc08d23zzzz");
assertThat(buildResource(cgroup)).isEqualTo(Resource.empty());
assertThat(ContainerResource.buildResource(cgroup)).isEqualTo(Resource.empty());

// unrecognized format (last "-" is after last ".")
cgroup =
createCGroup(
tempFolder.resolve("cgroup1"),
"13:name=systemd:/podruntime/docker/kubepods/ac679f8.a8319c8cf7d38e1adf263bc08-d23zzzz");
assertThat(buildResource(cgroup)).isEqualTo(Resource.empty());
assertThat(ContainerResource.buildResource(cgroup)).isEqualTo(Resource.empty());

// test invalid file
cgroup = tempFolder.resolve("DoesNotExist");
assertThat(buildResource(cgroup)).isEqualTo(Resource.empty());
assertThat(ContainerResource.buildResource(cgroup)).isEqualTo(Resource.empty());
}

@Test
Expand All @@ -47,23 +47,23 @@ void buildResource_Valid(@TempDir Path tempFolder) throws IOException {
createCGroup(
tempFolder.resolve("cgroup1"),
"13:name=systemd:/podruntime/docker/kubepods/ac679f8a8319c8cf7d38e1adf263bc08d23.aaaa");
assertThat(getContainerId(buildResource(cgroup)))
assertThat(getContainerId(ContainerResource.buildResource(cgroup)))
.isEqualTo("ac679f8a8319c8cf7d38e1adf263bc08d23");

// with prefix and suffix
Path cgroup2 =
createCGroup(
tempFolder.resolve("cgroup2"),
"13:name=systemd:/podruntime/docker/kubepods/crio-dc679f8a8319c8cf7d38e1adf263bc08d23.stuff");
assertThat(getContainerId(buildResource(cgroup2)))
assertThat(getContainerId(ContainerResource.buildResource(cgroup2)))
.isEqualTo("dc679f8a8319c8cf7d38e1adf263bc08d23");

// just container id
Path cgroup3 =
createCGroup(
tempFolder.resolve("cgroup3"),
"13:name=systemd:/pod/d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356");
assertThat(getContainerId(buildResource(cgroup3)))
assertThat(getContainerId(ContainerResource.buildResource(cgroup3)))
.isEqualTo("d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356");

// with prefix
Expand All @@ -74,15 +74,15 @@ void buildResource_Valid(@TempDir Path tempFolder) throws IOException {
+ "1:name=systemd:/podruntime/docker/kubepods/docker-dc579f8a8319c8cf7d38e1adf263bc08d23"
+ "2:name=systemd:/podruntime/docker/kubepods/docker-dc579f8a8319c8cf7d38e1adf263bc08d23"
+ "3:name=systemd:/podruntime/docker/kubepods/docker-dc579f8a8319c8cf7d38e1adf263bc08d23");
assertThat(getContainerId(buildResource(cgroup4)))
assertThat(getContainerId(ContainerResource.buildResource(cgroup4)))
.isEqualTo("dc579f8a8319c8cf7d38e1adf263bc08d23");

// with two dashes in prefix
Path cgroup5 =
createCGroup(
tempFolder.resolve("cgroup5"),
"11:perf_event:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod4415fd05_2c0f_4533_909b_f2180dca8d7c.slice/cri-containerd-713a77a26fe2a38ebebd5709604a048c3d380db1eb16aa43aca0b2499e54733c.scope");
assertThat(getContainerId(buildResource(cgroup5)))
assertThat(getContainerId(ContainerResource.buildResource(cgroup5)))
.isEqualTo("713a77a26fe2a38ebebd5709604a048c3d380db1eb16aa43aca0b2499e54733c");

// with colon, env: k8s v1.24.0, the cgroupDriver by systemd(default), and container is
Expand All @@ -91,7 +91,7 @@ void buildResource_Valid(@TempDir Path tempFolder) throws IOException {
createCGroup(
tempFolder.resolve("cgroup6"),
"11:devices:/system.slice/containerd.service/kubepods-pod87a18a64_b74a_454a_b10b_a4a36059d0a3.slice:cri-containerd:05c48c82caff3be3d7f1e896981dd410e81487538936914f32b624d168de9db0");
assertThat(getContainerId(buildResource(cgroup6)))
assertThat(getContainerId(ContainerResource.buildResource(cgroup6)))
.isEqualTo("05c48c82caff3be3d7f1e896981dd410e81487538936914f32b624d168de9db0");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.extension.ExtendWith;

@SuppressWarnings("deprecation") // Moved to instrumentation
class HostResourceTest {
@Test
void shouldCreateRuntimeAttributes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.junitpioneer.jupiter.SetSystemProperty;

@SuppressWarnings("deprecation") // Moved to instrumentation
class OsResourceTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.junitpioneer.jupiter.SetSystemProperty;

@SuppressWarnings("deprecation") // Moved to instrumentation
class ProcessResourceTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.extension.ExtendWith;

@SuppressWarnings("deprecation") // Moved to instrumentation
class ProcessRuntimeResourceTest {
@Test
void shouldCreateRuntimeAttributes() {
Expand Down

0 comments on commit e1519bd

Please sign in to comment.