@@ -55,11 +55,9 @@ $ source auto_instrumentation/bin/activate
5555# Installation
5656
5757``` sh
58- $ pip install opentelemetry-api
5958$ pip install opentelemetry-sdk
6059$ pip install opentelemetry-auto-instrumentation
61- $ pip install ext/opentelemetry-ext-flask
62- $ pip install flask
60+ $ pip install opentelemetry-ext-flask
6361$ pip install requests
6462```
6563
@@ -71,42 +69,97 @@ This is done in 2 separate consoles, one to run each of the scripts that make up
7169
7270``` sh
7371$ source auto_instrumentation/bin/activate
74- $ python opentelemetry-python/opentelemetry- auto-instrumentation/example /server_instrumented.py
72+ $ python opentelemetry-python/docs/examples/ auto-instrumentation/server_instrumented.py
7573```
7674
7775``` sh
7876$ source auto_instrumentation/bin/activate
79- $ python opentelemetry-python/opentelemetry- auto-instrumentation/example /client.py testing
77+ $ python opentelemetry-python/docs/examples/ auto-instrumentation/client.py testing
8078```
8179
8280The execution of ` server_instrumented.py ` should return an output similar to:
8381
8482``` sh
85- Hello, testing!
86- Span(name=" serv_request" , context=SpanContext(trace_id=0x9c0e0ce8f7b7dbb51d1d6e744a4dad49, span_id=0xd1ba3ec4c76a0d7f, trace_state={}), kind=SpanKind.INTERNAL, parent=None, start_time=2020-03-19T00:06:31.275719Z, end_time=2020-03-19T00:06:31.275920Z)
87- 127.0.0.1 - - [18/Mar/2020 18:06:31] " GET /serv_request?helloStr=Hello%2C+testing%21 HTTP/1.1" 200 -
83+ {
84+ " name" : " server_request" ,
85+ " context" : {
86+ " trace_id" : " 0xfa002aad260b5f7110db674a9ddfcd23" ,
87+ " span_id" : " 0x8b8bbaf3ca9c5131" ,
88+ " trace_state" : " {}"
89+ },
90+ " kind" : " SpanKind.SERVER" ,
91+ " parent_id" : null,
92+ " start_time" : " 2020-04-30T17:28:57.886397Z" ,
93+ " end_time" : " 2020-04-30T17:28:57.886490Z" ,
94+ " status" : {
95+ " canonical_code" : " OK"
96+ },
97+ " attributes" : {
98+ " component" : " http" ,
99+ " http.method" : " GET" ,
100+ " http.server_name" : " 127.0.0.1" ,
101+ " http.scheme" : " http" ,
102+ " host.port" : 8082,
103+ " http.host" : " localhost:8082" ,
104+ " http.target" : " /server_request?param=testing" ,
105+ " net.peer.ip" : " 127.0.0.1" ,
106+ " net.peer.port" : 52872,
107+ " http.flavor" : " 1.1"
108+ },
109+ " events" : [],
110+ " links" : []
111+ }
88112```
89113
90114## Execution of an automatically instrumented server
91115
92116Now, kill the execution of ` server_instrumented.py ` with ` ctrl + c ` and run this instead:
93117
94118``` sh
95- $ opentelemetry-auto-instrumentation opentelemetry- python/opentelemetry- auto-instrumentation/example /server_uninstrumented.py
119+ $ opentelemetry-auto-instrumentation python docs/examples/ auto-instrumentation/server_uninstrumented.py
96120```
97121
98122In the console where you previously executed ` client.py ` , run again this again:
99123
100124``` sh
101- $ python opentelemetry-python/opentelemetry- auto-instrumentation/example /client.py testing
125+ $ python opentelemetry-python/docs/examples/ auto-instrumentation/client.py testing
102126```
103127
104128The execution of ` server_uninstrumented.py ` should return an output similar to:
105129
106130``` sh
107- Hello, testing!
108- Span(name=" serv_request" , context=SpanContext(trace_id=0xf26b28b5243e48f5f96bfc753f95f3f0, span_id=0xbeb179a095d087ed, trace_state={}), kind=SpanKind.SERVER, parent=< opentelemetry.trace.DefaultSpan object at 0x7f1a20a54908> , start_time=2020-03-19T00:24:18.828561Z, end_time=2020-03-19T00:24:18.845127Z)
109- 127.0.0.1 - - [18/Mar/2020 18:24:18] " GET /serv_request?helloStr=Hello%2C+testing%21 HTTP/1.1" 200 -
131+ {
132+ " name" : " server_request" ,
133+ " context" : {
134+ " trace_id" : " 0x9f528e0b76189f539d9c21b1a7a2fc24" ,
135+ " span_id" : " 0xd79760685cd4c269" ,
136+ " trace_state" : " {}"
137+ },
138+ " kind" : " SpanKind.SERVER" ,
139+ " parent_id" : " 0xb4fb7eee22ef78e4" ,
140+ " start_time" : " 2020-04-30T17:10:02.400604Z" ,
141+ " end_time" : " 2020-04-30T17:10:02.401858Z" ,
142+ " status" : {
143+ " canonical_code" : " OK"
144+ },
145+ " attributes" : {
146+ " component" : " http" ,
147+ " http.method" : " GET" ,
148+ " http.server_name" : " 127.0.0.1" ,
149+ " http.scheme" : " http" ,
150+ " host.port" : 8082,
151+ " http.host" : " localhost:8082" ,
152+ " http.target" : " /server_request?param=testing" ,
153+ " net.peer.ip" : " 127.0.0.1" ,
154+ " net.peer.port" : 48240,
155+ " http.flavor" : " 1.1" ,
156+ " http.route" : " /server_request" ,
157+ " http.status_text" : " OK" ,
158+ " http.status_code" : 200
159+ },
160+ " events" : [],
161+ " links" : []
162+ }
110163```
111164
112- As you can see, both outputs are equivalentsince the automatic instrumentation does what the manual instrumentation does too.
165+ Both outputs are equivalent since the automatic instrumentation does what the manual instrumentation does too.
0 commit comments