-
Notifications
You must be signed in to change notification settings - Fork 205
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
Spring initialization not working? #273
Comments
Thanks, We're looking into it. |
Here you go: <?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>[[obfuscated]]</InstrumentationKey>
<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>
</ApplicationInsights> I am initalizing on the main class like this: @SpringBootApplication(scanBasePackages = {"my.package", "com.microsoft.applicationinsights.web.spring"}) During the start up phase I only got this message:
I am uncertain whether I can get more, I was not looking into this at all. If there is a way to get more, just tell me how. It seems like there is no data being send, no metrics for any of my HTTP methods. When I tried to debug what I've found is that in the I was able to send my own, custom telemetry though... |
Thanks a lot! |
No, I am not using a filter. Spring configuration, if I understood that correctly, requires only to register a configuration bean, specifically: @EnableWebMvc
@Configuration
public class InterceptorRegistry extends WebMvcConfigurerAdapter {
@Override
public void addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry) {
registry.addInterceptor(new RequestNameHandlerInterceptorAdapter());
}
} This is far from perfect IMO. It requires me to use a trick by providing a wider scanning classpath like this: @SpringBootApplication(scanBasePackages = {"my.package", "com.microsoft.applicationinsights.web.spring"}) It would be much more efficient if you could provide a simple annotation, as pretty much any Spring related library, in a form of: @EnableApplicationInsights That should be way more efficient and is much closer to what all Spring related libraries are doing for a long time now. Happy to do that for you. Although I still do not know why When it comes to the system files - I am using MacOSX 10.11.2 as my development OS and I do not have `/proc/ folder on my machine. It seems like your library have no support for this operating system, which is fine by me - I won't run my app on MacOSX anyway, just developing on this machine... |
Yes, using the filter is currently the the way to go. And yes, we know that it should be configurable in an easier way and definitely annotation is a good choice. This is on our backlog and I hope we can get to it soon enough |
OK, hold on - the interceptor should have pretty much the same functionality as filter. I would prefer to avoid using technology which is not Spring oriented. So the only way to go is with filter? Then one should update official docs, since they suggest using the interceptor alone... |
Hi guys. I have the same issue. Can you suggest how to configure this via interceptors? UPDATE: The documentation https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-get-started states that it is possible to configure it using interceptors, but in fact it seems not... |
Hi guys |
@sudhanshu20 can you please create a seperate issue with the details of the behavior your application is facing. The InterceptorRegistry is still present which has @EnableWebMvc still there. w It would be great if you can create a seperate issue for follow up on this with more details of exact behavior in the system. |
Created new issue #712 |
While initializing the
RequestNameHandlerInterceptorAdapter
I can't make it to work automatically as described. I am using annotation based config, but still the reaction is somewhat blank:If I will manually call
TelemetryConfiguration.getActive()
it will work like a charm...Is this a correct way and I need to manually initialize ApplicationInisights? Or am I missing something else...
The text was updated successfully, but these errors were encountered: