Skip to content

Commit a569582

Browse files
authored
Many changes including OpenTelemetry support (#77)
1 parent 5926b76 commit a569582

File tree

82 files changed

+7012
-919
lines changed

Some content is hidden

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

82 files changed

+7012
-919
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
with:
4141
go-version: "1.18"
4242
- run: python -m pip install --upgrade wheel poetry poethepoet
43-
- run: poetry install --no-root
43+
- run: poetry install --no-root -E opentelemetry
4444
- run: poe lint
4545
- run: poe build-develop
4646
- run: poe test -s -o log_cli_level=DEBUG
@@ -117,7 +117,7 @@ jobs:
117117

118118
# Prepare
119119
- run: python -m pip install --upgrade wheel poetry poethepoet
120-
- run: poetry install --no-root
120+
- run: poetry install --no-root -E opentelemetry
121121

122122
# Add the source dist only for Linux x64 for now
123123
- if: ${{ matrix.package-suffix == 'linux-amd64' }}
@@ -164,7 +164,7 @@ jobs:
164164

165165
# Prepare
166166
- run: python -m pip install --upgrade wheel poetry poethepoet
167-
- run: poetry install --no-root
167+
- run: poetry install --no-root -E opentelemetry
168168

169169
# Build and fix the wheel
170170
- run: poetry run cibuildwheel --output-dir dist --arch aarch64
@@ -175,4 +175,3 @@ jobs:
175175
with:
176176
name: packages-linux-aarch64
177177
path: dist
178-

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,18 @@ cancellation of all outstanding activities.
582582
The `shutdown()` invocation will wait on all activities to complete, so if a long-running activity does not at least
583583
respect cancellation, the shutdown may never complete.
584584

585+
### OpenTelemetry Support
586+
587+
OpenTelemetry support requires the optional `opentelemetry` dependencies which are part of the `opentelemetry` extra.
588+
When using `pip`, running
589+
590+
pip install temporalio[opentelemetry]
591+
592+
will install needed dependencies. Then the `temporalio.contrib.opentelemetry.TracingInterceptor` can be created and set
593+
as an interceptor on the `interceptors` argument of `Client.connect`. When set, spans will be created for all client
594+
calls and for all activity and workflow invocations on the worker, spans will be created and properly serialized through
595+
the server to give one proper trace for a workflow execution.
596+
585597
## Development
586598

587599
The Python SDK is built to work with Python 3.7 and newer. It is built using

poetry.lock

Lines changed: 218 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ script = "build.py"
2727
[tool.poetry.dependencies]
2828
dacite = "^1.6.0"
2929
grpcio = "^1.47.0"
30+
opentelemetry-api = { version = "^1.11.1", optional = true }
31+
opentelemetry-sdk = { version = "^1.11.1", optional = true }
3032
protobuf = "^3.20.1"
3133
python = "^3.7"
3234
types-protobuf = "^3.19.21"
@@ -51,6 +53,9 @@ setuptools-rust = "^1.3.0"
5153
toml = "^0.10.2"
5254
twine = "^4.0.1"
5355

56+
[tool.poetry.extras]
57+
opentelemetry = ["opentelemetry-api", "opentelemetry-sdk"]
58+
5459
[tool.poe.tasks]
5560
build-develop = ["build-bridge-develop"]
5661
build-bridge-develop = "python scripts/setup_bridge.py develop"
@@ -67,7 +72,7 @@ lint = [
6772
# TODO(cretz): Why does pydocstyle complain about @overload missing docs after
6873
# https://github.com/PyCQA/pydocstyle/pull/511?
6974
lint-docs = "pydocstyle --ignore-decorators=overload"
70-
lint-types = "mypy ."
75+
lint-types = "mypy --namespace-packages ."
7176
test = "pytest"
7277

7378
# Install local, run single pytest with env var, uninstall local
@@ -133,7 +138,11 @@ add_ignore = [
133138
add-package = ["temporalio"]
134139
docformat = "google"
135140
html-output = "build/apidocs"
136-
intersphinx = ["https://docs.python.org/3/objects.inv", "https://googleapis.dev/python/protobuf/latest/objects.inv"]
141+
intersphinx = [
142+
"https://docs.python.org/3/objects.inv",
143+
"https://googleapis.dev/python/protobuf/latest/objects.inv",
144+
"https://opentelemetry-python.readthedocs.io/en/latest/objects.inv",
145+
]
137146
privacy = [
138147
"PRIVATE:temporalio.bridge",
139148
"PRIVATE:temporalio.types",

temporalio/api/cluster/__init__.py

Whitespace-only changes.

temporalio/api/cluster/v1/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from .message_pb2 import (
2+
ClusterMember,
3+
ClusterMetadata,
4+
HostInfo,
5+
IndexSearchAttributes,
6+
MembershipInfo,
7+
RingInfo,
8+
)
9+
10+
__all__ = [
11+
"ClusterMember",
12+
"ClusterMetadata",
13+
"HostInfo",
14+
"IndexSearchAttributes",
15+
"MembershipInfo",
16+
"RingInfo",
17+
]

temporalio/api/cluster/v1/message_pb2.py

Lines changed: 170 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)