
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
statsd-asgi
Advanced tools
An ASGI middleware to emit metrics to statsd for requests
Mostly designed to work with Datadog, but should work with any statsd metric
========
statsd_client: Pass along your own statsd client. Must implement increment and timing methods
statsd_options: Options to configure the datadog statsd client
service: Name of your service, prepended to all metrics. Defaults to asgi
logger: optional logger
=======================
{service_name}.path
i.e.
myservice.api.v1.foo
==================
Emits timing metrics for each endpoint for requests. Will emit clock time and cpu time.
=======
type: wall or cpu, depending on time source
status_code: The status code of the http request
method: the http method (get, post, put, delete)
=============================
Emits counter metrics for each endpoint
=======
status_code: The status code of the http request
method: the http method (get, post, put, delete)
This ASGI middleware should work with any Starlette app, but I work with FastAPI so that's the example I've got for you. PRs welcome for more examples
.. code-block:: python
from fastapi import FastAPI
app = FastAPI()
from statsd_asgi import TimingMiddleware, StatusCodeMetricsMiddleware
from logging import getLogger
statsd*options = {'statsd*host': os.environ.get("STATSD_HOST"),
'statsd\_port': os.environ.get("STATSD\_PORT")
}
app.add*middleware(TimingMiddleware, service="testapi", statsd*options=statsd_options)
app.add*middleware(StatusCodeMetricsMiddleware, service="testapi", statsd*client=statsd_options)
@app.get("/api")
async def root():
return {"message": "Hello World"}
FAQs
Export metrics about requests in your ASGI apps to statsd or Datadog
We found that statsd-asgi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.