-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Saravanan Balasubramanian <[email protected]> Signed-off-by: Avik Basu <[email protected]> Co-authored-by: Avik Basu <[email protected]> Co-authored-by: Avik Basu <[email protected]>
- Loading branch information
1 parent
5653128
commit e922195
Showing
12 changed files
with
94 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from numaprom.metrics._metrics import ( | ||
increase_redis_conn_error, | ||
inc_inference_count, | ||
start_metrics_server, | ||
) | ||
|
||
__all__ = [ | ||
"increase_redis_conn_error", | ||
"inc_inference_count", | ||
"start_metrics_server", | ||
] |
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,25 @@ | ||
from prometheus_client import start_http_server | ||
from prometheus_client import Counter | ||
|
||
from numaprom import LOGGER | ||
|
||
# Metrics | ||
REDIS_CONN_ERROR_COUNT = Counter("numaprom_redis_conn_error_count", "", ["vertex"]) | ||
INFERENCE_COUNT = Counter( | ||
"numaprom_inference_count", "", ["model", "namespace", "app", "metric", "status"] | ||
) | ||
|
||
|
||
def increase_redis_conn_error(vertex: str) -> None: | ||
global REDIS_CONN_ERROR_COUNT | ||
REDIS_CONN_ERROR_COUNT.labels(vertex).inc() | ||
|
||
|
||
def inc_inference_count(model: str, namespace: str, app: str, metric: str, status: str) -> None: | ||
global INFERENCE_COUNT | ||
INFERENCE_COUNT.labels(model, namespace, app, metric, status).inc() | ||
|
||
|
||
def start_metrics_server(port: int) -> None: | ||
LOGGER.info("Starting Prometheus metrics server on port: {port}", port=port) | ||
start_http_server(port) |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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