mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-02 08:44:44 +00:00
address feedback
This commit is contained in:
parent
83de0c7995
commit
00ed90cbda
2 changed files with 11 additions and 6 deletions
|
@ -347,7 +347,7 @@ def main():
|
||||||
|
|
||||||
listen_host = ["::", "0.0.0.0"] if not args.disable_ipv6 else "0.0.0.0"
|
listen_host = ["::", "0.0.0.0"] if not args.disable_ipv6 else "0.0.0.0"
|
||||||
print(f"Listening on {listen_host}:{args.port}")
|
print(f"Listening on {listen_host}:{args.port}")
|
||||||
uvicorn.run(app, host=listen_host, port=args.port, access_log=False)
|
uvicorn.run(app, host=listen_host, port=args.port)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -9,6 +9,7 @@ from datetime import datetime
|
||||||
|
|
||||||
from opentelemetry.sdk.trace import ReadableSpan
|
from opentelemetry.sdk.trace import ReadableSpan
|
||||||
from opentelemetry.sdk.trace.export import SpanProcessor
|
from opentelemetry.sdk.trace.export import SpanProcessor
|
||||||
|
from opentelemetry.trace.status import StatusCode
|
||||||
|
|
||||||
# Colors for console output
|
# Colors for console output
|
||||||
COLORS = {
|
COLORS = {
|
||||||
|
@ -39,8 +40,8 @@ class ConsoleSpanProcessor(SpanProcessor):
|
||||||
)[:-3]
|
)[:-3]
|
||||||
|
|
||||||
print(
|
print(
|
||||||
f"{timestamp} "
|
f"{COLORS['dim']}{timestamp}{COLORS['reset']} "
|
||||||
f"{COLORS['bold']}[START]{COLORS['reset']} "
|
f"{COLORS['magenta']}[START]{COLORS['reset']} "
|
||||||
f"{COLORS['dim']}{span.name}{COLORS['reset']}"
|
f"{COLORS['dim']}{span.name}{COLORS['reset']}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,11 +53,15 @@ class ConsoleSpanProcessor(SpanProcessor):
|
||||||
"%H:%M:%S.%f"
|
"%H:%M:%S.%f"
|
||||||
)[:-3]
|
)[:-3]
|
||||||
|
|
||||||
span_context = f"{timestamp} {COLORS['bold']}[END]{COLORS['reset']} {COLORS['dim']}{span.name}"
|
span_context = (
|
||||||
|
f"{COLORS['dim']}{timestamp}{COLORS['reset']} "
|
||||||
|
f"{COLORS['magenta']}[END]{COLORS['reset']} "
|
||||||
|
f"{COLORS['dim']}{span.name}{COLORS['reset']}"
|
||||||
|
)
|
||||||
|
|
||||||
if span.status.status_code == 2: # ERROR
|
if span.status.status_code == StatusCode.ERROR:
|
||||||
span_context += f"{COLORS['reset']} {COLORS['red']}[ERROR]{COLORS['reset']}"
|
span_context += f"{COLORS['reset']} {COLORS['red']}[ERROR]{COLORS['reset']}"
|
||||||
elif span.status.status_code != 0: # UNSET
|
elif span.status.status_code != StatusCode.UNSET:
|
||||||
span_context += f"{COLORS['reset']} [{span.status.status_code}]"
|
span_context += f"{COLORS['reset']} [{span.status.status_code}]"
|
||||||
|
|
||||||
duration_ms = (span.end_time - span.start_time) / 1e6
|
duration_ms = (span.end_time - span.start_time) / 1e6
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue