Skip to content

Commit 18d6981

Browse files
authored
Capture http method in operation name (#1679)
* Capture http method in operation name * Bump version * Update change log
1 parent c465635 commit 18d6981

27 files changed

+16
-57
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# CHANGELOG
2+
# Version 3.1.0
3+
* Capture http method in the operation name [#1679](https://github.com/microsoft/ApplicationInsights-Java/pull/1679)
4+
25
# Version 3.0.4-BETA.2
36
* Enable users to override iKey, cloud role name and cloud role instance per telemetry [#1630](https://github.com/microsoft/ApplicationInsights-Java/pull/1630).
47
* Fix duplicate headers [#1640](https://github.com/microsoft/ApplicationInsights-Java/pull/1640).

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/wasbootstrap/OpenTelemetryConfigurer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public void configure(SdkTracerProviderBuilder tracerProvider) {
5454

5555
if (currExporter == null) {
5656
currExporter = processorConfig.type == ProcessorType.attribute ?
57-
new ExporterWithAttributeProcessor(processorConfig, new Exporter(telemetryClient, config.preview.httpMethodInOperationName)) :
58-
new ExporterWithSpanProcessor(processorConfig, new Exporter(telemetryClient, config.preview.httpMethodInOperationName));
57+
new ExporterWithAttributeProcessor(processorConfig, new Exporter(telemetryClient)) :
58+
new ExporterWithSpanProcessor(processorConfig, new Exporter(telemetryClient));
5959

6060
} else {
6161
currExporter = processorConfig.type == ProcessorType.attribute ?
@@ -67,7 +67,7 @@ public void configure(SdkTracerProviderBuilder tracerProvider) {
6767
tracerProvider.addSpanProcessor(SimpleSpanProcessor.create(currExporter));
6868

6969
} else {
70-
tracerProvider.addSpanProcessor(SimpleSpanProcessor.create(new Exporter(telemetryClient, config.preview.httpMethodInOperationName)));
70+
tracerProvider.addSpanProcessor(SimpleSpanProcessor.create(new Exporter(telemetryClient)));
7171
}
7272
}
7373
}

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/wasbootstrap/configuration/Configuration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public static class LoggingInstrumentation {
136136
public static class MicrometerInstrumentation {
137137
public boolean enabled = true;
138138
// this is just here to detect if using this old undocumented setting in order to give a helpful error message
139+
@Deprecated
139140
public int reportingIntervalSeconds = 60;
140141
}
141142

@@ -176,7 +177,8 @@ public static class PreviewConfiguration {
176177
// ignoreRemoteParentNotSampled is currently needed
177178
// because .NET SDK always propagates trace flags "00" (not sampled)
178179
public boolean ignoreRemoteParentNotSampled = true;
179-
// TODO consider turning this on by default in 3.1.0
180+
// this is just here to detect if using this old setting in order to give a helpful message
181+
@Deprecated
180182
public boolean httpMethodInOperationName;
181183
public LiveMetrics liveMetrics = new LiveMetrics();
182184

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/wasbootstrap/configuration/ConfigurationBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ public static Configuration create(Path agentJarPath, RpConfiguration rpConfigur
9595
" (and note that metricIntervalSeconds applies to all auto-collected metrics," +
9696
" not only micrometer)"));
9797
}
98+
if (config.preview.httpMethodInOperationName) {
99+
configurationWarnMessages.add(new ConfigurationWarnMessage(
100+
"\"httpMethodInOperationName\" preview setting is now the (one and only) default behavior"));
101+
}
98102
overlayEnvVars(config);
99103
applySamplingPercentageRounding(config);
100104
// rp configuration should always be last (so it takes precedence)

agent/exporter/src/main/java/com/microsoft/applicationinsights/agent/Exporter.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,8 @@ public class Exporter implements SpanExporter {
128128

129129
private final TelemetryClient telemetryClient;
130130

131-
private final boolean httpMethodInOperationName;
132-
133-
public Exporter(TelemetryClient telemetryClient, boolean httpMethodInOperationName) {
131+
public Exporter(TelemetryClient telemetryClient) {
134132
this.telemetryClient = telemetryClient;
135-
this.httpMethodInOperationName = httpMethodInOperationName;
136133
}
137134

138135
/**
@@ -623,7 +620,7 @@ private void exportRequest(SpanData span) {
623620

624621
private String getTelemetryName(SpanData span) {
625622
String name = span.getName();
626-
if (!httpMethodInOperationName || !name.startsWith("/")) {
623+
if (!name.startsWith("/")) {
627624
return name;
628625
}
629626
String httpMethod = span.getAttributes().get(SemanticAttributes.HTTP_METHOD);

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Project properties
2-
version=3.0.4-BETA.3
2+
version=3.1.0
33
group=com.microsoft.azure

test/smoke/appServers/global-resources/azuresdk_applicationinsights.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"connectionString": "InstrumentationKey=00000000-0000-0000-0000-0FEEDDADBEEF;IngestionEndpoint=http://host.docker.internal:6060/",
33
"preview": {
4-
"httpMethodInOperationName": true,
54
"instrumentation": {
65
"azureSdk": {
76
"enabled": true

test/smoke/appServers/global-resources/customdimensions_applicationinsights.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
"test": "value",
55
"home": "${HOME}",
66
"service.version": "123"
7-
},
8-
"preview": {
9-
"httpMethodInOperationName": true
107
}
118
}

test/smoke/appServers/global-resources/custominstrumentation_applicationinsights.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"connectionString": "InstrumentationKey=00000000-0000-0000-0000-0FEEDDADBEEF;IngestionEndpoint=http://host.docker.internal:6060/",
33
"preview": {
4-
"httpMethodInOperationName": true,
54
"customInstrumentation": [
65
{
76
"className": "com.microsoft.applicationinsights.smoketestapp.TargetObject",

test/smoke/appServers/global-resources/default_applicationinsights.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
"role": {
44
"name": "testrolename",
55
"instance": "testroleinstance"
6-
},
7-
"preview": {
8-
"httpMethodInOperationName": true
96
}
107
}

0 commit comments

Comments
 (0)