address feedback

This commit is contained in:
Dinesh Yeduguru 2024-12-06 11:45:28 -08:00
parent 83de0c7995
commit 00ed90cbda
2 changed files with 11 additions and 6 deletions

View file

@ -347,7 +347,7 @@ def main():
listen_host = ["::", "0.0.0.0"] if not args.disable_ipv6 else "0.0.0.0"
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__":

View file

@ -9,6 +9,7 @@ from datetime import datetime
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.sdk.trace.export import SpanProcessor
from opentelemetry.trace.status import StatusCode
# Colors for console output
COLORS = {
@ -39,8 +40,8 @@ class ConsoleSpanProcessor(SpanProcessor):
)[:-3]
print(
f"{timestamp} "
f"{COLORS['bold']}[START]{COLORS['reset']} "
f"{COLORS['dim']}{timestamp}{COLORS['reset']} "
f"{COLORS['magenta']}[START]{COLORS['reset']} "
f"{COLORS['dim']}{span.name}{COLORS['reset']}"
)
@ -52,11 +53,15 @@ class ConsoleSpanProcessor(SpanProcessor):
"%H:%M:%S.%f"
)[:-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']}"
elif span.status.status_code != 0: # UNSET
elif span.status.status_code != StatusCode.UNSET:
span_context += f"{COLORS['reset']} [{span.status.status_code}]"
duration_ms = (span.end_time - span.start_time) / 1e6