pytorch/serve

Metrics API returns empty response until TS process serves a prediction

Open

#732 ouverte le 16 oct. 2020

Voir sur GitHub
 (5 commentaires) (2 réactions) (0 assignés)Java (790 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (3 844 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Context

When the torchserve process initially starts, metrics API endpoints tested return an empty response. While this is a niche case (most likely TS would have served at least 1 prediction before the user calls the metrics APIs), it seems as though the API is broken.

  • torchserve version: Installed from source on latest master
  • torch version: 1.6.0
  • torchvision version 0.7.0
  • java version: openjdk-11
  • Operating System and version: Ubuntu 18.04

Your Environment

  • Installed using source? [yes/no]: Yes
  • Are you planning to deploy it using docker container? [yes/no]:N/A
  • Is it a CPU or GPU environment?: CPU
  • Using a default/custom handler? [If possible upload/share custom handler/model]:No
  • What kind of model is it e.g. vision, text, audio?:N/A
  • Are you planning to use local models from model-store or public url being used e.g. from S3 bucket etc.? [If public url then provide link.]:N/A
  • Provide config.properties, logs [ts.log] and parameters used for model registration/update APIs: Did not use a config.properties (so just the default config)
  • Link to your project [if any]:N/A

Expected Behavior

The /metrics endpoint should return the list of metrics whether or not a prediction had been made. The /metrics?name endpoint should return 0s or display that there were no request logged.

Current Behavior

Both endpoints returns an empty response.

Possible Solution

Steps to Reproduce

How to reproduce:

  1. Start a new Torchserve process.
  2. Run curl http://127.0.0.1:8082/metrics and verify that there is no response.
  3. Make a call to a prediction endpoint. e.g. curl http://127.0.0.1:8080/predictions/densenet161 -T kitten.jpg
  4. Run curl http://127.0.0.1:8082/metrics again and verify the expected response is returned (the list of metrics).

Same behavior for curl "http://127.0.0.1:8082/metrics?name[]=ts_inference_latency_microseconds&name[]=ts_queue_latency_microseconds" --globoff

Failure Logs [if any]

Note that the metrics API doesn't return results until the first prediction is served. metrics_api_success.txt

Guide contributeur