Coder Social home page Coder Social logo

appdynamics / iot-cpp-sdk Goto Github PK

View Code? Open in Web Editor NEW
5.0 8.0 6.0 438 KB

Appdynamics IoT C++ SDK to monitor performance of embedded applications on connected devices

License: Apache License 2.0

CMake 2.47% C 9.23% C++ 88.30%
iot performance performance-monitoring embedded-devices connected-car connected-factory connected-home smart-cities smart-tv set-top-box

iot-cpp-sdk's Introduction

AppDynamics IoT C++ SDK

Build Status

Overview

This repository contains AppDynamics IoT C++ SDK that can be used in embedded applications to monitor network perfomance, errors and business metrics.

Contents

  • sdk - C++ SDK source and headers
  • sample - Sample Application showing how to use the SDK to capture and send events
  • tests - Unit Tests to test functionality of SDK
  • docs - SDK API document built in html format using Doxygen.

Requirements

  • GNU C++ Compiler (g++) version 4.2 or above for 32/64-bit architectures
  • Any Linux x86 distribution based on glibc 2.20+
  • If using macOS - LLVM version 8.0.0 or above
  • cmake version 3.0 or above

Before building the sdk, check if cmake is installed. If not, you can get it using package manager

$ sudo apt-get install cmake
$ cmake -v

Also, ensure your system has all the tools (g++, make, libc, git etc) to build c++ code. If not, you can install them using

$ sudo apt-get install build-essential
$ sudo apt-get install git
$ sudo apt-get install lcov

Note: lcov version 1.13 or higher is needed.

On 32 bit machines, you might also need multilib

$ sudo apt-get install gcc-multilib g++-multilib

Dependencies

  • cgreen - Tests are written using cgreen unit testing framework to verify SDK functionality. cgreen repo will be downloaded, compiled and linked to tests as part of build step.
  • curl - Sample application uses curl to send events to Appdynamics IoT Collector

You can install curl and its headers using below commands:

$ sudo apt-get install curl
$ sudo apt-get install libcurl4-gnutls-dev

Platforms

SDK has been built and tested on below platforms.

  • Linux x86 32/64 bit architectures
  • macOS 10.12 and above

SDK can be built on other platforms as long the compiler has support for ISO C++ standard C++98/C++03.

Build Targets

Below are the targets that can be built using this repository.

  • appdynamicsiotsdk - SDK is built as a library(libappdynamicsiot) by default. The library and headers can be found in lib/ and include/ directories created when this target is built.
  • sample - Sample application is built as executable sample by default.
  • tests - Tests are built as executable linking cgreen library.

Installation

All the targets can be built from root directory using the below commands.

$ git clone https://github.com/Appdynamics/iot-cpp-sdk.git
$ cd iot-cpp-sdk
$ mkdir build
$ cd build
$ cmake ..
$ make

if build directory is created outside of the root directory, then pass the path of root directory to cmake command.

Only sdk and sample targets are built by default. To build tests, run

$ cmake .. -DBUILD_TESTS=1
$ make

If you want to build tests and enable code coverage, run

$ cmake .. -DENABLE_COVERAGE=1

Code coverage has a dependency on gcov, lcov & genhtml.

If you want to build a 32 bit library on a 64 bit machine, set the flag DBUILD_32BIT

$ cmake .. -DBUILD_32BIT=1
$ make

You can also build individual targets using below commands

$ make appdynamicsiotsdk
$ make sample
$ make tests

You can run tests from the build folder by using commands below

$ make ./run-tests

You can run a report on code coverage from the build folder by using commands below

$ sudo make run-code-coverage

You can view the code coverage report from the build folder by opening the out/index.html file

How to Use

Best place to understand the usage of SDK is to run the sample application. Please refer README of sample application for steps to run.

Below are the steps to integrate and use SDK within your own application:

  1. Dynamically link SDK Library (libappdynamicsiot) to your application
    • You can find the library libappdynamicsiot in lib/ folder once sdk target is built
    • If you are using cmake, refer to CMakeLists.txt within sample/ on how sdk library is linked
  2. Copy and import SDK headers from include directory into your application
  3. Get EUM App Key and Collector URL
  4. Initialize SDK with App Key and Collector URL before adding and sending data
  5. Confirm IoT Data is reported to Collector

Additional Resources

  1. SDK API docs - provides definition and implementation of SDK API
  2. REST API docs - provides payload structure sent to IoT Collector
  3. User Documents - provides overview on IoT monitoring capabilities
  4. Sample Application in other languages are available on github

iot-cpp-sdk's People

Contributors

jimix avatar lbk003 avatar vaasu1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iot-cpp-sdk's Issues

Build break due to format string with ISO C++98 compiler

/home/travis/build/jimix/iot-cpp-sdk/sdk/src/beacon.cpp:96:107: error: ISO C++98 does not support the ‘z’ gnu_printf length modifier [-Werror=format=]
     appd_iot_log(APPD_IOT_LOG_INFO, "Custom Event Added, Size:%zu", global_beacon.custom_event_list.size());

Suggestion:

  1. use %lu and cast to (long)
  2. force C++11

To test you could add the following to sdk/CMakeLists.txt:

set(CMAKE_CXX_STANDARD 98)

Validate data

  1. Remove dot and pipe characters from field names
  2. Truncate the field name to max length

Support to send multiple beacons

Extend support to send multiple beacons in single REST call
Extend support to allow building beacons with different device ids.

Fix SDK version

The macro APPD_IOT_SDK_VERSION in beacon.cpp is set to a version of 4.4.1.
Fix this and set version info through a build setting.

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.