Skip to content

Commit

Permalink
Return SDK attributes in default Resource. (#1528)
Browse files Browse the repository at this point in the history
* Populate SDK resource by default.

* Add test

* Newline

* Revert "Newline"

This reverts commit e6ff4b4.

* Revert "Add test"

This reverts commit f2eaa7c.
  • Loading branch information
Anuraag Agrawal authored Aug 11, 2020
1 parent f5a611a commit 7cd931c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static Builder builder() {
public static final class Builder {

private Clock clock = MillisClock.getInstance();
private Resource resource = Resource.getTelemetrySdk().merge(Resource.getDefault());
private Resource resource = Resource.getDefault();

private Builder() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public abstract class Resource {
.setAttribute("telemetry.sdk.version", readVersion())
.build());
private static final Resource DEFAULT =
new EnvAutodetectResource.Builder().readEnvironmentVariables().readSystemProperties().build();
new EnvAutodetectResource.Builder()
.readEnvironmentVariables()
.readSystemProperties()
.build()
.merge(TELEMETRY_SDK);

@Nullable
private static String readVersion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static class Builder {

private Clock clock = MillisClock.getInstance();
private IdsGenerator idsGenerator = new RandomIdsGenerator();
private Resource resource = Resource.getTelemetrySdk().merge(Resource.getDefault());
private Resource resource = Resource.getDefault();

/**
* Assign a {@link Clock}.
Expand Down

0 comments on commit 7cd931c

Please sign in to comment.