Skip to content

Commit 3e5a764

Browse files
committed
Configuration test improvements
1 parent 4269490 commit 3e5a764

File tree

2 files changed

+22
-38
lines changed

2 files changed

+22
-38
lines changed

agent/agent-bootstrap/src/test/java/com/microsoft/applicationinsights/agent/bootstrap/configuration/ConfigurationTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.microsoft.applicationinsights.agent.bootstrap.configuration;
22

33
import java.io.IOException;
4-
import java.util.Arrays;
54

65
import com.google.common.base.Charsets;
76
import com.google.common.collect.ImmutableMap;
@@ -36,10 +35,14 @@ public void shouldParse() throws IOException {
3635
assertEquals("java.lang:type=Threading", preview.jmxMetrics.get(0).objectName);
3736
assertEquals("ThreadCount", preview.jmxMetrics.get(0).attribute);
3837
assertEquals("Thread Count", preview.jmxMetrics.get(0).display);
39-
assertEquals(ImmutableMap.of("__comment",
40-
Arrays.asList("this sets the explain plan threshold ...", "this is a multi-line comment"),
41-
"explainPlanThresholdInMS", 20000.0), preview.instrumentation.get("jdbc"));
42-
assertEquals(ImmutableMap.of("enabled", false), preview.instrumentation.get("logging"));
38+
assertEquals(ImmutableMap.of("threshold", "error"), preview.instrumentation.get("logging"));
39+
assertEquals("myproxy", preview.httpProxy.host);
40+
assertEquals(8080, preview.httpProxy.port);
41+
42+
assertEquals("file", preview.selfDiagnostics.destination);
43+
assertEquals("/var/log/applicationinsights", preview.selfDiagnostics.directory);
44+
assertEquals("error", preview.selfDiagnostics.level);
45+
assertEquals(10, preview.selfDiagnostics.maxSizeMB);
4346
}
4447

4548
@Test

agent/agent-bootstrap/src/test/resources/ApplicationInsights.json

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,30 @@
2424
"sampling": {
2525
"fixedRate": {
2626
"percentage": 10
27-
},
28-
"adaptiveRate": {
29-
"default": {
30-
"initialRate": 10,
31-
"maxPerInterval": 50,
32-
"intervalInSeconds": 1
33-
},
34-
"requests": {
35-
"initialRate": 10,
36-
"maxPerInterval": 50,
37-
"intervalInSeconds": 1
38-
}
3927
}
4028
},
41-
"distributedTracing": {
42-
"outboundEnabled": false,
43-
"requestIdCompatEnabled": false
29+
"heartbeat": {
30+
"enabled": true,
31+
"intervalSeconds": 900
4432
},
4533
"liveMetrics": {
4634
"enabled": false
4735
},
4836
"instrumentation": {
49-
"jdbc": {
50-
"__comment": [
51-
"this sets the explain plan threshold ...",
52-
"this is a multi-line comment"
53-
],
54-
"explainPlanThresholdInMS": 20000
55-
},
5637
"logging": {
57-
"enabled": false
38+
"threshold": "error"
5839
}
5940
},
60-
"customInstrumentation": [
61-
{
62-
"className": "com.example.MyObject",
63-
"methodName": "doSomething"
64-
},
65-
{
66-
"className": "com.example.MyObject",
67-
"methodName": "doMoreSomething"
68-
}
69-
]
41+
"httpProxy": {
42+
"host": "myproxy",
43+
"port": 8080
44+
},
45+
"selfDiagnostics": {
46+
"destination": "file",
47+
"directory": "/var/log/applicationinsights",
48+
"level": "error",
49+
"maxSizeMB": 10
50+
}
7051
}
7152
}
7253
}

0 commit comments

Comments
 (0)