From 114494b65881f022f654f9c440fa38b1ace17fe5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Jan 2018 21:52:21 +0000 Subject: [PATCH 1/2] Added AI --- pom.xml | 5 +++ .../azure/sample/AppInsightsConfig.java | 32 +++++++++++++++++++ src/main/resources/ApplicationInsights.xml | 28 ++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java create mode 100644 src/main/resources/ApplicationInsights.xml diff --git a/pom.xml b/pom.xml index 46815930..a1d86d7d 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,11 @@ spring-boot-starter-test test + + com.microsoft.azure + applicationinsights-web + [1.0,) + diff --git a/src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java b/src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java new file mode 100644 index 00000000..5bcba134 --- /dev/null +++ b/src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See LICENSE in the project root for + * license information. + */ +package com.microsoft.azure.sample; + +import javax.servlet.Filter; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.microsoft.applicationinsights.TelemetryConfiguration; +import com.microsoft.applicationinsights.web.internal.WebRequestTrackingFilter;; + + +@Configuration +public class AppInsightsConfig { + + @Bean + public FilterRegistrationBean aiFilterRegistration() { + final FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new WebRequestTrackingFilter()); + registration.addUrlPatterns("/**"); + registration.setOrder(1); + return registration; + } + + @Bean(name = "WebRequestTrackingFilter") + public Filter WebRequestTrackingFilter() { + return new WebRequestTrackingFilter(); + } +} diff --git a/src/main/resources/ApplicationInsights.xml b/src/main/resources/ApplicationInsights.xml new file mode 100644 index 00000000..080fb663 --- /dev/null +++ b/src/main/resources/ApplicationInsights.xml @@ -0,0 +1,28 @@ + + + + + + + put-your-instrumentation-key-here + + + + + + + + + + + + + + + + + + + + + From c8e39c91be9f51dae95119106e4695772669ae72 Mon Sep 17 00:00:00 2001 From: nicolehaugen79 Date: Mon, 22 Jan 2018 11:30:00 -0600 Subject: [PATCH 2/2] Added SDK logging --- src/main/resources/ApplicationInsights.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/resources/ApplicationInsights.xml b/src/main/resources/ApplicationInsights.xml index 080fb663..d26664ed 100644 --- a/src/main/resources/ApplicationInsights.xml +++ b/src/main/resources/ApplicationInsights.xml @@ -2,9 +2,15 @@ - + put-your-instrumentation-key-here + + + + + ALL +