Skip to content
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

Support Azure Application Insights #441

Closed
jkschneider opened this issue Feb 19, 2018 · 13 comments
Closed

Support Azure Application Insights #441

jkschneider opened this issue Feb 19, 2018 · 13 comments
Milestone

Comments

@jkschneider
Copy link
Contributor

See https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#trackmetric

@jkschneider jkschneider added this to the 1.1.0 milestone Feb 19, 2018
@jkschneider
Copy link
Contributor Author

A client that can be wrapped: http://search.maven.org/#artifactdetails%7Ccom.microsoft.azure%7Capplicationinsights-core%7C2.0.0-BETA%7Cjar

Note that the 2.0.0-BETA version contains first order dependencies on guava and httpclient.

@codefromthecrypt
Copy link

cc @SergeyKanzhelev

@SergeyKanzhelev
Copy link

There is a raw API for this as well: http://apmtips.com/blog/2017/10/27/send-metric-to-application-insights/ But implementing it via wrapper would be better.

@jkschneider are those dependencies problematic in this repo?

@spencergibb
Copy link
Collaborator

@SergeyKanzhelev in general they are, since an application might depend on an incompatible version of the same library. Shading is appropriate for those kinds of libraries.

@SergeyKanzhelev
Copy link

I believe there is a plan to shade them. @grlima @dhaval24 can you comment when those will be shaded?

@jkschneider
Copy link
Contributor Author

@SergeyKanzhelev I actually had a chat with @dhaval24 about this yesterday. He indicated that they are relocated inside the package, so just need to strike the dependencies from the POM probably.

@dhaval24
Copy link
Contributor

@jkschneider yes that is true. They are relocated inside core and web jars. As we talked yesterday I have some ideas around this. Let's touch base again soon and understand how we can get this done.

@dhaval24
Copy link
Contributor

dhaval24 commented Mar 4, 2018

@jkschneider few things to point out:

  1. Application Insights Java SDK is composed of 3 parts - core, web and Agent.
  2. Core is the bare bone track() API which is responsible for ultimately transmitting the telemetry data to Application Insights backend service. It does all the processing, including batching of telemetry items. Web is used to auto collect requests by intercepting it using Servlet Filters and Agent is used to auto-collect Dependencies using byte code instrumentation.

For creating an exporter to send metrics to Application Insights, we would only need to wrap ApplicationInsights-core library. The main Data Structure which holds the Metric Telemetry is MetricTelemetry.java. This class is composed of MetricData and DataPoint. MetricData holds the list of DataPoints and DataPoints consist of metric related properties like avg, standard deviation etc.

TelemetryConfiguration.java is the configuration class for ApplicationInsights and stores the ikey to publish data to Azure and TelemetryClient.java has all the definition of track() methods including
void trackMetric(String name, double value, int sampleCount, double min, double max, Map<String, String> properties) , void trackMetric(String name, double value) and void trackMetric(MetricTelemetry telemetry)`. All the Spring Metrics would go as custom metrics to AI.

I believe this would be the required pieces for this exporter. We would need to do some transformations to achieve this according to the backend schema. Let me know how would you think is the best way to proceed.

@jkschneider
Copy link
Contributor Author

jkschneider commented Mar 5, 2018

@dhaval24 A stub for Azure exists here.

@jkschneider
Copy link
Contributor Author

When you're ready to test, navigate to SampleConfig and change it to SampleRegistries.azure(..) rather than SampleRegistries.jmx(). Then you can test each metric type one at a time (e.g. GaugeSample, CounterSample, TimerSample).

@jkschneider
Copy link
Contributor Author

@dhaval24
Copy link
Contributor

dhaval24 commented Mar 5, 2018

@jkschneider thank you very much for sending all this out. I would take a look at this.

@dhaval24
Copy link
Contributor

dhaval24 commented Apr 7, 2018

@spencergibb and @jkschneider the POM for application insights is now fixed and it does not reference any of the dependencies like Guava / HttpClient. They are shaded and excluded from the POM now.

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

No branches or pull requests

5 participants