-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Description
I have an error when i try to collect metrics through bash terminal. To collect metrics i use command: http://0.0.0.0:8052/metrics
settings.json and code for server.py are below
version of mlserver is 1.6.1
#settings.json
{
"server_name": "seldon.mlserver",
"http_port": "8050",
"grpc_port": "8051",
"metrics_port": "8052",
"host": "0.0.0.0"
}
#sum_model.py
from mlserver import MLModel
from mlserver.types import InferenceRequest, InferenceResponse, ResponseOutput, Datatype
import mlserver
class SumModel(MLModel):
async def load(self):
self.model = lambda x,y: x+y
mlserver.register("counter", "Simple counter")
self._counter: int = 0
async def predict(self, payload: InferenceRequest) -> InferenceResponse:
model_input = payload.inputs[0]
output = self.model(*model_input.data)
print(f"request datatype: {model_input.datatype}")
self._counter += 1
mlserver.log(counter=self._counter)
return InferenceResponse(
model_name=self.name,
outputs=[
ResponseOutput(
name=model_input.name,
datatype=Datatype.UINT8,
shape=[1, 1],
data=[output]
)
]
)
#model-settings.json
{
"name": "sum-model",
"implementation": "sum_model.SumModel",
"inputs": [
{
"name": "nums",
"datatype": "INT32",
"shape": [2],
"parameters": {
"content_type": "np"
}
}
]
}
Traceback (most recent call last):
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/routing.py", line 758, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/routing.py", line 778, in app
await route.handle(scope, receive, send)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/routing.py", line 299, in handle
await self.app(scope, receive, send)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/routing.py", line 79, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/routing.py", line 76, in app
response = await run_in_threadpool(func, request)
File "/home/a.borovik/.local/lib/python3.10/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/home/a.borovik/.local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/home/a.borovik/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
return await future
File "/home/a.borovik/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
result = context.run(func, *args)
File "/home/a.borovik/.local/lib/python3.10/site-packages/mlserver/metrics/prometheus.py", line 62, in handle_metrics
generate_latest(self._registry),
File "/home/a.borovik/.local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 176, in generate_latest
for metric in registry.collect():
File "/home/a.borovik/.local/lib/python3.10/site-packages/prometheus_client/registry.py", line 83, in collect
for metric in collector.collect():
File "/home/a.borovik/.local/lib/python3.10/site-packages/prometheus_client/multiprocess.py", line 154, in collect
return self.merge(files, accumulate=True)
File "/home/a.borovik/.local/lib/python3.10/site-packages/prometheus_client/multiprocess.py", line 46, in merge
metrics = MultiProcessCollector._read_metrics(files)
File "/home/a.borovik/.local/lib/python3.10/site-packages/prometheus_client/multiprocess.py", line 75, in _read_metrics
metric_name, name, labels, labels_key = _parse_key(key)
File "/home/a.borovik/.local/lib/python3.10/site-packages/prometheus_client/multiprocess.py", line 57, in _parse_key
metric_name, name, labels = json.loads(key)
ValueError: too many values to unpack (expected 3)
what's wrong?
Metadata
Metadata
Assignees
Labels
No labels