Skip to content

Commit

Permalink
Return LabelSetSdk to allow using getLabels in tests and internally (#…
Browse files Browse the repository at this point in the history
…868)

Signed-off-by: Bogdan Cristian Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Feb 18, 2020
1 parent de4a5e2 commit e3bc56c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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);
}
}

0 comments on commit e3bc56c

Please sign in to comment.