-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from lyft/e2e-metric-from-fork
Recreate PR #4 and a little bit more refactoring.
- Loading branch information
Showing
13 changed files
with
633 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.salesforce; | ||
|
||
import io.micrometer.core.instrument.Tag; | ||
|
||
/** | ||
* This class implements io.micrometer.core.instrument.Tag interface | ||
* and provides a hard coded order. This is useful because | ||
* otherwise micrometer implementation orders the tags based on the keys | ||
* and this leads to ugly metric naming. | ||
*/ | ||
public class CustomOrderedTag implements Tag { | ||
private final String key; | ||
private final String value; | ||
private final int relativeOrder; | ||
|
||
private CustomOrderedTag(final String key, final String value, final int relativeOrder) { | ||
this.key = key; | ||
this.value = value; | ||
this.relativeOrder = relativeOrder; | ||
} | ||
static Tag of(String key, String value, int relativeOrder) { | ||
return new CustomOrderedTag(key, value, relativeOrder); | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return key; | ||
} | ||
|
||
@Override | ||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public int compareTo(Tag o) { | ||
if (o instanceof CustomOrderedTag) { | ||
return Integer.compare(this.relativeOrder, ((CustomOrderedTag) o).relativeOrder); | ||
} else { | ||
return getKey().compareTo(o.getKey()); | ||
} | ||
} | ||
} |
Oops, something went wrong.