Fix nullness in Resource (low priority). (#3472)

This commit is contained in:
Anuraag Agrawal 2021-08-14 14:12:02 +09:00 committed by GitHub
parent efe6886d77
commit 1a881a6946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View File

@ -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.