Skip to content

Commit 45d716e

Browse files
authored
Display a message about sampling at start-up (#3700)
1 parent 66a687c commit 45d716e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ private static void overlayConfiguration(
301301
// only fall back to default sampling configuration after all overlays have been performed
302302
if (config.sampling.requestsPerSecond == null && config.sampling.percentage == null) {
303303
config.sampling.requestsPerSecond = 5.0;
304+
configurationLogger.info(
305+
"Some telemetry may be sampled out because a default sampling configuration was added in version 3.4.0 to reduce the default billing cost. You can set the sampling configuration explicitly: https://learn.microsoft.com/azure/azure-monitor/app/java-standalone-config#sampling");
304306
}
305307
// only set role instance to host name as a last resort
306308
if (config.role.instance == null) {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ void warn(String message, Object... args) {
1717
messages.add(new Message(ConfigurationLogLevel.WARN, message, args));
1818
}
1919

20+
public void info(String message, Object... args) {
21+
messages.add(new Message(ConfigurationLogLevel.INFO, message, args));
22+
}
23+
2024
void debug(String message, Object... args) {
2125
messages.add(new Message(ConfigurationLogLevel.DEBUG, message, args));
2226
}
@@ -50,6 +54,12 @@ public void log(Logger logger, String message, Object... args) {
5054
logger.warn(message, args);
5155
}
5256
},
57+
INFO {
58+
@Override
59+
public void log(Logger logger, String message, Object... args) {
60+
logger.info(message, args);
61+
}
62+
},
5363
DEBUG {
5464
@Override
5565
public void log(Logger logger, String message, Object... args) {

0 commit comments

Comments
 (0)