Skip to content

Commit

Permalink
Map service.version to application_Version (#1397)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored Dec 2, 2020
1 parent 249778e commit 4a1762e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ public ResourceAttributesContextInitializer(Map<String, String> resourceAttribut
@Override
public void initialize(TelemetryContext context) {
for (Map.Entry<String, String> entry: resourceAttributes.entrySet()) {
context.getProperties().put(entry.getKey(), substitutor.replace(entry.getValue()));
String key = entry.getKey();
if (key.equals("service.version")) {
context.getComponent().setVersion(substitutor.replace(entry.getValue()));
} else {
context.getProperties().put(key, substitutor.replace(entry.getValue()));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"connectionString": "InstrumentationKey=00000000-0000-0000-0000-0FEEDDADBEEF;IngestionEndpoint=http://fakeingestion:60606/",
"customDimensions": {
"test": "value",
"home": "${HOME}"
"home": "${HOME}",
"service.version": "123"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public void doMostBasicTest() throws Exception {
assertEquals("value", rd.getProperties().get("test"));
assertEquals("/root", rd.getProperties().get("home"));

assertEquals("123", rdEnvelope.getTags().get("ai.application.ver"));

assertTrue(rd.getSuccess());
}
}

0 comments on commit 4a1762e

Please sign in to comment.