Skip to content

feat: deprecate old methods and use typed everywhere#95

Open
jaronoff97 wants to merge 3 commits into
masterfrom
policy-v1.6.0-string-equals
Open

feat: deprecate old methods and use typed everywhere#95
jaronoff97 wants to merge 3 commits into
masterfrom
policy-v1.6.0-string-equals

Conversation

@jaronoff97

Copy link
Copy Markdown
Contributor

No description provided.

return nil
}
return c.Value(span, ref)
return typedValueToBytes(c.TypedValue(span, ref))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High policy/probabilistic_sampler.go:63

sampleBytesTrace now sends TypedValueString trace IDs through typedValueToBytes, which returns UTF-8 bytes. A migrated trace accessor that wraps the old Value callback as TypedValue: TypedValueString(string(oldBytes)) will hand an ASCII-hex trace ID (e.g., hex.EncodeToString(id[:])) into extractRandomnessFromTraceID, which then interprets the last 7 ASCII characters instead of the last 7 raw trace-ID bytes. This silently changes keep/drop decisions in trace sampling modes that derive randomness from the trace ID (hash_seed and the trace-ID fallback path). Consider special-casing the trace-ID ref so raw bytes are preserved, or ensuring the accessor returns TypedValueBytes for that field.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @policy/probabilistic_sampler.go around line 63:

`sampleBytesTrace` now sends `TypedValueString` trace IDs through `typedValueToBytes`, which returns UTF-8 bytes. A migrated trace accessor that wraps the old `Value` callback as `TypedValue: TypedValueString(string(oldBytes))` will hand an ASCII-hex trace ID (e.g., `hex.EncodeToString(id[:])`) into `extractRandomnessFromTraceID`, which then interprets the last 7 ASCII characters instead of the last 7 raw trace-ID bytes. This silently changes keep/drop decisions in trace sampling modes that derive randomness from the trace ID (`hash_seed` and the trace-ID fallback path). Consider special-casing the trace-ID ref so raw bytes are preserved, or ensuring the accessor returns `TypedValueBytes` for that field.

Comment thread policy/internal/engine/transform.go
@macroscopeapp

macroscopeapp Bot commented Jul 9, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

2 blocking correctness issues found. This PR makes breaking API changes by removing the WithLogValue/WithMetricValue/WithTraceValue functions and their fallback logic. Two unresolved high-severity comments identify potential bugs in trace sampling and link_trace_id matching that could silently cause incorrect behavior. Human review is recommended to address these concerns.

You can customize Macroscope's approvability policy. Learn more.

Comment thread policy/internal/engine/match_key.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant