Observability in the Cake AI platform is available via OTEL collector service, which receives traces in Zipkin format on port 9411, then exports the traces to Jaeger using OTLP over gRPC.
To send a test trace from a Jupyter notebook:
Connect to a notebook instance in your cluster
Save the following as send_trace.py
import time import requests from py_zipkin.zipkin import zipkin_span, create_http_headers_for_new_span def transport_handler(encoded_span): requests.post( '<http://otel-collector.monitoring:9411/api/v2/spans>', data=encoded_span, headers={'Content-Type': 'application/json'}, ) with zipkin_span(service_name='test-service', span_name='test-zipkin-span', transport_handler=transport_handler, sample_rate=100.0): print('Sent test span') time.sleep(1)
Open a terminal and execute the commands below.
File > New > Terminal
pip install --upgrade uv pip uv run --with py_zipkin python send_trace.py
Running the command above will print ‘Sent test span’ to the terminal.
(optional) Send a separate trace from within a jupyter notebook
The process above can also be performed entirely within a jupyter notebook (.ipynb file). To do so, execute the following two cells.
!pip install py_zipkin requests
import time
import requests
from py_zipkin.zipkin import zipkin_span, create_http_headers_for_new_span
def transport_handler(encoded_span):
requests.post(
'<http://otel-collector.monitoring:9411/api/v2/spans>',
data=encoded_span,
headers={'Content-Type': 'application/json'},
)
with zipkin_span(service_name='test-service', span_name='test-zipkin-span', transport_handler=transport_handler, sample_rate=100.0):
print('Sent test span')
time.sleep(1)
Open the Jaeger app and review the trace