Skip to content

Commit 29d350c

Browse files
committed
add links for observability
1 parent dc25fed commit 29d350c

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

docs/references.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@
2626
### Services
2727

2828
- [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)

scripts/otel_operator.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,34 @@ def run(
4848
logger.info(f"Response: {response['content']}")
4949

5050

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+
5179
if __name__ == "__main__":
5280
load_dotenv(
5381
override=True,

0 commit comments

Comments
 (0)