Skip to content

Commit 99431da

Browse files
lievanlievan
and
lievan
authored
chore(llmobs): fix telemetry namespace for ragas (#11279)
`ml_obs` is the correct namespace for llmobs that's been implemented in the telemetry backend update ragas telemetry metrics to use that namespace ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: lievan <[email protected]>
1 parent 19f4c58 commit 99431da

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

ddtrace/llmobs/_evaluators/ragas/faithfulness.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from ddtrace.internal.logger import get_logger
99
from ddtrace.internal.telemetry import telemetry_writer
10+
from ddtrace.internal.telemetry.constants import TELEMETRY_APM_PRODUCT
1011
from ddtrace.internal.telemetry.constants import TELEMETRY_LOG_LEVEL
1112
from ddtrace.internal.utils.version import parse_version
1213
from ddtrace.llmobs._constants import RAGAS_ML_APP_PREFIX
@@ -138,7 +139,7 @@ def __init__(self, llmobs_service):
138139
raise NotImplementedError("Failed to load dependencies for `ragas_faithfulness` evaluator") from e
139140
finally:
140141
telemetry_writer.add_count_metric(
141-
namespace="llmobs",
142+
namespace=TELEMETRY_APM_PRODUCT.LLMOBS,
142143
name="evaluators.init",
143144
value=1,
144145
tags=(
@@ -164,7 +165,7 @@ def run_and_submit_evaluation(self, span_event: dict):
164165
return
165166
score_result_or_failure = self.evaluate(span_event)
166167
telemetry_writer.add_count_metric(
167-
"llmobs",
168+
TELEMETRY_APM_PRODUCT.LLMOBS, # type: ignore
168169
"evaluators.run",
169170
1,
170171
tags=(

ddtrace/llmobs/_evaluators/runner.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ddtrace.internal.logger import get_logger
88
from ddtrace.internal.periodic import PeriodicService
99
from ddtrace.internal.telemetry import telemetry_writer
10+
from ddtrace.internal.telemetry.constants import TELEMETRY_APM_PRODUCT
1011
from ddtrace.llmobs._evaluators.ragas.faithfulness import RagasFaithfulnessEvaluator
1112
from ddtrace.llmobs._evaluators.sampler import EvaluatorRunnerSampler
1213

@@ -55,7 +56,7 @@ def __init__(self, interval: float, llmobs_service=None, evaluators=None):
5556
raise e
5657
finally:
5758
telemetry_writer.add_count_metric(
58-
namespace="llmobs",
59+
namespace=TELEMETRY_APM_PRODUCT.LLMOBS, # type: ignore
5960
name="evaluators.init",
6061
value=1,
6162
tags=(

ddtrace/llmobs/_evaluators/sampler.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ddtrace import config
99
from ddtrace.internal.logger import get_logger
1010
from ddtrace.internal.telemetry import telemetry_writer
11+
from ddtrace.internal.telemetry.constants import TELEMETRY_APM_PRODUCT
1112
from ddtrace.internal.telemetry.constants import TELEMETRY_LOG_LEVEL
1213
from ddtrace.sampling_rule import SamplingRule
1314

@@ -66,7 +67,7 @@ def parsing_failed_because(msg, maybe_throw_this):
6667
TELEMETRY_LOG_LEVEL.ERROR, message="Evaluator sampling parsing failure because: {}".format(msg)
6768
)
6869
telemetry_writer.add_count_metric(
69-
namespace="llmobs",
70+
namespace=TELEMETRY_APM_PRODUCT.LLMOBS,
7071
name="evaluators.error",
7172
value=1,
7273
tags=(("reason", "sampling_rule_parsing_failure"),),
@@ -103,7 +104,7 @@ def parsing_failed_because(msg, maybe_throw_this):
103104
span_name = rule.get(EvaluatorRunnerSamplingRule.SPAN_NAME_KEY, SamplingRule.NO_RULE)
104105
evaluator_label = rule.get(EvaluatorRunnerSamplingRule.EVALUATOR_LABEL_KEY, SamplingRule.NO_RULE)
105106
telemetry_writer.add_distribution_metric(
106-
"llmobs",
107+
TELEMETRY_APM_PRODUCT.LLMOBS, # type: ignore
107108
"evaluators.rule_sample_rate",
108109
sample_rate,
109110
tags=(("evaluator_label", evaluator_label), ("span_name", span_name)),

0 commit comments

Comments
 (0)