Skip to content

Commit

Permalink
Update Prometheus files
Browse files Browse the repository at this point in the history
  • Loading branch information
mariangelapanunzio committed Dec 17, 2023
1 parent 94f042e commit 83453a8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ scrape_configs:
- job_name: 'fastapi'
scrape_interval: 5s
static_configs:
- targets: ['127.0.0.1:5500']
- targets: ['127.0.0.1:5500']
25 changes: 25 additions & 0 deletions src/api/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@
)
)

instrumentator.add(
metrics.duration(
should_include_handler=True,
should_include_method=True,
should_include_status=True,
metric_name="request_duration_seconds",
metric_doc="Duration of image segmentation requests",
metric_namespace=NAMESPACE,
metric_subsystem=SUBSYSTEM,
)
)

instrumentator.add(
metrics.error_rate(
should_include_handler=True,
should_include_method=True,
should_include_status=True,
metric_name="error_rate",
metric_doc="Error rate of image segmentation requests",
metric_namespace=NAMESPACE,
metric_subsystem=SUBSYSTEM,
)
)


def segmentation_result_metric(
metric_name: str = "segmentation_result",
metric_doc: str = "Outcome of image segmentation",
Expand Down

0 comments on commit 83453a8

Please sign in to comment.