bentoml / BentoML

The easiest way to serve AI apps and models - Build Model Inference APIs, Job queues, LLM apps, Multi-model pipelines, and more!
https://bentoml.com
Apache License 2.0
7.17k stars 792 forks source link

Service and Access Logging #2149

Closed parano closed 2 years ago

parano commented 2 years ago
ssheng commented 2 years ago

Formats

Service Log

[%(asctime)s] %(levelname)s [%(component)s] [%(trace_id)s] [%(span_id)s] %(message)s

Example of logs related to a request.

[22:09:58] INFO     [api_service] [f04cbae0-71db-11ec-9e77-acde48001122] [aaebef7a-790b-11ec-9319-acde48001122] a quick brown fox jumps over a lazy dog 
           WARNING  [iris_runner] [754e4c62-71ec-11ec-af91-acde48001122] [b2b19b56-790b-11ec-9319-acde48001122] a quick brown fox jumps over a lazy dog 
           ERROR    [iris_runner] [f04d4d16-71db-11ec-9e77-acde48001122] [b982100a-790b-11ec-9319-acde48001122] a quick brown fox jumps over a lazy dog

Example of logs unrelated to requests, e.g. startup, shutdown logs, with trace ID empty.

[22:09:58] INFO     [api_service] [] [] a quick brown fox jumps over a lazy dog  
           WARNING  [iris_runner] [] [] a quick brown fox jumps over a lazy dog
           ERROR    [iris_runner] [] [] a quick brown fox jumps over a lazy dog

Access Log

[%(asctime)s] %(levelname)s [%(name)s] [%(trace_id)s] [%(span_id)s] %(address)s:%(port)s %(request)s %(response)s %(latency)3fms

Example:

[01:08:46] INFO     [f04cbae0-71db-11ec-9e77-acde48001122] [aaebef7a-790b-11ec-9319-acde48001122] 127.0.0.1:60650 (scheme=http,method=POST,path=/classify,length=9) (status=200,length=1) 0.461423ms

Propagation

Configuration