Skip to content

Commit d4ec271

Browse files
Fix add_thread_tag signature for pyroscope-io 1.x and lock dependency (#31)
pyroscope-io 1.0.x dropped the thread_id parameter from add_thread_tag and remove_thread_tag, changing the signature from (thread_id, key, value) to (key, value). Update all call sites accordingly and remove the now-unused threading import. Also constrain the pyroscope-io dependency to >=1.0.0, <2.0.0 to prevent accidental installation of the incompatible 0.x series and to guard against future breaking changes in 2.x. Fixes #30 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1b3b46b commit d4ec271

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ requires-python = ">= 3.8"
1111
dependencies = [
1212
"opentelemetry-api>=1.27.0, <2.0.0",
1313
"opentelemetry-sdk>=1.27.0, <2.0.0",
14-
"pyroscope-io>=0.8.10"
14+
"pyroscope-io>=1.0.0, <2.0.0"
1515
]
1616
license = {file = "LICENSE"}

src/pyroscope/otel/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import typing
2-
import threading
32

43
from opentelemetry.sdk.trace import (
54
Span,
@@ -28,13 +27,13 @@ def on_start(
2827
) -> None:
2928
if _is_root_span(span):
3029
span.set_attribute(PROFILE_ID_SPAN_ATTRIBUTE_KEY, format(span.context.span_id, "016x"))
31-
pyroscope.add_thread_tag(threading.get_ident(), PROFILE_ID_PYROSCOPE_TAG_KEY, _get_span_id(span))
32-
pyroscope.add_thread_tag(threading.get_ident(), SPAN_NAME_PYROSCOPE_TAG_KEY, span.name)
30+
pyroscope.add_thread_tag(PROFILE_ID_PYROSCOPE_TAG_KEY, _get_span_id(span))
31+
pyroscope.add_thread_tag(SPAN_NAME_PYROSCOPE_TAG_KEY, span.name)
3332

3433
def on_end(self, span: ReadableSpan) -> None:
3534
if _is_root_span(span):
36-
pyroscope.remove_thread_tag(threading.get_ident(), PROFILE_ID_PYROSCOPE_TAG_KEY, _get_span_id(span))
37-
pyroscope.remove_thread_tag(threading.get_ident(), SPAN_NAME_PYROSCOPE_TAG_KEY, span.name)
35+
pyroscope.remove_thread_tag(PROFILE_ID_PYROSCOPE_TAG_KEY, _get_span_id(span))
36+
pyroscope.remove_thread_tag(SPAN_NAME_PYROSCOPE_TAG_KEY, span.name)
3837

3938
def shutdown(self) -> None:
4039
pass

0 commit comments

Comments
 (0)