-
Notifications
You must be signed in to change notification settings - Fork 252
Added AI #35
base: ai
Are you sure you want to change the base?
Added AI #35
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well have you tried to instrument Application Insights Agent to collect dependencies in this application? Probably if you would like to collect the calls to documentDB (unfortunately not autocollected now) or other dependencies like HTTP outgoing via Apache HTTP, Redis etc. you would need to put a "name of type string representing application name" as a parameter to WebRequestTrackingFilter() . Feel free to ask for more details There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we discussed, there is a bug that is blocking this - I logged an issue to add dependency tracking when the bug is fixed: #36 |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30"> | ||
|
||
|
||
<!-- The key from the portal --> | ||
|
||
<InstrumentationKey>put-your-instrumentation-key-here</InstrumentationKey> | ||
|
||
<!-- Turn on logging in the IDE console windows to view Application Insights logging --> | ||
|
||
<SDKLogger> | ||
<Level>ALL</Level> | ||
</SDKLogger> | ||
|
||
<!-- HTTP request component (not required for bare API) --> | ||
|
||
<TelemetryModules> | ||
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebRequestTrackingTelemetryModule"/> | ||
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebSessionTrackingTelemetryModule"/> | ||
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebUserTrackingTelemetryModule"/> | ||
</TelemetryModules> | ||
|
||
<!-- Events correlation (not required for bare API) --> | ||
<!-- These initializers add context data to each event --> | ||
|
||
<TelemetryInitializers> | ||
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationIdTelemetryInitializer"/> | ||
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationNameTelemetryInitializer"/> | ||
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebSessionTelemetryInitializer"/> | ||
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserTelemetryInitializer"/> | ||
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserAgentTelemetryInitializer"/> | ||
|
||
</TelemetryInitializers> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest adding Tag so customers can see AI logs also in-case SDK behaves in a funky way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it necessary to add a switch so that user could disable ai data collecting? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The intention of this version of the sample is to show collecting AI data, so I don't feel that is necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yungez I don't think adding a switch would make sense as the purpose of the demo app as Nicole said is to show the use case of multiple azure services in java with azure monitoring capabilities with AI. |
||
</ApplicationInsights> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update version to 2.0.0-BETA for now and later to [2.0.,) once stable version is out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolehaugen79 I still see the dependency version as [1.0,). Did you missed changing to 2.0.0-BETA ?