Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return LabelSetSdk to allow using getLabels in tests and internally #868

Merged
merged 1 commit into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@

@AutoValue
abstract class LabelSetSdk implements LabelSet {
private static final LabelSet EMPTY =
private static final LabelSetSdk EMPTY =
new AutoValue_LabelSetSdk(Collections.<String, String>emptyMap());

static LabelSet create(Map<String, String> labels) {
static LabelSetSdk create(Map<String, String> labels) {
if (labels == null || labels.isEmpty()) {
return EMPTY;
}
return new AutoValue_LabelSetSdk(unmodifiableMap(labels));
}

static LabelSet create(String... keyValuePairs) {
static LabelSetSdk create(String... keyValuePairs) {
if (keyValuePairs.length == 0) {
return EMPTY;
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/main/java/io/opentelemetry/sdk/metrics/MeterSdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ public BatchRecorder newBatchRecorder(LabelSet labelSet) {
}

@Override
public LabelSet createLabelSet(String... keyValuePairs) {
public LabelSetSdk createLabelSet(String... keyValuePairs) {
return LabelSetSdk.create(keyValuePairs);
}

@Override
public LabelSet createLabelSet(Map<String, String> labels) {
public LabelSetSdk createLabelSet(Map<String, String> labels) {
return LabelSetSdk.create(labels);
}
}