18 lines
396 B
Python
18 lines
396 B
Python
# From /opt/backstory run:
|
|
# python -m src.tests.test-metrics
|
|
from ..utils import Metrics
|
|
|
|
import json
|
|
|
|
# Get the singleton Metrics instance
|
|
metrics = Metrics()
|
|
|
|
# Use the existing metrics
|
|
metrics.prepare_count.labels(agent="chat").inc()
|
|
metrics.prepare_duration.labels(agent="prepare").observe(0.45)
|
|
|
|
json = metrics.model_dump(mode="json")
|
|
metrics = Metrics.model_validate(json)
|
|
|
|
print(metrics)
|