Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any
from functools import wraps
import asyncio
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
from opentelemetry.trace import Span

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -38,9 +39,3 @@ def set_span_attribute(span: Span, name: str, value: Any) -> None:
set_span_attribute(span, f"{name}.{index}", item)
else:
span.set_attribute(name, value)


def should_send_prompts() -> bool:
"""Check if prompts should be sent based on environment variables."""
import os
return os.getenv("TRACELOOP_TRACE_CONTENT", "true").lower() == "true"
3 changes: 2 additions & 1 deletion packages/opentelemetry-instrumentation-agno/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.28.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -76,4 +76,5 @@ select = ["E", "F", "W"]
constraint-dependencies = ["urllib3>=2.6.3", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
opentelemetry-instrumentation-openai = { path = "../opentelemetry-instrumentation-openai", editable = true }
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""OpenTelemetry Aleph Alpha instrumentation"""

import logging
import os
from typing import Collection, List, Optional, Union

from opentelemetry import context as context_api
Expand Down Expand Up @@ -31,6 +30,7 @@
LLMRequestTypeValues,
SpanAttributes,
)
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
from opentelemetry.trace import SpanKind, Tracer, get_tracer
from opentelemetry.trace.span import Span
from opentelemetry.trace.status import Status, StatusCode
Expand All @@ -47,14 +47,6 @@
},
]

TRACELOOP_TRACE_CONTENT = "TRACELOOP_TRACE_CONTENT"


def should_send_prompts():
return (
os.getenv(TRACELOOP_TRACE_CONTENT) or "true"
).lower() == "true" or context_api.get_value("override_enable_content_tracing")


def should_emit_events():
return not Config.use_legacy_attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.38.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -74,3 +74,6 @@ select = ["E", "F", "W"]

[tool.uv]
constraint-dependencies = ["urllib3>=2.6.3", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import inspect
import json
import logging
import os
import threading
import traceback
from importlib.metadata import version

from opentelemetry import context as context_api
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
from opentelemetry.instrumentation.anthropic.config import Config
from opentelemetry.semconv._incubating.attributes import (
gen_ai_attributes as GenAIAttributes,
Expand All @@ -27,12 +26,6 @@ def set_span_attribute(span, name, value):
return


def should_send_prompts():
return (
os.getenv(TRACELOOP_TRACE_CONTENT) or "true"
).lower() == "true" or context_api.get_value("override_enable_content_tracing")


def dont_throw(func):
"""
A decorator that wraps the passed in function and logs exceptions instead of throwing them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.38.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -74,3 +74,6 @@ select = ["E", "F", "W"]

[tool.uv]
constraint-dependencies = ["urllib3>=2.6.3", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logging
import os
import traceback

from opentelemetry import context as context_api
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
from opentelemetry.instrumentation.bedrock.config import Config

TRACELOOP_TRACE_CONTENT = "TRACELOOP_TRACE_CONTENT"
Expand Down Expand Up @@ -33,12 +32,6 @@ def wrapper(*args, **kwargs):
return wrapper


def should_send_prompts():
return (
os.getenv(TRACELOOP_TRACE_CONTENT) or "true"
).lower() == "true" or context_api.get_value("override_enable_content_tracing")


def should_emit_events() -> bool:
"""
Checks if the instrumentation isn't using the legacy attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.38.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -77,3 +77,6 @@ select = ["E", "F", "W"]

[tool.uv]
constraint-dependencies = ["urllib3>=2.6.3", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import dataclasses
import json
import logging
import os
import traceback

from opentelemetry import context as context_api
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
from opentelemetry.instrumentation.cohere.config import Config

TRACELOOP_TRACE_CONTENT = "TRACELOOP_TRACE_CONTENT"
Expand Down Expand Up @@ -35,12 +34,6 @@ def wrapper(*args, **kwargs):
return wrapper


def should_send_prompts():
return (
os.getenv(TRACELOOP_TRACE_CONTENT) or "true"
).lower() == "true" or context_api.get_value("override_enable_content_tracing")


def should_emit_events() -> bool:
"""
Checks if the instrumentation isn't using the legacy attributes
Expand Down
5 changes: 4 additions & 1 deletion packages/opentelemetry-instrumentation-cohere/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.38.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -74,3 +74,6 @@ select = ["E", "F", "W"]

[tool.uv]
constraint-dependencies = ["urllib3>=2.6.3", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import importlib
import importlib.util
import logging
import os
import traceback

from opentelemetry import context as context_api
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
from opentelemetry.instrumentation.google_generativeai.config import Config

TRACELOOP_TRACE_CONTENT = "TRACELOOP_TRACE_CONTENT"
Expand Down Expand Up @@ -54,12 +53,6 @@ def wrapper(*args, **kwargs):
return wrapper


def should_send_prompts():
return (
os.getenv(TRACELOOP_TRACE_CONTENT) or "true"
).lower() == "true" or context_api.get_value("override_enable_content_tracing")


def should_emit_events() -> bool:
"""
Checks if the instrumentation isn't using the legacy attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.38.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -73,3 +73,6 @@ select = ["E", "F", "W"]

[tool.uv]
constraint-dependencies = ["urllib3>=2.6.3", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import logging
import os
import traceback
from importlib.metadata import version

from opentelemetry import context as context_api
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
from opentelemetry.instrumentation.groq.config import Config
from opentelemetry.semconv._incubating.attributes import (
gen_ai_attributes as GenAIAttributes,
Expand All @@ -19,12 +18,6 @@ def set_span_attribute(span, name, value):
span.set_attribute(name, value)


def should_send_prompts():
return (os.getenv(TRACELOOP_TRACE_CONTENT) or "true").lower() == "true" or context_api.get_value(
"override_enable_content_tracing"
)


def dont_throw(func):
"""
A decorator that wraps the passed in function and logs exceptions instead of throwing them.
Expand Down
5 changes: 4 additions & 1 deletion packages/opentelemetry-instrumentation-groq/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.38.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -73,3 +73,6 @@ select = ["E", "F", "W"]

[tool.uv]
constraint-dependencies = ["urllib3>=2.6.3", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import dataclasses
import json
import logging
import os
import traceback

from opentelemetry import context as context_api
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
from opentelemetry.instrumentation.haystack.config import Config
from opentelemetry.semconv_ai import SpanAttributes

Expand All @@ -18,12 +17,6 @@ def default(self, o):
return super().default(o)


def should_send_prompts():
return (
os.getenv("TRACELOOP_TRACE_CONTENT") or "true"
).lower() == "true" or context_api.get_value("override_enable_content_tracing")


def dont_throw(func):
"""
A decorator that wraps the passed in function and logs exceptions instead of throwing them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.38.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -73,3 +73,6 @@ select = ["E", "F", "W"]

[tool.uv]
constraint-dependencies = ["urllib3>=2.6.3", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import importlib.util
import json
import logging
import os
import traceback

from opentelemetry import context as context_api
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts
from opentelemetry._logs import Logger
from opentelemetry.instrumentation.langchain.config import Config
from opentelemetry.semconv._incubating.attributes import (
Expand Down Expand Up @@ -46,12 +45,6 @@ def default(self, o):
return ""


def should_send_prompts():
return (
os.getenv(TRACELOOP_TRACE_CONTENT) or "true"
).lower() == "true" or context_api.get_value("override_enable_content_tracing")


def dont_throw(func):
"""
A decorator that wraps the passed in function and logs exceptions instead of throwing them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"opentelemetry-api>=1.38.0,<2",
"opentelemetry-instrumentation>=0.59b0",
"opentelemetry-semantic-conventions-ai>=0.5.1,<0.6.0",
"opentelemetry-semantic-conventions-ai>=0.5.2,<0.6.0",
"opentelemetry-semantic-conventions>=0.63b1",
]

Expand Down Expand Up @@ -91,6 +91,7 @@ select = ["E", "F", "W"]
constraint-dependencies = ["urllib3>=2.6.3", "langgraph-checkpoint>=4.0.0", "pip>=25.3"]

[tool.uv.sources]
opentelemetry-semantic-conventions-ai = { path = "../opentelemetry-semantic-conventions-ai", editable = true }
opentelemetry-instrumentation-bedrock = { path = "../opentelemetry-instrumentation-bedrock", editable = true }
opentelemetry-instrumentation-openai = { path = "../opentelemetry-instrumentation-openai", editable = true }

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@
import os
import traceback

from opentelemetry import context as context_api
from opentelemetry.instrumentation.litellm.config import Config

TRACELOOP_TRACE_CONTENT = "TRACELOOP_TRACE_CONTENT"


def should_send_prompts():
return (
os.getenv(TRACELOOP_TRACE_CONTENT) or "true"
).lower() == "true" or context_api.get_value("override_enable_content_tracing")
from opentelemetry.semconv_ai.utils import should_send_prompts as should_send_prompts


def is_metrics_enabled() -> bool:
Expand Down
Loading