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

Use envelope name as the telemetry name and reduce payload #1700

Merged
merged 2 commits into from
May 21, 2021
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 @@ -125,7 +125,7 @@ public Map<String, String> getProperties() {
public void serialize(JsonTelemetryDataSerializer writer) throws IOException {

if (telemetryName == null || telemetryName.isEmpty()) {
telemetryName = getTelemetryName(context.getNormalizedInstrumentationKey(), this.getEnvelopName());
telemetryName = this.getEnvelopName();
}

Envelope envelope = new Envelope();
Expand Down Expand Up @@ -203,9 +203,4 @@ public static String normalizeInstrumentationKey(String instrumentationKey){
return instrumentationKey.replace("-", "").toLowerCase() + ".";
}
}

public static String getTelemetryName(String normalizedInstrumentationKey, String envelopType){
return TELEMETRY_NAME_PREFIX + normalizedInstrumentationKey + envelopType;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void testTelemetryNameWithIkey() throws IOException{
writer.close();
String asJson = new String(buffer.readByteArray(), Charsets.UTF_8);

int index = asJson.indexOf("\"name\":\"Microsoft.ApplicationInsights.aif00000000111122223333000000000000.Stub\"");
int index = asJson.indexOf("\"name\":\"Stub\"");
assertTrue(index != -1);
}

Expand All @@ -132,7 +132,7 @@ public void testTelemetryNameWithIkey_SpecialChar() throws IOException{
writer.close();
String asJson = new String(buffer.readByteArray(), Charsets.UTF_8);

int index = asJson.indexOf("\"name\":\"Microsoft.ApplicationInsights.Stub\"");
int index = asJson.indexOf("\"name\":\"Stub\"");
assertTrue(index != -1);
}

Expand All @@ -149,7 +149,7 @@ public void testTelemetryNameWithIkey_Empty() throws IOException{
writer.close();
String asJson = new String(buffer.readByteArray(), Charsets.UTF_8);

int index = asJson.indexOf("\"name\":\"Microsoft.ApplicationInsights.Stub\"");
int index = asJson.indexOf("\"name\":\"Stub\"");
assertTrue(index != -1);
}

Expand Down