File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
2
3
3
import time
4
- import redis
4
+
5
5
import uptrace
6
6
from opentelemetry import trace
7
7
from opentelemetry .instrumentation .redis import RedisInstrumentor
8
8
9
+ import redis
10
+
9
11
tracer = trace .get_tracer ("app_or_package_name" , "1.0.0" )
10
12
13
+
11
14
def main ():
12
15
uptrace .configure_opentelemetry (
13
16
dsn = "http://project2_secret_token@localhost:14317/2" ,
@@ -27,19 +30,23 @@ def main():
27
30
28
31
29
32
def handle_request (client ):
30
- with tracer .start_as_current_span ("handle-request" , kind = trace .SpanKind .CLIENT ) as span :
33
+ with tracer .start_as_current_span (
34
+ "handle-request" , kind = trace .SpanKind .CLIENT
35
+ ) as span :
31
36
client .get ("my-key" )
32
37
client .set ("hello" , "world" )
33
- client .mset ({
34
- "employee_name" : "Adam Adams" ,
35
- "employee_age" : 30 ,
36
- "position" : "Software Engineer" ,
37
- })
38
+ client .mset (
39
+ {
40
+ "employee_name" : "Adam Adams" ,
41
+ "employee_age" : 30 ,
42
+ "position" : "Software Engineer" ,
43
+ }
44
+ )
38
45
39
46
pipe = client .pipeline ()
40
- pipe .set (' foo' , 5 )
41
- pipe .set (' bar' , 18.5 )
42
- pipe .set (' blee' , "hello world!" )
47
+ pipe .set (" foo" , 5 )
48
+ pipe .set (" bar" , 18.5 )
49
+ pipe .set (" blee" , "hello world!" )
43
50
pipe .execute ()
44
51
45
52
return span
You can’t perform that action at this time.
0 commit comments