-
Notifications
You must be signed in to change notification settings - Fork 205
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
The configuration file present in the same directory as the agent is not being picked-up in 3.4.16 #3283
Comments
@petrica can you share your full applicationinsights.json? you can redact data that you don't want to share. |
Sure! However it's worth noting that the configuration file is being picked-up successfully if I use the {
"instrumentation": {
"logging": {
"level": "ALL"
},
"micrometer": {
"enabled": false
},
"springScheduling": {
"enabled": false
}
},
"sampling": {
"percentage": 100
},
"preview": {
"captureLoggingLevelAsCustomDimension": true,
"captureHttpServer4xxAsError": false,
"captureLogbackMarker": true,
"captureLog4jMarker": true,
"instrumentation": {
"apacheCamel": {
"enabled": true
}
},
"sampling": {
"overrides": [
{
"telemetryType": "request",
"attributes": [
{
"key": "http.url",
"value": "https?://[^/]+/actuator.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "dependency",
"attributes": [
{
"key": "db.system",
"value": ".*",
"matchType": "regexp"
}
],
"percentage": 10
},
{
"telemetryType": "trace",
"attributes": [
{
"key": "thread.name",
"value": ".*redacted.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "trace",
"attributes": [
{
"key": "logback.mdc.redacted.contextId",
"value": "redacted.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "trace",
"attributes": [
{
"key": "thread.name",
"value": "Redacted.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "trace",
"attributes": [
{
"key": "thread.name",
"value": "redacted.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "trace",
"attributes": [
{
"key": "logback.mdc.type",
"value": "redactedA|redactedB",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "trace",
"attributes": [
{
"key": "discard",
"value": ".*",
"matchType": "regexp"
}
],
"percentage": 0
}
]
},
"processors": [
{
"type": "log",
"body": {
"toAttributes": {
"rules": [
"(?<discard>Redacted text to extract from log.*)"
]
}
}
},
{
"type": "metric-filter",
"exclude": {
"matchType": "regexp",
"metricNames": [
".*redactedA.*",
".*redactedB.*",
".*redactedC.*"
]
}
}
]
},
"selfDiagnostics": {
"destination": "console",
"level": "INFO"
},
"metricIntervalSeconds": 900
} Thank you! |
That implies that your json config is valid. please turn on debug logging by adding the following to your applicationinsights.json: { |
Yes, I have tested various scenarios, without the env variable the file is not being picked up. If a revert the agent to 3.4.15, under the same setup the config file is being picked up. |
@petrica i tested it myself. it picked up json config using 3.4.16. can you also help me check this?
Additionally, how do you attach java agent by running |
The applications run under Kubernetes, that was an oversight from my side. It seem that the
I believe an INFO log line that informs the developer that the default configuration will not be loaded because the DiagnosticsHelper.isRpIntegration() returns true. private static Configuration loadConfigurationFile(Path agentJarPath) {
String configurationContent = getEnvVar(APPLICATIONINSIGHTS_CONFIGURATION_CONTENT);
if (configurationContent != null) {
return getConfigurationFromEnvVar(configurationContent);
}
Configuration configFromProperty = extractConfigFromProperty(agentJarPath);
if (configFromProperty != null) {
return configFromProperty;
}
String runtimeAttachedConfigurationContent =
getSystemProperty(APPLICATIONINSIGHTS_RUNTIME_ATTACHED_CONFIGURATION_CONTENT);
if (runtimeAttachedConfigurationContent != null) {
return getConfiguration(runtimeAttachedConfigurationContent, JsonOrigin.RUNTIME_ATTACHED);
}
if (DiagnosticsHelper.isRpIntegration()) {
// users do not have write access to agent directory in rp integrations
// and rp integrations should not use applicationinsights.json because that makes it difficult
// to merge rp intent and user intent
return new Configuration();
}
Configuration configFromJsonNextToAgent = extractConfigFromJsonNextToAgentJar(agentJarPath);
if (configFromJsonNextToAgent != null) {
return configFromJsonNextToAgent;
}
// json configuration file is not required, ok to configure via env var alone
return new Configuration();
} The solution is to use other methods of providing the configuration content. |
I will test 3.4.16 in an AKS environment. Thanks! |
Expected behavior
Default configuration file
applicationinsights.json
present in the same directory as the agent should be automatically picked-up by the agent when the application starts.Actual behavior
The default application insights configuration is being applied and the configuration file is being ignored.
To Reproduce
APPLICATIONINSIGHTS_CONFIGURATION_FILE
System information
Please provide the following information:
Logs
The text was updated successfully, but these errors were encountered: