Giter Club home page Giter Club logo

applicationinsights-cpp's Introduction

[DEPRECATED] Application Insights SDK C++ - For UAP apps [DEPRECATED]

Introduction

This document describes how to integrate AppInsights into your projects and the APIs available to you.

Requirements:

This SDK will run on Windows C++ - VS 2015 UAP projects

Download:

  1. Download the ApplicationInsightsCpp.zip file.
  2. Unzip the folder to a location on your computer (i.e. c:\sdk). The folder contains static libs for debug and release and the *.h files.

Setup:

  1. In your project, in both release and debug mode, add the <sdk location>\ApplicationInsights\inc to the project properties -> VC++ Directories -> Include Directories
  2. In both release and debug, add AppInsights_Win10-UAP.lib to your project properties -> Link -> input -> additional dependencies
  3. In release:
    • add the <sdk location>\ApplicationInsights\lib\ <PLATFORM TYPE>\ release\AppInsights_Win10-UAP to the project properties -> VC++ Directories -> Library Directories
    • add <sdk location>\ApplicationInsights\lib\ <PLATFORM TYPE>\release\ApplicationInsights to project properties -> VC++ Directories -> Library WinRT Directories
  4. In debug:
    • add the <sdk location>\ApplicationInsights\lib\ <PLATFORM TYPE>\ debug\AppInsights_Win10-UAP to the project properties -> VC++ Directories -> Library Directories
    • add <sdk location>\ApplicationInsights\lib\ <PLATFORM TYPE>\debug\ApplicationInsights to project properties -> VC++ Directories -> Library WinRT Directories
  5. Add ApplicationInsights.winmd as a refernce to your project from <sdk location>\ApplicationInsights\lib\ <PLATFORM TYPE>\ <BUILD TYPE>\ApplicationInsights
  6. Add the AppInsights_Win10-UAP.dll from <sdk location>\ApplicationInsights\lib\ <PLATFORM TYPE>\ <BUILD TYPE>\AppInsights_Win10-UAP. Go to properties and set content to YES. This will copy the dll to your build directory.
  7. In App.xaml.h:
    • Add ApplicationInsights::CX::SessionTracking^ m_session;
  8. In your App.xaml.cpp:
    • add using namespace ApplicationInsights::CX;

    • In App:App()

       // this will do automatic session tracking and automatic page view collection
       m_session = ref new ApplicationInsights::CX::SessionTracking();
    • Once you have created the root Frame, (usually at the end of App::OnLaunched) initalize m_session

       String^ iKey = L"<YOUR INSTRUMENTATION KEY>";
       m_session->Initialize(this, rootFrame, iKey);
  9. To use tracking elsewhere in your application, you can declare an instance of Telemetry client.
    using namespace ApplicationInsights::CX;
    
    TelemetryClient^ tc = ref new TelemetryClient(L"<YOUR INSTRUMENTATION KEY>");
    tc->TrackEvent(L"I'M ON PAGE 1");
    tc->TrackMetric(L"Test Metric", 5.03);

APIs

/// <summary>
/// Initializes a new instance of the <see cref="TelemetryClient"/> class.
/// </summary>
/// <param name="iKey">The iKey.</param>
TelemetryClient(Platform::String^ iKey);

/// <summary>
/// Finalizes an instance of the <see cref="" /> class.
/// </summary>
/// <returns></returns>
virtual ~TelemetryClient();

/// <summary>
/// Tracks the event.
/// </summary>
/// <param name="eventName">Name of the event.</param>
void TrackEvent(Platform::String^ eventName);

/// <summary>
/// Tracks the trace.
/// </summary>
/// <param name="message">The message.</param>
void TrackTrace(Platform::String^ message);

/// <summary>
/// Tracks the metric.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
void TrackMetric(Platform::String^ name, double value);

/// <summary>
/// Tracks the page view.
/// </summary>
/// <param name="pageName">Name of the page.</param>
void TrackPageView(Platform::String^ pageName);

/// <summary>
/// Tracks the page view.
/// </summary>
/// <param name="pageName">Name of the page.</param>
/// <param name="duration">The duration.</param>
void TrackPageView(Platform::String^ pageName, Platform::String^ duration);

/// <summary>
/// Tracks the session start.
/// </summary>
void TrackSessionStart();

/// <summary>
/// Flushes this queue.
/// </summary>
void Flush();

/// <summary>
/// Disables all tracking.
/// </summary>
void DisableTracking();

/// <summary>
/// Enables all tracking.
/// </summary>
void EnableTracking();

/// <summary>
/// Renews the session.
/// </summary>
void RenewSession();

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.

applicationinsights-cpp's People

Contributors

captainnumerica avatar codingfrieda avatar crystk avatar keiichi-morisato avatar sergeykanzhelev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

applicationinsights-cpp's Issues

Missing link to download ApplicationInsightsCpp.zip?

The readme says to start by:

  1. Download the ApplicationInsightsCpp.zip file.
  2. Unzip the folder to a location on your computer (i.e. c:\sdk). The folder contains static libs for debug and release and the *.h files.

Where is the ApplicationInsightsCpp.zip file that contains those libs and headers?

Support DLL for C++

There are issues with the static library. In NT Service/COM solutions with dynamic linking to the CRT we get a linker error with respect to the static vs. dynamic multi-threaded CRT.
I propose we support both x64 and DLL as output.
#8

Where is the latest App Insights C++ SDK?

Hi team,

I'm looking into developing IIS native App Insights instrumentation - basically raise App Insights metrics inside IIS native modules instead of in ASP.NET modules, handlers, or apps. Therefore, I'm looking for App Insight C++ SDK, and found this project.

However, based on the project description, it looks like it has been deprecated. I'm wondering where can I find the latest C++ SDK for App Insights?

Thanks in advance,
Yanbing

Support UTF8 in the API

Majority of the servers use std::string as an envelope to store UTF8 strings. The current client API requires std::wstring which mandates a lot of string conversion. Ironically, the actual HTTPRequest uses char* internally. This seems a needless conversion.
I propose:

  • Add overloads to the existing API to support consumption and conversion of string to wstring
  • Use std::variant and convert to std::string for the props.

Add documentation and sample usage

Update the usage documentation to highlight how we can use the C++ project solution from Windows console based applications.

  • DLL import
  • nuget package

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.