Skip to content

Several minor changes and OpenTelemetry support #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
with:
go-version: "1.18"
- run: python -m pip install --upgrade wheel poetry poethepoet
- run: poetry install --no-root
- run: poetry install --no-root -E opentelemetry
- run: poe lint
- run: poe build-develop
- run: poe test -s -o log_cli_level=DEBUG
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:

# Prepare
- run: python -m pip install --upgrade wheel poetry poethepoet
- run: poetry install --no-root
- run: poetry install --no-root -E opentelemetry

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

# Prepare
- run: python -m pip install --upgrade wheel poetry poethepoet
- run: poetry install --no-root
- run: poetry install --no-root -E opentelemetry

# Build and fix the wheel
- run: poetry run cibuildwheel --output-dir dist --arch aarch64
Expand All @@ -175,4 +175,3 @@ jobs:
with:
name: packages-linux-aarch64
path: dist

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,18 @@ cancellation of all outstanding activities.
The `shutdown()` invocation will wait on all activities to complete, so if a long-running activity does not at least
respect cancellation, the shutdown may never complete.

### OpenTelemetry Support

OpenTelemetry support requires the optional `opentelemetry` dependencies which are part of the `opentelemetry` extra.
When using `pip`, running

pip install temporalio[opentelemetry]

will install needed dependencies. Then the `temporalio.contrib.opentelemetry.TracingInterceptor` can be created and set
as an interceptor on the `interceptors` argument of `Client.connect`. When set, spans will be created for all client
calls and for all activity and workflow invocations on the worker, spans will be created and properly serialized through
the server to give one proper trace for a workflow execution.

## Development

The Python SDK is built to work with Python 3.7 and newer. It is built using
Expand Down
297 changes: 218 additions & 79 deletions poetry.lock

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ script = "build.py"
[tool.poetry.dependencies]
dacite = "^1.6.0"
grpcio = "^1.47.0"
opentelemetry-api = { version = "^1.11.1", optional = true }
opentelemetry-sdk = { version = "^1.11.1", optional = true }
protobuf = "^3.20.1"
python = "^3.7"
types-protobuf = "^3.19.21"
Expand All @@ -51,6 +53,9 @@ setuptools-rust = "^1.3.0"
toml = "^0.10.2"
twine = "^4.0.1"

[tool.poetry.extras]
opentelemetry = ["opentelemetry-api", "opentelemetry-sdk"]

[tool.poe.tasks]
build-develop = ["build-bridge-develop"]
build-bridge-develop = "python scripts/setup_bridge.py develop"
Expand All @@ -67,7 +72,7 @@ lint = [
# TODO(cretz): Why does pydocstyle complain about @overload missing docs after
# https://github.com/PyCQA/pydocstyle/pull/511?
lint-docs = "pydocstyle --ignore-decorators=overload"
lint-types = "mypy ."
lint-types = "mypy --namespace-packages ."
test = "pytest"

# Install local, run single pytest with env var, uninstall local
Expand Down Expand Up @@ -133,7 +138,11 @@ add_ignore = [
add-package = ["temporalio"]
docformat = "google"
html-output = "build/apidocs"
intersphinx = ["https://docs.python.org/3/objects.inv", "https://googleapis.dev/python/protobuf/latest/objects.inv"]
intersphinx = [
"https://docs.python.org/3/objects.inv",
"https://googleapis.dev/python/protobuf/latest/objects.inv",
"https://opentelemetry-python.readthedocs.io/en/latest/objects.inv",
]
privacy = [
"PRIVATE:temporalio.bridge",
"PRIVATE:temporalio.types",
Expand Down
Empty file.
17 changes: 17 additions & 0 deletions temporalio/api/cluster/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from .message_pb2 import (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything in this temporalio/api directory can be ignored. It is auto-generated source.

ClusterMember,
ClusterMetadata,
HostInfo,
IndexSearchAttributes,
MembershipInfo,
RingInfo,
)

__all__ = [
"ClusterMember",
"ClusterMetadata",
"HostInfo",
"IndexSearchAttributes",
"MembershipInfo",
"RingInfo",
]
170 changes: 170 additions & 0 deletions temporalio/api/cluster/v1/message_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading