Giter VIP home page Giter VIP logo

aiohttp_prometheus_exporter's Introduction

aiohttp prometheus exporter

image

image

image

image

image

Black

Documentation Status

Updates

Export aiohttp metrics for Prometheus.io

Usage

Requirements

  • aiohttp >= 3

Installation

Install with:

pip install aiohttp-prometheus-exporter

Server quickstart

from aiohttp import web
from aiohttp_prometheus_exporter.handler import metrics
from aiohttp_prometheus_exporter.middleware import prometheus_middleware_factory

async def hello(request):
    return web.Response(text="Hello, world")

app = web.Application()
app.add_routes([web.get('/', hello)])

app.middlewares.append(prometheus_middleware_factory())
app.router.add_get("/metrics", metrics())

web.run_app(app)

Client quickstart

import aiohttp
from aiohttp_prometheus_exporter.trace import PrometheusTraceConfig

async with aiohttp.ClientSession(trace_configs=[PrometheusTraceConfig()) as session:
    async with session.get('http://httpbin.org/get') as resp:
        print(resp.status)
        print(await resp.text())

Now, client metrics are attached to metrics exposed by your web server.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

aiohttp_prometheus_exporter's People

Contributors

adriankrupa avatar dependabot-preview[bot] avatar dependabot[bot] avatar pyup-bot avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

aiohttp_prometheus_exporter's Issues

remote label cardinality

Hi!

Thanks a lot for this repository, it helped me a lot and gave me inspiration.
I wanted to mention the "remote" label that stores the caller's IP address, which is kind of unbounded.
Prometheus documentation state the following:

CAUTION: Remember that every unique combination of key-value label pairs represents a new time series, which can dramatically increase the amount of data stored. Do not use labels to store dimensions with high cardinality (many different label values), such as user IDs, email addresses, or other unbounded sets of values.

Thus I think you need to consider this label for high-scale webservers as it might blow up the request and the data

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.