Skip to content

isaac84/ApplicationInsights-Java

 
 

Repository files navigation

ApplicationInsights-Java

Introduction

This is the repository of the Java SDK for Visual Studio Application Insights. Application Insights is a service that monitors the availability, performance and usage of your application. The SDK sends telemetry about the performance and usage of your app to the Application Insights service where your data can be visualized in the Azure Portal. The SDK automatically collects telemetry about HTTP requests, dependencies, and exceptions. You can also use the SDK to send your own events and trace logs.

Please refer to:

Prerequisites

  1. Java SDK 1.6 or higher
  2. Sign-in to Microsoft Azure

Getting started

  1. Set JAVA_HOME environment variable to point to the JDK installation directory.
  2. To build run ./gradlew build on Linux systems or gradlew.bat build on Windows systems.

Using Eclipse IDE

  1. Install gradle from http://www.gradle.org/installation
  2. Add GRADLE_HOME/bin to your PATH environment variable
  3. In build.gradle add line [apply plugin: "eclipse"]
  4. In Eclipse used File->Import Existing Project in a workspace.
  5. Use [gradle build] to build the project from the command line.

CollectD Plugin - Optional

To build Application Insights CollectD writer plugin, please do the following:

  1. Download CollectD Java API sources and compile them using JDK 1.6. The output jar should be named: 'collectd-api.jar'. More info on compiling CollectD sources can be found here: https://collectd.org/dev-info.shtml
  2. Create a new directory for CollectD library you just created, and set a new environment variable 'COLLECTD_HOME' pointing to that folder.
  3. Copy the new jar into %COLLECTD_HOME%/lib
  4. Reload Application Insights project. CollectD writer plugin sub-project should now be loaded. IDE restart may be required in order to identify the new environment variable.

Notes

  • To create a Java 6 compatible build you need to either have JAVA_HOME point to "Java 6 SDK" path or set JAVA_JRE_6 environment variable to point to [JRE 6 JRE installation directory]
  • To enable Windows Performance Counters you need to install the Visual Studio 2013 C++ Redistributable (or higher)

To upgrade to the latest SDK

After you upgrade, you'll need to merge back any customizations you made to ApplicationInsights.xml. Take a copy of it to compare with the new file.

If you're using Maven or Gradle

  1. If you specified a particular version number in pom.xml or build.gradle, update it.
  2. Refresh your project's dependencies.

Otherwise

Compare the old and new ApplicationInsights.xml. Many of the changes you see are because we added and removed modules. Reinstate any customizations that you made.

##Release Notes

Version 1.0.7

  • Use Shadow plugin to create self contained JAR files in the SDK
  • Allow marking a metric as custome performance counter. See here
  • Better support for Visual Studio Code for edting the Application Insights Java SDK Code
  • Added sampling support. See here
  • Allow changing the performance counter collection frequency and added hooks before and after sending the PC see here and here
  • Agent built-in types are now off by default. Support wildcard to monitor multiple classes in the agent.
  • Add depenecy type in the agent configuration see here

Version 1.0.6

Version 1.0.5

Version 1.0.4

  • Interim version replaced by 1.0.5 on August 2016

Version 1.0.3

  • Align to a new BOND schema used by the Application Insights data collection endpoints.

Version 1.0.2

  • Prevent from overriding the instrumentation key using the one specified in the config when it's provided explicitly in code.
  • Handle all successfull HTTP status codes and report the relevant HTTP Requests as successful.
  • Handle all exceptions thrown by the ConfigurationFileLocator .

Version 1.0.1

  • The Java agent collects dependency information about the following:
    • HTTP calls made via HttpClient, OkHttp and RestTemplate (Spring).
    • Calls to Redis made via the Jedis client. When a configurable threshold is passed, the SDK will also fetch the call arguments.
    • JDBC calls made with Oracle DB and Apache Derby DB clients.
    • Support the 'executeBatch' query type for prepared statements – The SDK will show the statement with the number of batches.
    • Provide the query plan for JDBC clients that has support for that (MySql, PostgreSql) – The query plan is fetched only when a configurable threshold is crossed

Version 1.0.0

  • Adding support for the Application Insights writer plugin for CollectD.
  • Adding support for the Application Insights Java agent.
  • Fix for a compatibility issue with supporting HttpClient versions 4.2 and later.

Version 0.9.6

  • Make the Java SDK compatible with servlet v2.5 and HttpClient pre-v4.3.
  • Adding support for Java EE interceptors.
  • Removing redundant dependencies from the Logback appender.

Version 0.9.5

  • Fix for an issue where custom events are not correlated with Users/Sessions due to cookie parsing errors.
  • Improved logic for resolving the location of the ApplicationInsights.xml configuration file.
  • Anonymous User and Session cookies will not be generated on the server side. To implement user and session tracking for web apps, instrumentation with the JavaScript SDK is now required – cookies from the JavaScript SDK are still respected. Note that this change may cause a significant restatement of user and session counts as only user-originated sessions are being counted now.

Version 0.9.4

  • Support collecting performance counters from 32-bit Windows machines.
  • Support manual tracking of dependencies using a new trackDependency method API.
  • Ability to tag a telemetry item as synthetic, by adding a SyntheticSource property to the reported item.

##Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Packages

No packages published

Languages

  • Java 99.5%
  • Other 0.5%