From 2165c99ef36d20e93b3a04a78863e98d5c9536b6 Mon Sep 17 00:00:00 2001 From: hfilmore <156826086+hfilmore@users.noreply.github.com> Date: Wed, 23 Apr 2025 10:44:54 +0100 Subject: [PATCH] Update README.md with app-insight-connection-key --- java-logging-appinsights/README.md | 43 +++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/java-logging-appinsights/README.md b/java-logging-appinsights/README.md index 97429870..2366bf53 100644 --- a/java-logging-appinsights/README.md +++ b/java-logging-appinsights/README.md @@ -18,7 +18,16 @@ repositories { } dependencies { - implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: '6.1.2' + implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: '6.1.8' +} +``` + +Note: if you're on an older version of Spring Boot you may need to bring it and the logging-spring libraries in on deprecated versions: +```groovy +dependencies { + implementation group: 'com.github.hmcts', name: 'java-logging', version: '6.1.8' + implementation group: 'com.github.hmcts.java-logging', name: 'logging-spring', version: '5.1.9' + implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: '5.1.9' } ``` @@ -48,16 +57,36 @@ Retrieve the jar from github, i.e. https://github.com/Microsoft/ApplicationInsig TelemetryClient can be `autowired` to implement custom telemetry metrics. -#### Provide Instrumentation Key +#### Provide App Insights Connection Key +Microsoft ended support for Instrumentation Key Ingestion on March 31, 2025. -Set the environment variable: AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY. If you are deploying using the CNP pipeline this will be automatically added for you. +An app-insight-connection-key is provided in the Key Vault Secrets. (Note: It's sometimes spelled app-insights-connection-key.) -You can also set it using a spring property (useful for tests): +Add to your projects secrets in cnp-flux-config: +``` +- name: app-insight-connection-key + alias: app-insight-connection-key +``` -```properties -azure.application-insights.instrumentation-key= +On your project: +1. Add a applicationinsights.json file with connection key path in the lib/ directory ``` -### Configuration defaults +{ + "connectionString": "${file:/mnt/secrets/adoption/app-insight-connection-key}", + "role": { + "name": "HMCTS MyProject" + } +} +``` +More information: https://docs.azure.cn/en-us/azure-monitor/app/java-standalone-config + +2. Add a step in your Dockerfile to move the new applicationinsights.json file to the correct location: +``` +COPY lib/applicationinsights.json /opt/app/ +``` + + +### Optional Configuration defaults #### Modules configured by spring starter