File: test.py

package info (click to toggle)
biomaj3-zipkin 0.2.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 124 kB
  • sloc: python: 172; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 611 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import logging
import time

from biomaj_zipkin.zipkin import Zipkin

logging.basicConfig(level=logging.DEBUG)


cfg = {
    'zipkin': {
        'url': 'http://localhost:9411'
    }
}

Zipkin.set_config(cfg)

span = Zipkin('test-biomaj', 'maintrace')
span.add_binary_annotation('received something', 'blabla')

subspan = Zipkin('sub1-biomaj', 'sub1', trace_id= span.get_trace_id(), parent_id=span.get_span_id())
time.sleep(2)
subspan.trace()
subspan2 = Zipkin('sub2-biomaj', 'sub2', trace_id= span.get_trace_id(), parent_id=span.get_span_id())
time.sleep(2)
subspan2.trace()
time.sleep(1)
span.trace()