File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 26
26
### Services
27
27
28
28
- [ FastAPI] ( https://fastapi.tiangolo.com/ )
29
+
30
+ ### Observability
31
+
32
+ - [ OpenTelemetry] ( https://opentelemetry.io/ )
33
+ - [ Python / Getting Started] ( https://opentelemetry.io/docs/languages/python/getting-started/ )
34
+ - [ Python / Cookbook] ( https://opentelemetry.io/docs/languages/python/cookbook/ )
35
+ - [ OpenTelemetry Collector] ( https://opentelemetry.io//docs/collector/ )
36
+ - [ Jaeger] ( https://www.jaegertracing.io/ )
37
+ - [ Jaeger / Minimal deployment example (Elasticsearch backend)] ( https://www.jaegertracing.io/docs/1.72/deployment/#minimal-deployment-example-elasticsearch-backend )
Original file line number Diff line number Diff line change @@ -48,6 +48,34 @@ def run(
48
48
logger .info (f"Response: { response ['content' ]} " )
49
49
50
50
51
+ @app .command ()
52
+ def cookbook (
53
+ verbose : bool = typer .Option (
54
+ False ,
55
+ "--verbose" ,
56
+ "-v" ,
57
+ help = "Enable verbose output" ,
58
+ ),
59
+ ):
60
+ # Set up logging
61
+ if verbose :
62
+ logger .setLevel (logging .DEBUG )
63
+
64
+ otel_wrapper = OtelWrapper ()
65
+ otel_wrapper .initialize ()
66
+ tracer = otel_wrapper .get_tracer (name = __name__ )
67
+
68
+ with tracer .start_as_current_span ("otel_operator_cookbook" ):
69
+ logger .info ("Running cookbook example..." )
70
+ time .sleep (1 )
71
+
72
+ with tracer .start_as_current_span ("child" ):
73
+ logger .info ("Running child span..." )
74
+ time .sleep (2 )
75
+
76
+ time .sleep (1 )
77
+
78
+
51
79
if __name__ == "__main__" :
52
80
load_dotenv (
53
81
override = True ,
You can’t perform that action at this time.
0 commit comments