Giter Site home page Giter Site logo

uatu's Introduction

Elastic APM, a open source application performance monitoring tool. This repo consists of Dockerfile and docker compose file to setup APM.

Bring up Docker

  • Change secret token for your app. In apm-server.yml file, change somerandomstring. Note this token.
  • build docker image: docker build -t elastic-apm-server:6.2.4 .
  • run docker compose: docker-compose up -d. This will take some time as it waits for elastic-search and kibana service to start.
  • check if all containers are up. docker-compose ps
  • Kibana will run on port:8200 and apm-server on port:5601.
  • port 8200 is used to visualize data, and port 5601 is to ping data from your app

Configure Your App

  • Refer this page to setup and this page to configure.

  • Install python agent: pip install elastic-apm

  • Add elasticapm.contrib.django to INSTALLED_APPS in your settings

  • Add elasticapm.contrib.django.middleware.TracingMiddleware at first to MIDDLEWARE in your settings

  • Example config in your Django settings:

    # Elastic APM
    APM_ENABLED = env.bool('APM_ENABLED', default=True)
    if APM_ENABLED:
        INSTALLED_APPS.append('elasticapm.contrib.django')
        # middleware should be first for best results
        MIDDLEWARE.insert(0, 'elasticapm.contrib.django.middleware.TracingMiddleware')
        ELASTIC_APM = {
            "DEBUG": True,  # monitor when app is in DEBUG mode
            'SERVICE_NAME': env('APM_SERVICE_NAME', default='My App'),  # name for your app
            # token is configured in APM server. Do not change
            'SECRET_TOKEN': env('APM_SECRET_TOKEN', default='somerandomstring'), # this is token you put in apm-server.yml file
            'SERVER_URL': env('APM_SERVER_URL', default='http://localhost:8200'), # this is kibana endpoint
            'CAPTURE_BODY': 'all'
        }
  • Run python manage.py elasticapm check to check if everything is configured properly.

  • Run python manage.py elasticapm test to send sample error to APM

Once your app is up and running, visit your SERVER_URL and navigate to APM

Note:

  • If docker-compose fails with message: ERROR: for apm-server Container "*******" is unhealthy. ERROR: Encountered errors while bringing up the project., increase healthcheck retries count for kibana service in docker-compose file.

Version: - elasticsearch:6.2.4 - kibana:6.2.4

Inspired by: https://github.com/yidinghan/eak

uatu's People

Contributors

yidinghan avatar nelsonsequiera avatar hithaieshl avatar

Watchers

James Cloos avatar

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.