Comments (14)
Thank you @jeanbisutti, removing the connectionString property helped.
from applicationinsights-java.
@mercer I have done some tests and have not noticed any issue with com.microsoft.azure:applicationinsights-runtime-attach:3.5.2
.
You have provided this error:
Description:
Error loading connection string from a file ("unknown-from-application-insights-json").
Please use this format instead:
{ "connectionString": "${file:connection-string-file.txt}" }
It could be explained by this JSON config you have provided:
{
"connectionString": "unknown-from-application-insights-json",
Could you please check your connection string and retest if something wrong is noticed?
from applicationinsights-java.
@mercer The error messages are misleading. Sorry about that. See #3709
from applicationinsights-java.
I have two issues with this
- Isn't this a breaking change that APPLICATIONINSIGHTS_CONNECTION_STRING no longer works with a connection string and now requires a file path? 3.5.x is a minor, not a major semaversion
- Documentation has not change, it states that APPLICATIONINSIGHTS_CONNECTION_STRING can be used to provide the connection string at runtime via spring boot's override option
from applicationinsights-java.
In #3709, only the error message that could be misleading has changed. It does not affect the connection string features.
from applicationinsights-java.
Then I'd expect my setup to work in 3.5.x just as in 3.4.x, but it doesn't. If you need more details in this ticket, let me know 🙏
from applicationinsights-java.
Could you enable the self-diagnostics at the TRACE
level (https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-config#self-diagnostics) and send the applicationinsights.log
file to [email protected]?
from applicationinsights-java.
@mercer any luck here? we'd love to understand if something broke in 3.5.x
from applicationinsights-java.
build.gradel that works
plugins {
id "io.franzbecker.gradle-lombok" version "5.0.0"
id "org.springframework.boot" version "2.7.18"
id "org.sonarqube" version "4.0.0.2929"
id "org.owasp.dependencycheck" version "8.1.2"
id "com.github.johnrengelman.shadow" version "8.1.0"
}
repositories {
mavenCentral()
maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local/" }
}
apply plugin: "java"
apply plugin: "jacoco"
apply plugin: "io.spring.dependency-management"
group = "com.redacted"
version = project.getProperty("version")
sourceCompatibility = "17"
jacoco {
toolVersion = "0.8.8"
reportsDirectory = file("$buildDir/customJacocoReportDir")
}
jacocoTestReport {
reports {
xml.required = true
csv.required = false
html.outputLocation = file("${buildDir}/jacocoHtml")
}
}
test.finalizedBy jacocoTestReport
lombok { // optional: values below are the defaults
version = "1.18.24"
sha256 = "d3584bc2db03f059f984fb0a9c119aac1fa0da578a448e69fc3f68b36584c749"
}
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:2.7.18"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.3"
}
dependencies {
// these dependencies are not in spring boot or spring cloud BOMs
dependency("org.springframework.boot:spring-boot-starter-batch:2.7.18") //addresses CVE-2023-20873, CVE-2023-20883, CVE-2023-34034
dependency("com.microsoft.azure:applicationinsights-runtime-attach:3.4.19")
dependency("io.opentelemetry:opentelemetry-sdk:1.38.0")
dependency("com.azure.spring:spring-cloud-azure-starter-keyvault-secrets:4.16.0")
dependency("com.azure:azure-messaging-servicebus:7.15.2")
dependency("org.springdoc:springdoc-openapi-webmvc-core:1.7.0")
dependency("org.springdoc:springdoc-openapi-security:1.7.0")
dependency("org.springdoc:springdoc-openapi-ui:1.7.0")
dependency("com.sun.xml.bind:jaxb-core:2.3.0.1")
dependency("com.sun.xml.bind:jaxb-impl:2.3.3")
dependency("org.owasp:security-logging-logback:1.1.7")
dependency("org.apache.commons:commons-text:1.10.0")
dependency("com.c4-soft.springaddons:spring-security-test-oauth2-addons:1.2.0")
dependency("org.powermock:powermock-reflect:2.0.9")
dependency("com.frejo:force-rest-api:0.0.44")
dependency("net.javacrumbs.shedlock:shedlock-spring:4.34.0")
dependency("net.javacrumbs.shedlock:shedlock-provider-jdbc-template:4.34.0")
dependency("com.microsoft.sqlserver:mssql-jdbc_auth:10.2.1.x64")
dependency("com.vladmihalcea:hibernate-types-52:2.12.1")
dependency("com.launchdarkly:launchdarkly-java-server-sdk:5.9.0")
dependency("com.google.guava:guava:33.1.0-jre") // fix for CVE-2023-2976
dependency("com.google.code.gson:gson:2.10.1")
dependency("commons-io:commons-io:2.15.1")
// these dependencies are in spring boot, but downgraded to fix a compatibility issue
dependency("com.h2database:h2:1.4.200")
//these dependencies overwrite the default bom, please review and remove after upgrading spring boot:
dependency("org.yaml:snakeyaml:2.0") // fix for CVE-2022-1471
dependency("com.fasterxml.jackson.core:jackson-core:2.15.0") // fix for CVE-2022-1471
dependency("org.liquibase:liquibase-core:4.25.1") // fix for CVE-2022-1471
dependency("org.springframework.security:spring-security-core:5.7.12") // fix for CVE-2016-1000027
dependency("org.springframework:spring-web:5.3.33") //fix for CVE-2024-22243, CVE-2024-22259, CVE-2016-1000027
dependency("ch.qos.logback:logback-core:1.2.13") // fix for CVE-2023-6481
dependency("ch.qos.logback:logback-classic:1.2.13") // fix CVE-2023-6378
dependency("io.netty:netty-codec-http:4.1.108.Final") // fix CVE-2024-29025
}
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-validation')
implementation("com.azure.spring:spring-cloud-azure-starter-keyvault-secrets")
implementation("com.microsoft.azure:applicationinsights-runtime-attach")
implementation("io.opentelemetry:opentelemetry-sdk")
implementation("org.springframework.cloud:spring-cloud-starter-sleuth")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-hateoas")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-batch")
implementation("org.springframework.security:spring-security-oauth2-jose")
implementation("org.springframework.security:spring-security-oauth2-resource-server")
implementation("org.liquibase:liquibase-core")
implementation("org.springdoc:springdoc-openapi-webmvc-core")
implementation("org.springdoc:springdoc-openapi-security")
implementation("org.springdoc:springdoc-openapi-ui")
implementation("com.sun.xml.bind:jaxb-impl")
implementation("com.sun.xml.bind:jaxb-core")
implementation("com.azure:azure-messaging-servicebus") {
exclude group: "org.slf4j", module: "slf4j-log4j12"
}
implementation("org.owasp:security-logging-logback")
implementation("com.frejo:force-rest-api")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-csv")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.apache.httpcomponents:httpclient")
implementation("org.apache.commons:commons-text")
implementation("net.javacrumbs.shedlock:shedlock-spring")
implementation("net.javacrumbs.shedlock:shedlock-provider-jdbc-template")
implementation('com.vladmihalcea:hibernate-types-52')
implementation('org.hibernate:hibernate-core')
implementation('com.launchdarkly:launchdarkly-java-server-sdk')
implementation('org.apache.commons:commons-lang3')
implementation('com.google.guava:guava')
implementation('com.google.code.gson:gson')
implementation('commons-io:commons-io')
implementation("io.netty:netty-codec-http")
runtimeOnly("com.microsoft.sqlserver:mssql-jdbc")
if (System.getProperty('env') == 'dev') {
runtimeOnly("com.h2database:h2")
} else {
testImplementation("com.h2database:h2")
}
testImplementation("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("org.springframework.boot:spring-boot-starter-web") {
exclude group: "junit", module: "junit"
}
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude group: "junit", module: "junit"
exclude group: "org.junit.vintage", module: "junit-vintage-engine"
}
testImplementation("com.c4-soft.springaddons:spring-security-test-oauth2-addons") {
exclude group: "junit", module: "junit"
}
testImplementation("org.awaitility:awaitility") {
exclude group: "junit", module: "junit"
}
testImplementation("org.powermock:powermock-reflect") {
exclude group: "junit", module: "junit"
}
}
dependencyCheck {
suppressionFile = "$projectDir/owasp-suppression.xml"
}
test {
useJUnitPlatform()
maxHeapSize = "4096m"
}
shadowJar {
zip64 true
}
build.gradle that doesn't work
......
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:2.7.18"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.3"
}
dependencies {
// these dependencies are not in spring boot or spring cloud BOMs
dependency("org.springframework.boot:spring-boot-starter-batch:2.7.18") //addresses CVE-2023-20873, CVE-2023-20883, CVE-2023-34034
dependency("com.microsoft.azure:applicationinsights-runtime-attach:3.5.3")
.............
App log output when it starts, only tested locally, the only change is the upgrade from 3.4.19 to 3.5.3.
/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/bin/java -XX:TieredStopAtLevel=1 -Dspring.profiles.active=dev-personal -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dmanagement.endpoints.jmx.exposure.include=* -javaagent:/Users/emilian/Applications/IntelliJ IDEA Ultimate.app/Contents/lib/idea_rt.jar=54330:/Users/emilian/Applications/IntelliJ IDEA Ultimate.app/Contents/bin -Dfile.encoding=UTF-8 @/private/var/folders/lb/vq9z2h5j1ygcq4mlym46pfp00000gn/T/idea_arg_file1879499461 com.redacted.RedactedApiSpringBoot
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
*************************
Application Insights Java Agent 3.5.3 startup failed (PID 48831)
*************************
Description:
Your connection string seems to have a wrong format: "unknown-from-application-insights-json").
If you want to load the connection string from a file, please use this format:
{ "connectionString": "${file:connection-string-file.txt}" }
Action:
Learn more about configuration options here: https://go.microsoft.com/fwlink/?linkid=2153358
from applicationinsights-java.
With 3.4.19 I see this applicationinsights.log
2024-06-05 16:27:59.395+03:00 INFO c.m.applicationinsights.agent - Application Insights Java Agent 3.4.19 started successfully (PID 49245, JVM running for 1.627 s)
2024-06-05 16:27:59.399+03:00 INFO c.m.applicationinsights.agent - Java version: 17.0.7, vendor: Azul Systems, Inc., home: /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
from applicationinsights-java.
HI @mercer,
Sorry for the delay. I was off.
I had tried with a Petclinic application and Application Insights Runtime Attach 3.5.2 without observing any issue.
To be able to help you, could you please point to a Github repository reproduding the issue or send by email the Application Insights logs at the TRACE level as previously asked?
from applicationinsights-java.
I can confirm what @mercer mentioned. APPLICATIONINSIGHTS_CONNECTION_STRING works with 3.4.19 but not with 3.5.x.
from applicationinsights-java.
Hi @mercer and @Cloud5000
I have retested the Petclinic application with the Runtime Attachment feature and with the APPLICATIONINSIGHTS_CONNECTION_STRING
environment variable. I can see the telemetry data on the Azure portal with the 3.5.2 and 3.5.3 versions.
The only way to reproduce the same error message seen by @mercer is to use an invalid connection string in the applicationinsights.json file:
*************************
Application Insights Java Agent 3.5.3 startup failed (PID 4336)
*************************
Description:
Your connection string seems to have a wrong format: "unknown-from-application-insights-json").
If you want to load the connection string from a file, please use this format:
{ "connectionString": "${file:connection-string-file.txt}" }
Could you please remove the following connection string from the applicationinsights.json file:
{
"connectionString": "unknown-from-application-insights-json"
}
from applicationinsights-java.
Ok, but this is a regression. As this is semver, a minor version change should not introduce a breaking change.
from applicationinsights-java.
Related Issues (20)
- SFTP dependency tree not available with applicationinsights-agent-3.5.2 HOT 5
- Connection String with `ApplicationId` crashes SDK 3.4.19 HOT 1
- MsSql dependency tree not available with applicationinsights-agent-3.5.2 HOT 3
- Not all exceptions are populated with exception type and message HOT 10
- Workflow failed: OWASP dependency check (daily) (#650) HOT 37
- Current version 3.5.3 has 1 CVE: CVE-2024-35255
- Connection refused: eastasia-0.in.applicationinsights.azure.com/[0:0:0:0:0:0:0:0]:443 HOT 2
- APPLICATIONINSIGHTS_CONFIGURATION_CONTENT will not be considered in Azure Functions HOT 11
- Should there be constructor with URL argument too? HOT 2
- Sampling overrides with multiple telemetry types, with different default sampling rates HOT 8
- Multiple TelemetryClients With Different Connection Strings in Same Application HOT 3
- Codeless Agent 3.5.4 - Multiple requests are getting combined at child HTTP process instead of parent Parent HTTP flow HOT 3
- Multi line log messages with a stack trace cannot be queried HOT 2
- Gradle module metadata is not published to Maven Central, while POM file does advertise it HOT 2
- Certificate-based AD authentication HOT 4
- Failure connecting with secret behind the proxy HOT 6
- Handled / catched exceptions are getting into Azure Application Insights HOT 2
- HTTP trace collection stopped after upgrade to App Insights 3.5.4 for application based on Spring Boot 3.3.1 HOT 4
- question - how to instrument Apache Wink Client or older REST clients? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from applicationinsights-java.