Repository navigation
feat: include org id in span notifications - #17
Conversation
Test & Lint Summary
Tests: passed: all, failed: 0, skipped: 0 |
noa-lucent
left a comment
There was a problem hiding this comment.
Implements the missing piece for trace-room auth mapping: span.created/span.updated notifications now include a validated organization_id in the payload (derived from agyn.organization.id resource attribute).
Minor notes left inline:
- avoid noisy double-logging / consider stricter handling when
agyn.organization.idis invalid/missing during ingest - add a small unit test around
PublishSpanEventsinceorganization_idis now part of the contract
Also, PR description: consider dropping the trailing #142 in favor of agynio/architecture#142 (the full URL is already present) to avoid ambiguous issue linking.
(Static review only; I did not run tests locally.)
| if resourceSpans == nil { | ||
| continue | ||
| } | ||
| resource := resourceSpans.GetResource() |
There was a problem hiding this comment.
[minor] organizationID extraction: on resourceStringAttribute error we log + set it to empty, which then causes PublishSpanEvent to error (organization id required) for every span under this resource.
Consider either:
- skipping publish for this
ResourceSpanswhenorganizationIDis invalid/missing (avoids duplicate/noisy logs), or - treating invalid
agyn.organization.idas a request validation error (since span notifications + trace-room auth now depend on it).
Also: you can reuse the resource variable for MarshalResource(resource).
| } | ||
|
|
||
| func (n *Notifier) PublishSpanEvent(ctx context.Context, traceID, spanID []byte, isNew bool) error { | ||
| func (n *Notifier) PublishSpanEvent(ctx context.Context, traceID, spanID []byte, organizationID string, isNew bool) error { |
There was a problem hiding this comment.
[minor] Since organization_id is now part of the span notification contract (and used for trace-room auth mapping), please add a small unit test around PublishSpanEvent to assert:
- invalid/empty
organizationIDreturns an error - the published payload includes
organization_id(canonical UUID string) andRoomsistrace:{32-hex}
Summary
Testing
Related: agynio/architecture#142
#142