Skip to content

Feature Request: Support for Loading applicationinsights.json from Current Working Directory (CWD) #3989

@antoine71

Description

@antoine71

Feature Request: Support for Loading applicationinsights.json from Current Working Directory (CWD)

Is your feature request related to a problem? Please describe.

I am always frustrated when integrating the Azure Application Insights Java agent with Spring Boot programmatically because the agent requires the applicationinsights.json configuration file to be located in the classpath unless explicitly specified via -Dapplicationinsights.configuration.file.

Spring Boot developers typically externalize configuration files by placing them in the current working directory (CWD), expecting the application to pick them up automatically, as is standard with Spring Boot's configuration handling. However, the agent does not consider the CWD, creating additional setup complexity and inconsistency with Spring Boot’s conventions.


Describe the solution you would like

I would like the Azure Application Insights agent to include the current working directory (CWD) as a valid location for the applicationinsights.json file when programmatically enabling the agent with Spring Boot.

The resolution order could follow these steps:

  1. Check for applicationinsights.json in the current working directory (CWD).
  2. Fall back to looking in the classpath.

This behavior would align with Spring Boot’s configuration resolution strategy and make integration more intuitive and consistent for developers.


Describe alternatives you have considered

1. Explicitly Setting the Configuration Path

Using System.setProperty("applicationinsights.configuration.file", "/path/to/applicationinsights.json") works but requires additional manual steps and maintenance.

2. Bundling the Configuration File in the Classpath

Placing applicationinsights.json in the classpath works but is less practical for dynamic deployments, as the configuration file often varies between environments.


Additional context

Spring Boot supports loading configuration files (e.g., application.properties or application.yml) from the current working directory by default, allowing users to place environment-specific configurations alongside the application JAR.

Matching this behavior for applicationinsights.json when programmatically enabling the Azure Application Insights agent would make it easier for Spring Boot users to integrate the agent into their applications seamlessly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions