Skip to content

Commit

Permalink
Display a message about sampling at start-up (#3700)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanbisutti committed May 23, 2024
1 parent 66a687c commit 45d716e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ private static void overlayConfiguration(
// only fall back to default sampling configuration after all overlays have been performed
if (config.sampling.requestsPerSecond == null && config.sampling.percentage == null) {
config.sampling.requestsPerSecond = 5.0;
configurationLogger.info(
"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");
}
// only set role instance to host name as a last resort
if (config.role.instance == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ void warn(String message, Object... args) {
messages.add(new Message(ConfigurationLogLevel.WARN, message, args));
}

public void info(String message, Object... args) {
messages.add(new Message(ConfigurationLogLevel.INFO, message, args));
}

void debug(String message, Object... args) {
messages.add(new Message(ConfigurationLogLevel.DEBUG, message, args));
}
Expand Down Expand Up @@ -50,6 +54,12 @@ public void log(Logger logger, String message, Object... args) {
logger.warn(message, args);
}
},
INFO {
@Override
public void log(Logger logger, String message, Object... args) {
logger.info(message, args);
}
},
DEBUG {
@Override
public void log(Logger logger, String message, Object... args) {
Expand Down

0 comments on commit 45d716e

Please sign in to comment.