Repository navigation
refactor(telemetry): drop traceloop entity input/output and dead OpenInference mapping - #487
Open
LucasAlvesSoares wants to merge 2 commits into
Open
LucasAlvesSoares wants to merge 2 commits into
LucasAlvesSoares wants to merge 2 commits into
Conversation
LucasAlvesSoares
commented
Dec 1, 2026
LucasAlvesSoares
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: #487: refactor(telemetry): drop traceloop entity input/output and dead OpenInference mapping
Author: LucasAlvesSoares Branch: drop-traceloop-inputoutput → main
Verdict:
Summary: Clean, well-tested internal telemetry refactor; CI green and security-clean — only an unlinked issue and a non-Conventional first-commit subject remain, both non-blocking.
A: Process & Compliance
| # | Criterion | Status | Finding |
|---|---|---|---|
| A1 | PR template complete | ✅ | Description, Type of Change (Code refactoring), How to Test, and full checklist present. |
| A2 | Conventional Commits | ✅ | PR title refactor(telemetry): ... is compliant; Commit Validation CI passed. (First commit subject drop traceloop ... is non-Conventional, but squash-merge uses the PR title.) |
| A3 | Issue linked | No Closes #N in the body. Non-blocking, but AGENTS.md expects contributions to start from an accepted issue — link one if it exists. |
|
| A4 | AI-generated code disclosure | ➖ | No explicit disclosure; apply the SAP GenAI contribution guideline if applicable. |
B: Security & Sensitive Data
| # | Criterion | Status | Finding |
|---|---|---|---|
| B1 | No sensitive data in code | ✅ | Only semconv attribute-key literals and fake test fixtures (gpt-4, session-123). Change removes raw entity I/O payloads from exported spans — net data-minimization gain. |
| B2 | No sensitive data in PR body | ✅ | No internal URLs/tenant IDs/customer data. |
C: Code Quality
| # | Criterion | Status | Finding |
|---|---|---|---|
| C1 | CI checks passing | ✅ | Code Quality Checks, Tests & Coverage, Build & Package, Commit Validation, Check Version Bump, CodeQL, Analyze (python), REUSE, CLA all pass. Integration Tests pending at review time. |
| C2 | Version bump | ➖ | No pyproject.toml change. |
| C3 | Type hints | ✅ | Touched helpers retain full annotations; _DENY_LIST: frozenset literal is clear. |
| C4 | No hardcoded values | ✅ | Denied keys centralized in class-level _DENY_LIST frozenset (genai_attribute_transformer.py:38), improving on the prior scattered constants. |
| C5 | Import organization | ✅ | No import changes in source. |
| C6 | Naming conventions | ✅ | _DENY_LIST private + SCREAMING_SNAKE; snake_case files. |
| C7 | No unused code | ✅ | Dead OpenInference path (_map_llm_usage, _LLM_USAGE_*, _OPENINFERENCE_PREFIX, llm. trigger) fully removed; no dangling refs. Earlier orphaned-test issue resolved in commit 3106d13 — test_normalize_attributes_skips_non_genai_spans is a proper def (test file:165) with its docstring at :166. |
| C8 | New dependencies | ➖ | None added. |
| C9 | Proto freshness | ➖ | No proto changes. |
D: API & Design
| # | Criterion | Status | Finding |
|---|---|---|---|
| D1 | API future-proofing | ✅ | Internal exporter wrapper; no public config surface touched. |
| D2 | Public API hygiene | ✅ | All touched symbols _-private; nothing in __all__ changed. |
| D3 | Breaking changes marked | ✅ | _map_llm_usage was private — no public-API break. Exported-span attributes do change (no traceloop.entity.input/output; no llm.usage.*→gen_ai.usage.* mapping), but the mapping was dead against current instrumentation. Documented under Additional Notes for downstream dashboard owners. Not a code-level breaking change. |
| D4 | Pagination & tenant filtering | ➖ | N/A. |
| D5 | Telemetry instrumentation | ➖ | This is telemetry infra, not a client method; no @record_metrics applicable. |
| D6 | Multi-tenancy support | ➖ | N/A — core telemetry, not a service module. |
E: Tests & Documentation
| # | Criterion | Status | Finding |
|---|---|---|---|
| E1 | Tests added/updated | ✅ | New _DENY_LIST behaviour covered by test_normalize_attributes_drops_deny_listed_attributes (:116) and test_normalize_attributes_deny_list_uses_exact_keys (:135, asserts exact-key, not prefix). Non-GenAI-skip path restored (:165). Obsolete llm.* tests removed; suite passes. |
| E2 | Documentation quality | ✅ | Module + class docstrings rewritten to describe Traceloop normalization / vendor-attribute dropping; no stale OpenInference claims. No user-guide reference to the changed keys exists, so none needs updating. |
| E2a | Multi-tenancy documentation | ➖ | N/A — no user-guide.md for core telemetry. |
| E3 | Module structure compliance | ➖ | Not a new module. |
❌ Blocking Issues
None.
⚠️ Non-Blocking Suggestions
- [A3] Link the tracked issue (
Closes #N) if one exists. - [A2] First commit subject
drop traceloop input and output and openinference normalizationisn't Conventional — harmless under squash-merge (PR title governs) andCommit Validationpassed, but worth tidying if the branch history is kept. - [D3] Keep the "exported-telemetry change" note visible for downstream dashboard/query owners (entity.input/output dropped; llm.usage.* mapping gone).
✅ Things Done Well
- Source is clean: entire dead OpenInference path removed with no dangling references;
tyand the unit suite pass. _DENY_LISTas a class-levelfrozensetis the right pattern — centralized, immutable, O(1) membership, exact-key (not greedy prefix) matching, with a dedicated test proving sibling/custom keys are preserved.- Net privacy improvement: raw
traceloop.entity.input/outputpayload blobs no longer exported. - Docstrings updated to match actual behaviour.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reworks vendor-attribute handling in
GenAIAttributeTransformer(src/sap_cloud_sdk/core/telemetry/genai_attribute_transformer.py). Replaces the hardcoded drop oftraceloop.entity.input/traceloop.entity.outputwith an explicit class-level_DENY_LISTfrozenset (exact-key, O(1), easy to extend), and removes the dead OpenInferencellm.*handling — the_map_llm_usagemethod, the_LLM_USAGE_*constants, and thellm.trigger prefix. OpenInference is not a dependency and nothing insrc/emitsllm.*; the activeopentelemetry-instrumentation-langchaininstrumentor already writes usage directly asgen_ai.usage.*, so that mapping was unreachable. The entity I/O blobs duplicated the payload already carried bygen_ai.input.messages/gen_ai.output.messages, so dropping them reduces span size and raw prompt/response exposure.Type of Change
How to Test
uv run pytest tests/core/unit/telemetry/test_genai_attribute_transformer.py— all pass (includes newtest_normalize_attributes_drops_deny_listed_attributesandtest_normalize_attributes_deny_list_uses_exact_keys).traceloop.entity.input,traceloop.entity.output,traceloop.entity.name, andtraceloop.custom.foo; run it throughGenAIAttributeTransformer.export(). Confirmentity.input/entity.outputare dropped whileentity.nameandcustom.fooare preserved (exact-key, not prefix).Checklist