Skip to content

Commit f2fe921

Browse files
committed
2 parents d330346 + cc18b73 commit f2fe921

File tree

42 files changed

+541
-113
lines changed

Some content is hidden

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

42 files changed

+541
-113
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.1.0...HEAD)
88

9+
### Changed
10+
- Include span parent in Jaeger gRPC export as `CHILD_OF` reference
11+
([#1809])(https://github.com/open-telemetry/opentelemetry-python/pull/1809)
12+
913
### Added
1014
- Added example for running Django with auto instrumentation.
1115
([#1803](https://github.com/open-telemetry/opentelemetry-python/pull/1803))
16+
- Added support for OTEL_SERVICE_NAME.
17+
([#1829](https://github.com/open-telemetry/opentelemetry-python/pull/1829))
1218

1319
### Changed
1420
- Fixed OTLP gRPC exporter silently failing if scheme is not specified in endpoint.
1521
([#1806](https://github.com/open-telemetry/opentelemetry-python/pull/1806))
22+
- Rename CompositeHTTPPropagator to CompositePropagator as per specification.
23+
([#1807](https://github.com/open-telemetry/opentelemetry-python/pull/1807))
24+
- Propagators use the root context as default for `extract` and do not modify
25+
the context if extracting from carrier does not work.
26+
([#1811](https://github.com/open-telemetry/opentelemetry-python/pull/1811))
27+
- Improve warning when failing to decode byte attribute
28+
([#1810](https://github.com/open-telemetry/opentelemetry-python/pull/1810))
29+
- Fixed inconsistency in parent_id formatting from the ConsoleSpanExporter
30+
([#1833](https://github.com/open-telemetry/opentelemetry-python/pull/1833))
1631

1732
### Removed
1833
- Moved `opentelemetry-instrumentation` to contrib repository.

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This is the main repo for OpenTelemetry Python. Nevertheless, there are other re
1919
Please take a look at this list first, your contributions may belong in one of these repos better:
2020

2121
1. [OpenTelemetry Contrib](https://github.com/open-telemetry/opentelemetry-python-contrib): Instrumentations for third-party
22-
libraries and frameworks. There is an ongoing effort to migrate into the Opentelemetry Contrib repo some of the existing
22+
libraries and frameworks. There is an ongoing effort to migrate into the OpenTelemetry Contrib repo some of the existing
2323
programmatic instrumentations that are now in the `ext` directory in the main OpenTelemetry repo. Please ask in the Slack
2424
channel (see below) for guidance if you want to contribute with these instrumentations.
2525

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telem
132132

133133
- [Aaron Abbott](https://github.com/aabmass), Google
134134
- [Diego Hurtado](https://github.com/ocelotl)
135-
- [Hector Hernandez](https://github.com/hectorhdzg), Microsoft
136135
- [Owais Lone](https://github.com/owais), Splunk
137136
- [Srikanth Chekuri](https://github.com/lonewolf3739)
138137

dev-requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ isort~=5.8
44
black~=20.8b1
55
httpretty~=1.0
66
mypy==0.812
7-
sphinx~=2.1
8-
sphinx-rtd-theme~=0.4
9-
sphinx-autodoc-typehints~=1.10.2
7+
sphinx~=3.5.4
8+
sphinx-rtd-theme~=0.5
9+
sphinx-autodoc-typehints
1010
pytest>=6.0
1111
pytest-cov>=2.8
1212
readme-renderer~=24.0

docs-requirements.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
sphinx~=2.4
2-
sphinx-rtd-theme~=0.4
1+
sphinx~=3.5.4
2+
sphinx-rtd-theme~=0.5
33
sphinx-autodoc-typehints
4+
# used to generate docs for the website
5+
sphinx-jekyll-builder
46

57
# Need to install the api/sdk in the venv for autodoc. Modifying sys.path
68
# doesn't work for pkg_resources.

docs/conf.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,15 @@
125125
# List of patterns, relative to source directory, that match files and
126126
# directories to ignore when looking for source files.
127127
# This pattern also affects html_static_path and html_extra_path.
128-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
128+
exclude_patterns = [
129+
"_build",
130+
"Thumbs.db",
131+
".DS_Store",
132+
"examples/fork-process-model/flask-gunicorn",
133+
"examples/fork-process-model/flask-uwsgi",
134+
"examples/error_handler/error_handler_0",
135+
"examples/error_handler/error_handler_1",
136+
]
129137

130138
autodoc_default_options = {
131139
"members": True,

docs/examples/auto-instrumentation/README.rst

+14-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Manually instrumented server
4545
return "served"
4646
4747
Server not instrumented manually
48-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4949

5050
``server_uninstrumented.py``
5151

@@ -57,7 +57,7 @@ Server not instrumented manually
5757
return "served"
5858
5959
Prepare
60-
-----------
60+
-------
6161

6262
Execute the following example in a separate virtual environment.
6363
Run the following commands to prepare for auto-instrumentation:
@@ -69,7 +69,7 @@ Run the following commands to prepare for auto-instrumentation:
6969
$ source auto_instrumentation/bin/activate
7070
7171
Install
72-
------------
72+
-------
7373

7474
Run the following commands to install the appropriate packages. The
7575
``opentelemetry-instrumentation`` package provides several
@@ -90,7 +90,7 @@ a server as well as the process of executing an automatically
9090
instrumented server.
9191

9292
Execute a manually instrumented server
93-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9494

9595
Execute the server in two separate consoles, one to run each of the
9696
scripts that make up this example:
@@ -145,7 +145,7 @@ similar to the following example:
145145
}
146146
147147
Execute an automatically instrumented server
148-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149149

150150
Stop the execution of ``server_instrumented.py`` with ``ctrl + c``
151151
and run the following command instead:
@@ -208,7 +208,7 @@ You can see that both outputs are the same because automatic instrumentation doe
208208
exactly what manual instrumentation does.
209209

210210
Instrumentation while debugging
211-
===============================
211+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212212

213213
The debug mode can be enabled in the Flask app like this:
214214

@@ -226,3 +226,11 @@ reloader. To run instrumentation while the debug mode is enabled, set the
226226
227227
if __name__ == "__main__":
228228
app.run(port=8082, debug=True, use_reloader=False)
229+
230+
231+
Additional resources
232+
~~~~~~~~~~~~~~~~~~~~
233+
234+
In order to send telemetry to an OpenTelemetry Collector without doing any
235+
additional configuration, read about the `OpenTelemetry Distro <../distro/README.html>`_
236+
package.

docs/examples/basic_context/README.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
Basic Context
22
=============
33

4-
These examples show how context is propagated through Spans in OpenTelemetry.
5-
6-
There are three different examples:
4+
These examples show how context is propagated through Spans in OpenTelemetry. There are three different
5+
examples:
76

87
* implicit_context: Shows how starting a span implicitly creates context.
9-
108
* child_context: Shows how context is propagated through child spans.
11-
129
* async_context: Shows how context can be shared in another coroutine.
1310

1411
The source files of these examples are available :scm_web:`here <docs/examples/basic_context/>`.

docs/examples/basic_tracer/README.rst

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
Basic Trace
22
===========
33

4-
These examples show how to use OpenTelemetry to create and export Spans.
5-
6-
There are two different examples:
4+
These examples show how to use OpenTelemetry to create and export Spans. There are two different examples:
75

86
* basic_trace: Shows how to configure a SpanProcessor and Exporter, and how to create a tracer and span.
9-
107
* resources: Shows how to add resource information to a Provider.
118

129
The source files of these examples are available :scm_web:`here <docs/examples/basic_tracer/>`.

docs/examples/datadog_exporter/README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Datadog Exporter Example
2-
========================
1+
Datadog Exporter
2+
================
33

44
These examples show how to use OpenTelemetry to send tracing data to Datadog.
55

docs/examples/datadog_exporter/server.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222
from opentelemetry.exporter.datadog.propagator import DatadogFormat
2323
from opentelemetry.propagate import get_global_textmap, set_global_textmap
24-
from opentelemetry.propagators.composite import CompositeHTTPPropagator
24+
from opentelemetry.propagators.composite import CompositePropagator
2525
from opentelemetry.sdk.trace import TracerProvider
2626

2727
app = Flask(__name__)
@@ -38,13 +38,11 @@
3838

3939
# append Datadog format for propagation to and from Datadog instrumented services
4040
global_textmap = get_global_textmap()
41-
if isinstance(global_textmap, CompositeHTTPPropagator) and not any(
41+
if isinstance(global_textmap, CompositePropagator) and not any(
4242
isinstance(p, DatadogFormat) for p in global_textmap._propagators
4343
):
4444
set_global_textmap(
45-
CompositeHTTPPropagator(
46-
global_textmap._propagators + [DatadogFormat()]
47-
)
45+
CompositePropagator(global_textmap._propagators + [DatadogFormat()])
4846
)
4947
else:
5048
set_global_textmap(DatadogFormat())

docs/examples/distro/README.rst

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
OpenTelemetry Distro
2+
====================
3+
4+
In order to make using OpenTelemetry and auto-instrumentation as quick as possible without sacrificing flexibility,
5+
OpenTelemetry distros provide a mechanism to automatically configure some of the more common options for users. By
6+
harnessing their power, users of OpenTelemetry can configure the components as they need. The ``opentelemetry-distro``
7+
package provides some defaults to users looking to get started, it configures:
8+
9+
- the SDK TracerProvider
10+
- a BatchSpanProcessor
11+
- the OTLP ``SpanExporter`` to send data to an OpenTelemetry collector
12+
13+
The package also provides a starting point for anyone interested in producing an alternative distro. The
14+
interfaces implemented by the package are loaded by the auto-instrumentation via the ``opentelemetry_distro``
15+
and ``opentelemetry_configurator`` entry points to configure the application before any other code is
16+
executed.
17+
18+
In order to automatically export data from OpenTelemetry to the OpenTelemetry collector, installing the
19+
package will setup all the required entry points.
20+
21+
.. code:: sh
22+
23+
$ pip install opentelemetry-distro[otlp] opentelemetry-instrumentation
24+
25+
Start the Collector locally to see data being exported. Write the following file:
26+
27+
.. code-block:: yaml
28+
29+
# /tmp/otel-collector-config.yaml
30+
receivers:
31+
otlp:
32+
protocols:
33+
grpc:
34+
http:
35+
exporters:
36+
logging:
37+
loglevel: debug
38+
processors:
39+
batch:
40+
service:
41+
pipelines:
42+
traces:
43+
receivers: [otlp]
44+
exporters: [logging]
45+
processors: [batch]
46+
47+
Then start the Docker container:
48+
49+
.. code-block:: sh
50+
51+
docker run -p 4317:4317 \
52+
-v /tmp/otel-collector-config.yaml:/etc/otel-collector-config.yaml \
53+
otel/opentelemetry-collector:latest \
54+
--config=/etc/otel-collector-config.yaml
55+
56+
The following code will create a span with no configuration.
57+
58+
.. code:: python
59+
60+
# no_configuration.py
61+
from opentelemetry import trace
62+
63+
with trace.get_tracer(__name__).start_as_current_span("foo"):
64+
with trace.get_tracer(__name__).start_as_current_span("bar"):
65+
print("baz")
66+
67+
Lastly, run the ``no_configuration.py`` with the auto-instrumentation:
68+
69+
.. code-block:: sh
70+
71+
$ opentelemetry-instrument python no_configuration.py
72+
73+
The resulting span will appear in the output from the collector and look similar to this:
74+
75+
.. code-block:: sh
76+
77+
Resource labels:
78+
-> telemetry.sdk.language: STRING(python)
79+
-> telemetry.sdk.name: STRING(opentelemetry)
80+
-> telemetry.sdk.version: STRING(1.1.0)
81+
-> service.name: STRING(unknown_service)
82+
InstrumentationLibrarySpans #0
83+
InstrumentationLibrary __main__
84+
Span #0
85+
Trace ID : db3c99e5bfc50ef8be1773c3765e8845
86+
Parent ID : 0677126a4d110cb8
87+
ID : 3163b3022808ed1b
88+
Name : bar
89+
Kind : SPAN_KIND_INTERNAL
90+
Start time : 2021-05-06 22:54:51.23063 +0000 UTC
91+
End time : 2021-05-06 22:54:51.230684 +0000 UTC
92+
Status code : STATUS_CODE_UNSET
93+
Status message :
94+
Span #1
95+
Trace ID : db3c99e5bfc50ef8be1773c3765e8845
96+
Parent ID :
97+
ID : 0677126a4d110cb8
98+
Name : foo
99+
Kind : SPAN_KIND_INTERNAL
100+
Start time : 2021-05-06 22:54:51.230549 +0000 UTC
101+
End time : 2021-05-06 22:54:51.230706 +0000 UTC
102+
Status code : STATUS_CODE_UNSET
103+
Status message :
104+

docs/examples/django/README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
OpenTelemetry Django Instrumentation Example
2-
============================================
1+
Django Instrumentation
2+
======================
33

44
This shows how to use ``opentelemetry-instrumentation-django`` to automatically instrument a
55
Django app.
@@ -142,4 +142,4 @@ References
142142

143143
* `Django <https://djangoproject.com/>`_
144144
* `OpenTelemetry Project <https://opentelemetry.io/>`_
145-
* `OpenTelemetry Django extension <https://github.com/open-telemetry/opentelemetry-python-contib/tree/main/instrumentation/opentelemetry-instrumentation-django>`_
145+
* `OpenTelemetry Django extension <https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-django>`_

docs/examples/opencensus-exporter-tracer/README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
OpenTelemetry Collector Tracer OpenCensus Exporter Example
2-
==========================================================
1+
OpenCensus Exporter
2+
===================
33

44
This example shows how to use the OpenCensus Exporter to export traces to the
55
OpenTelemetry collector.

docs/examples/opentracing/README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
OpenTracing Shim Example
2-
==========================
1+
OpenTracing Shim
2+
================
33

44
This example shows how to use the :doc:`opentelemetry-opentracing-shim
55
package <../../shim/opentracing_shim/opentracing_shim>`

docs/exporter/jaeger/jaeger.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Opentelemetry Jaeger Exporters
1+
OpenTelemetry Jaeger Exporters
22
==============================
33

44
.. automodule:: opentelemetry.exporter.jaeger

docs/exporter/otlp/otlp.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Opentelemetry OTLP Exporters
1+
OpenTelemetry OTLP Exporters
22
============================
33

44
.. automodule:: opentelemetry.exporter.otlp

docs/getting_started/otlpcollector_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
span_exporter = OTLPSpanExporter(
2626
# optional
27-
# endpoint:="myCollectorURL:4317",
27+
# endpoint="myCollectorURL:4317",
2828
# credentials=ChannelCredentials(credentials),
2929
# headers=(("metadata", "metadata")),
3030
)

0 commit comments

Comments
 (0)