Skip to content

Add Stats Signal to ESI request

This is to provide a way for 3rd party apps to check/log/whatever ESI requests without having to fork the lib.

I added the headers so things like error buckets and stuff can be tracked too, happy to whitelist certain headers if that is a better option.

Tests to follow later wanted to discuss structure first.

from django.dispatch import receiver
from esi.signals import esi_request_statistics

@receiver(esi_request_statistics)
def esi_callback(sender, operation, status_code, headers, latency, **kwargs):
    # do stuff
    print(
        f"Signal Received - {operation} - {status_code} in {latency} (headers: {len(headers)})"
    )

I personally will use this in allianceauth-prom-exporter to power ESI request/error metrics.

Merge request reports

Loading