GithubHelp home page GithubHelp logo

isabella232 / apm-agent-python-benchmarks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elastic/apm-agent-python-benchmarks

0.0 0.0 0.0 52 KB

Benchmarks for the Python APM Agent

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

apm-agent-python-benchmarks's Introduction

Benchmarks for the Elastic APM Python agent

This repository contains the benchmark suite for the Elastic APM Python agent. It uses pyperf to run the benchmarks.

Writing a benchmark

Benchmarks are callables that are auto-discovered by the runner. To be discovered, the callables have to

  • be prefixed with bench_:

     def bench_something():
         # code to be benchmarked
    
  • live in a module that is prefixed with bm_, e.g. bm_mybenches.py

  • that module has to be in the benchmarks package

If your benchmark needs an elasticapm.Client instance, use the benchmarks.decorators.with_elasticapm_client decorator. The decorator will instantiate the client outside of your benchmark function. This ensures that client instantiation is not part of your benchmark. You can pass configuration option to the client as keyword arguments to the decorator.

from benchmarks.decorators import with_elasticapm_client

@with_elasticapm_client(span_frame_min_duration=0)
def bench_something(client):
    client.begin_transaction()
    # ...

Running the benchmarks

First, install the requirements:

pip install -r requirements.txt

As these benchmarks live in a separate repository, they need a checkout of the agent repository to run in. You can use the run_bench_commits.py runner to create the repository, run the benchmarks on one or more commits, and send the result to Elasticsearch:

Usage: run_bench_commits.py [OPTIONS]

Options:
  --worktree PATH                 worktree of elastic-apm to run benchmarks in
                                  [required]
  --start-commit TEXT             first commit to benchmark. If left empty,
                                  current worktree state will be benchmarked
  --end-commit TEXT               last commit to benchmark. If left empty,
                                  only start-commit will be benchmarked
  --clone-url TEXT                Git URL to clone
  --es-url TEXT                   Elasticsearch URL
  --es-user TEXT                  Elasticsearch User
  --es-password TEXT              Elasticsearch Password
  --delete-output-files / --no-delete-output-files
                                  Delete benchmark files
  --delete-repo / --no-delete-repo
                                  Delete repo after run
  --randomize / --no-randomize    Randomize order of commits
  --timing / --no-timing          Run timing benchmarks
  --tracemalloc / --no-tracemalloc
                                  Run tracemalloc benchmarks
  --bench-pattern TEXT            An optional glob pattern to filter
                                  benchmarks by
  --as-is                         Run benchmark in current workdir without
                                  checking out a commit
  --tag TEXT                      Specify tag as key=value
  --help                          Show this message and exit.

apm-agent-python-benchmarks's People

Contributors

beniwohli 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.