Fix nullness in Resource (low priority). (#3472)
This commit is contained in:
parent
efe6886d77
commit
1a881a6946
|
|
@ -11,7 +11,6 @@ import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.TE
|
||||||
import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.TELEMETRY_SDK_VERSION;
|
import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.TELEMETRY_SDK_VERSION;
|
||||||
|
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
import com.google.auto.value.extension.memoized.Memoized;
|
|
||||||
import io.opentelemetry.api.common.AttributeKey;
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
import io.opentelemetry.api.common.Attributes;
|
import io.opentelemetry.api.common.Attributes;
|
||||||
import io.opentelemetry.api.common.AttributesBuilder;
|
import io.opentelemetry.api.common.AttributesBuilder;
|
||||||
|
|
@ -110,7 +109,6 @@ public abstract class Resource {
|
||||||
return new AutoValue_Resource(schemaUrl, attributes);
|
return new AutoValue_Resource(schemaUrl, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private static String readVersion() {
|
private static String readVersion() {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
try {
|
try {
|
||||||
|
|
@ -120,7 +118,7 @@ public abstract class Resource {
|
||||||
// we left the attribute empty
|
// we left the attribute empty
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
return properties.getProperty("sdk.version");
|
return properties.getProperty("sdk.version", "unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -149,10 +147,6 @@ public abstract class Resource {
|
||||||
return getAttributes().get(key);
|
return getAttributes().get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Memoized
|
|
||||||
@Override
|
|
||||||
public abstract int hashCode();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new, merged {@link Resource} by merging the current {@code Resource} with the {@code
|
* Returns a new, merged {@link Resource} by merging the current {@code Resource} with the {@code
|
||||||
* other} {@code Resource}. In case of a collision, the "other" {@code Resource} takes precedence.
|
* other} {@code Resource}. In case of a collision, the "other" {@code Resource} takes precedence.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue