Skip to content

Commit cbcd550

Browse files
committed
default enabled to rc setting
1 parent 47d74ed commit cbcd550

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

guardrails/hub_telemetry/hub_tracing.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Any,
44
Dict,
55
Optional,
6-
TypeVar,
76
)
87

98
from opentelemetry.trace import Span
@@ -15,8 +14,6 @@
1514
from guardrails.utils.safe_get import safe_get
1615
from guardrails.utils.hub_telemetry_utils import HubTelemetry
1716

18-
R = TypeVar("R", covariant=True)
19-
2017

2118
def get_guard_call_attributes(
2219
attrs: Dict[str, Any], origin: str, *args, **kwargs

guardrails/utils/hub_telemetry_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33
from typing import Optional
44

5+
from guardrails.settings import settings
56
from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( # HTTP Exporter
67
OTLPSpanExporter,
78
)
@@ -32,7 +33,7 @@ def __new__(
3233
tracer_name: str = "gr_hub",
3334
export_locally: bool = False,
3435
*,
35-
enabled: Optional[bool] = False,
36+
enabled: Optional[bool] = None,
3637
):
3738
if cls._instance is None:
3839
logging.debug("Creating HubTelemetry instance...")
@@ -51,9 +52,11 @@ def initialize_tracer(
5152
tracer_name: str,
5253
export_locally: bool,
5354
*,
54-
enabled: Optional[bool] = False,
55+
enabled: Optional[bool] = None,
5556
):
5657
"""Initializes a tracer for Guardrails Hub."""
58+
if enabled is None:
59+
enabled = settings.rc.enable_metrics or False
5760

5861
self._enabled = enabled
5962
self._carrier = {}

0 commit comments

Comments
 (0)