-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add concurrency tracking * Fix concurrency tests for otel and prom trackers * Comment out opentelemetry concurrency test since gauges are not supported * Update docs * Add a test for passing objectives to autometrics then using async decorator * Update version to 0.6 --------- Co-authored-by: Brett Beutell <[email protected]>
- Loading branch information
1 parent
2412b13
commit 88164e7
Showing
16 changed files
with
1,094 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
examples/django_example/django_example/views/concurrency.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import time | ||
from autometrics import autometrics | ||
from django.http import HttpResponse | ||
from django.views import View | ||
|
||
|
||
class ConcurrencyView(View): | ||
"""Here you can see how concurrency tracking works in autometrics. | ||
Just add the `track_concurrency=True` argument, and autometrics | ||
will track the number of concurrent requests to this endpoint.""" | ||
|
||
@autometrics(track_concurrency=True) | ||
def get(self, request): | ||
time.sleep(0.25) | ||
return HttpResponse("Many clients wait for a reply from this endpoint!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import time | ||
from locust import HttpUser, task, between | ||
|
||
|
||
class DjangoUser(HttpUser): | ||
wait_time = between(1, 2.5) | ||
|
||
@task(10) | ||
def visit_concurrency_handler(self): | ||
self.client.get("/concurrency/") | ||
|
||
@task | ||
def visit_error_handler(self): | ||
self.client.get("/error/") | ||
|
||
@task | ||
def visit_simple_handler(self): | ||
self.client.get("/simple/") | ||
|
||
@task | ||
def visit_latency_handler(self): | ||
self.client.get("/latency/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
export AUTOMETRICS_COMMIT=67a1b3a | ||
export AUTOMETRICS_VERSION=0.1.0 | ||
export AUTOMETRICS_BRANCH=main | ||
export AUTOMETRICS_TRACKER=prometheus | ||
|
||
# run the server itself | ||
poetry run python manage.py runserver 8080 & | ||
# run the locust load test and pipe stdout to dev/null | ||
poetry run locust --host=http://localhost:8080 --users=100 --headless & | ||
|
||
# kill all child processes on exit | ||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT | ||
wait |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "autometrics" | ||
version = "0.5" | ||
version = "0.6" | ||
description = "Easily add metrics to your system – and actually understand them using automatically customized Prometheus queries" | ||
authors = ["Fiberplane <[email protected]>"] | ||
license = "MIT OR Apache-2.0" | ||
|
@@ -72,6 +72,7 @@ urllib3 = "1.26.15" | |
uvicorn = "0.21.1" | ||
webencodings = "0.5.1" | ||
zipp = "3.15.0" | ||
locust = "^2.15.1" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.