Skip to content

Commit b4277bf

Browse files
committed
Merge remote-tracking branch 'upstream/master' into tracer_provider_force_flush
2 parents 83bd36e + 2992950 commit b4277bf

File tree

113 files changed

+2966
-546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2966
-546
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ exclude =
1818
ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/gen/
1919
ext/opentelemetry-ext-jaeger/build/*
2020
docs/examples/opentelemetry-example-app/src/opentelemetry_example_app/grpc/gen/
21+
docs/examples/opentelemetry-example-app/build/*

.isort.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ multi_line_output=3
1515
skip=target
1616
skip_glob=**/gen/*,.venv*/*,venv*/*
1717
known_first_party=opentelemetry,opentelemetry_example_app
18-
known_third_party=psutil,pytest
18+
known_third_party=psutil,pytest,redis,redis_opentracing

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ language: python
55
cache: pip
66

77
python:
8+
- 'pypy3'
9+
- '3.8'
810
- '3.4'
911
- '3.5'
1012
- '3.6'
1113
- '3.7'
12-
- '3.8'
13-
- 'pypy3'
1414

1515
#matrix:
1616
# allow_failures:

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pylint~=2.3
1+
pylint==2.4.4
22
flake8~=3.7
33
isort~=4.3
44
black>=19.3b0,==19.*

docs/examples/basic_tracer/tests/test_tracer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ def test_basic_tracer(self):
2525
(sys.executable, test_script)
2626
).decode()
2727

28-
self.assertIn('name="foo"', output)
29-
self.assertIn('name="bar"', output)
30-
self.assertIn('name="baz"', output)
28+
self.assertIn('"name": "foo"', output)
29+
self.assertIn('"name": "bar"', output)
30+
self.assertIn('"name": "baz"', output)

docs/examples/http/client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@
2828

2929
# The preferred tracer implementation must be set, as the opentelemetry-api
3030
# defines the interface with a no-op implementation.
31+
# It must be done before instrumenting any library.
3132
trace.set_tracer_provider(TracerProvider())
32-
tracer_provider = trace.get_tracer_provider()
3333

34+
# Enable instrumentation in the requests library.
35+
http_requests.RequestsInstrumentor().instrument()
36+
37+
# Configure a console span exporter.
3438
exporter = ConsoleSpanExporter()
3539
span_processor = BatchExportSpanProcessor(exporter)
36-
tracer_provider.add_span_processor(span_processor)
40+
trace.get_tracer_provider().add_span_processor(span_processor)
3741

3842
# Integrations are the glue that binds the OpenTelemetry API and the
3943
# frameworks and libraries that are used together, automatically creating
4044
# Spans and propagating context as appropriate.
41-
http_requests.enable(tracer_provider)
4245
response = requests.get(url="http://127.0.0.1:5000/")

docs/examples/http/server.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,23 @@
3030

3131
# The preferred tracer implementation must be set, as the opentelemetry-api
3232
# defines the interface with a no-op implementation.
33+
# It must be done before instrumenting any library.
3334
trace.set_tracer_provider(TracerProvider())
34-
tracer = trace.get_tracer(__name__)
35-
36-
exporter = ConsoleSpanExporter()
37-
span_processor = BatchExportSpanProcessor(exporter)
38-
trace.get_tracer_provider().add_span_processor(span_processor)
3935

4036
# Integrations are the glue that binds the OpenTelemetry API and the
4137
# frameworks and libraries that are used together, automatically creating
4238
# Spans and propagating context as appropriate.
43-
http_requests.enable(trace.get_tracer_provider())
39+
http_requests.RequestsInstrumentor().instrument()
4440
app = flask.Flask(__name__)
4541
app.wsgi_app = OpenTelemetryMiddleware(app.wsgi_app)
4642

43+
# Configure a console span exporter.
44+
exporter = ConsoleSpanExporter()
45+
span_processor = BatchExportSpanProcessor(exporter)
46+
trace.get_tracer_provider().add_span_processor(span_processor)
47+
48+
tracer = trace.get_tracer(__name__)
49+
4750

4851
@app.route("/")
4952
def hello():

docs/examples/http/tests/test_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_http(self):
3232
output = subprocess.check_output(
3333
(sys.executable, test_script)
3434
).decode()
35-
self.assertIn('name="/"', output)
35+
self.assertIn('"name": "/"', output)
3636

3737
@classmethod
3838
def teardown_class(cls):

docs/examples/opentelemetry-example-app/src/opentelemetry_example_app/flask_example.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,20 @@
2828
SimpleExportSpanProcessor,
2929
)
3030

31+
# The preferred tracer implementation must be set, as the opentelemetry-api
32+
# defines the interface with a no-op implementation.
33+
# It must be done before instrumenting any library
3134
trace.set_tracer_provider(TracerProvider())
35+
36+
opentelemetry.ext.http_requests.RequestsInstrumentor().instrument()
37+
FlaskInstrumentor().instrument()
38+
3239
trace.get_tracer_provider().add_span_processor(
3340
SimpleExportSpanProcessor(ConsoleSpanExporter())
3441
)
3542

36-
FlaskInstrumentor().instrument()
43+
3744
app = flask.Flask(__name__)
38-
opentelemetry.ext.http_requests.enable(trace.get_tracer_provider())
3945

4046

4147
@app.route("/")

docs/examples/opentelemetry-example-app/src/opentelemetry_example_app/grpc/hello_world_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
trace.get_tracer_provider().add_span_processor(
6565
SimpleExportSpanProcessor(ConsoleSpanExporter())
6666
)
67-
tracer = trace.get_tracer(__name__)
6867

6968

7069
def run():
@@ -73,7 +72,7 @@ def run():
7372
# of the code.
7473
with grpc.insecure_channel("localhost:50051") as channel:
7574

76-
channel = intercept_channel(channel, client_interceptor(tracer))
75+
channel = intercept_channel(channel, client_interceptor())
7776

7877
stub = helloworld_pb2_grpc.GreeterStub(channel)
7978

0 commit comments

Comments
 (0)