Skip to content

Pass through global telemetry tags #303

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 2 commits into from
Apr 3, 2023
Merged

Conversation

ytaben
Copy link
Contributor

@ytaben ytaben commented Mar 27, 2023

What was changed

This PR adds python representation of global_tags and passes them through to rust version

Why?

See temporalio/sdk-core#518 for the base PR in the core SDK. This PR just adds means to set the new parameter from Python

The result should allow us to identify resources reporting metrics (i.e. service name, host ID, environment, etc)

Checklist

  1. Closes (closed the issue in sdk-core. Doesn't seem to be one here)

  2. How was this tested:
    Tested in the original PR

  3. Any docs updates needed?
    Unlikely (unless we document telemetry fields somewhere)

Note: I bumped the sdk-core submodule to current master. The project does not build with that version (and did not seem to build even before I touched it). I did my tests with my work applied on top of the commit referenced in the current submodule.
My current understanding is that this is not caused by me and needs to be addressed by the maintainers at some point.

@CLAassistant
Copy link

CLAassistant commented Mar 27, 2023

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately this is going to incur a larger cost. Core changed shutdown mechanisms and a couple of other things. I have a commit at main...cretz:temporal-sdk-python:core-update that will update everything to latest core, but we need to get temporalio/sdk-core#519 done first.

Once that core issue is fixed and I can then update core, we can revisit this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I figured the build fix might take some effort.
Let me know with a ping when we can revisit.

Copy link
Member

Choose a reason for hiding this comment

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

This is in PR at #307. Will update when merged (also needs #304 which fixes CI poetry issues).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cretz looks to be merged. Rebased on your main

Copy link
Member

Choose a reason for hiding this comment

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

Awesome, running CI then will merge if/when it passes.

@@ -175,6 +175,8 @@ class TelemetryConfig:
metrics: Optional[Union[OpenTelemetryConfig, PrometheusConfig]] = None
"""Metrics configuration."""

global_tags: Mapping[str, str] = field(default_factory=dict)
Copy link
Member

Choose a reason for hiding this comment

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

Are these tags applied to metrics and tracing? Does that include Prometheus metrics and OTel tracing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes to all of the above.
I did not test prometheus myself (as we don't use it) but I do pass these through to the initializer

Copy link
Member

Choose a reason for hiding this comment

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

Oh, just realized. Can we at least add one line of docs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@ytaben ytaben force-pushed the ytaben/metric-tags branch from 3a0dc4d to 52045ec Compare March 31, 2023 15:59
@ytaben ytaben force-pushed the ytaben/metric-tags branch from 8f5bc60 to eb556cc Compare March 31, 2023 20:20
@ytaben
Copy link
Contributor Author

ytaben commented Apr 3, 2023

@cretz Looks like CI is now passing (after some retries it seems)

@cretz
Copy link
Member

cretz commented Apr 3, 2023

Yup, merging. Thanks!

@cretz cretz merged commit dbf96fd into temporalio:main Apr 3, 2023
@ytaben ytaben deleted the ytaben/metric-tags branch April 3, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants