Skip to content

Support system properties for the main "coordinates"#1813

Merged
trask merged 1 commit into
mainfrom
support-system-properties
Jul 26, 2021
Merged

Support system properties for the main "coordinates"#1813
trask merged 1 commit into
mainfrom
support-system-properties

Conversation

@trask

@trask trask commented Jul 24, 2021

Copy link
Copy Markdown
Member

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).


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

Copy link
Copy Markdown
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
Copy Markdown
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