Skip to content
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

Support system properties for the main "coordinates" #1813

Merged
merged 1 commit into from
Jul 26, 2021

Conversation

trask
Copy link
Member

@trask trask commented Jul 24, 2021

Resolves #1684

Supports system properties for the main "coordinates":

  • applicationinsights.connection.string
  • applicationinsights.role.name
  • applicationinsights.role.instance

Also logs warning if using undocumented APPLICATIONINSIGHTS_JMX_METRICS (planning to remove support for this undocumented env var in the future).

Also renames APPLICATIONINSIGHTS_PROFILER_ENABLED to APPLICATIONINSIGHTS_PREVIEW_PROFILER_ENABLED (cc: @johnoliver).

@@ -446,23 +459,48 @@ private static String getWebsiteSiteNameEnvVar() {
return value;
}

public static String overlayWithSysPropEnvVar(
String systemPropertyName, String envVarName, String defaultValue) {
String value = getSystemProperty(systemPropertyName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system properties have a higher precedence over env vars? should it be the other way around? env vars are user defined properties and i think it has a higher precedence over the default system properties, right? we do want to respect end user's choice?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system properties are also provided by end user

this precedence ordering is same as Spring (and OTel also follows same):

https://docs.spring.io/spring-boot/docs/2.5.2/reference/html/features.html#features.external-config

@trask trask merged commit e2cb452 into main Jul 26, 2021
@trask trask deleted the support-system-properties branch August 7, 2021 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set cloud role name using Java system property
2 participants