Name Date Size #Lines LOC

..--

README.mdH A D25-Apr-20251.3 KiB6444

helloworld_pb2.pyH A D25-Apr-20251.4 KiB3118

helloworld_pb2.pyiH A D25-Apr-2025576 1814

helloworld_pb2_grpc.pyH A D25-Apr-20252.3 KiB7155

observability_greeter_client.pyH A D25-Apr-20252.1 KiB6539

observability_greeter_server.pyH A D25-Apr-20252.3 KiB7648

open_telemetry_exporter.pyH A D25-Apr-20252.9 KiB7652

requirements.txtH A D25-Apr-202570 43

README.md

1gRPC Observability Example
2=====================
3
4The examples here demonstrate how to setup gRPC Python Observability with Opentelemetry.
5
6More details about how to use gRPC Python Observability APIs can be found in [OpenTelemetry Metrics gRFC](https://github.com/grpc/proposal/blob/master/A66-otel-stats.md#opentelemetry-metrics).
7
8### Install Requirements
9
101. Navigate to this directory:
11
12```sh
13cd examples/python/observability
14```
15
162. Install requirements:
17
18```sh
19python -m pip install -r requirements.txt
20```
21
22### Run the Server
23
24Start the server:
25
26```sh
27python -m observability_greeter_server
28```
29
30### Run the Client
31
32Note that client should start within 10 seconds of the server becoming active.
33
34```sh
35python -m observability_greeter_client
36```
37
38### Verifying Metrics
39
40The example will print a list of metric names collected.
41
42Server Side:
43
44```
45Server started, listening on 50051
46Metrics exported on Server side:
47grpc.server.call.started
48grpc.server.call.sent_total_compressed_message_size
49grpc.server.call.rcvd_total_compressed_message_size
50grpc.server.call.duration
51```
52
53Client Side:
54
55```
56Greeter client received: Hello You
57Metrics exported on client side:
58grpc.client.call.duration
59grpc.client.attempt.started
60grpc.client.attempt.sent_total_compressed_message_size
61grpc.client.attempt.rcvd_total_compressed_message_size
62grpc.client.attempt.duration
63```
64