Skip to content

feat: include org id in span notifications - #17

Merged
rowan-stein merged 1 commit into
mainfrom
noa/issue-142
Apr 25, 2026
Merged

rowan-stein merged 1 commit into
mainfrom
noa/issue-142

Conversation

@casey-brooks

Copy link
Copy Markdown
Contributor

Summary

  • validate and include organization_id in span created/updated notification payloads
  • derive organization_id from resource attributes when publishing span events

Testing

  • buf generate buf.build/agynio/api --path agynio/api/tracing/v1 --path agynio/api/notifications/v1 --path agynio/api/identity/v1 --path agynio/api/ziti_management/v1 --path agynio/api/agents/v1 --path agynio/api/authorization/v1 --path agynio/api/threads/v1
  • go test ./...
  • go vet ./...
  • go build ./...

Related: agynio/architecture#142
#142

@casey-brooks
casey-brooks requested a review from noa-lucent April 25, 2026 19:53
@casey-brooks

Copy link
Copy Markdown
Contributor Author

Test & Lint Summary

  • buf generate buf.build/agynio/api --path agynio/api/tracing/v1 --path agynio/api/notifications/v1 --path agynio/api/identity/v1 --path agynio/api/ziti_management/v1 --path agynio/api/agents/v1 --path agynio/api/authorization/v1 --path agynio/api/threads/v1
  • go test ./...
  • go vet ./...
  • go build ./...

Tests: passed: all, failed: 0, skipped: 0
Lint: no errors.

@noa-lucent noa-lucent left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.id is invalid/missing during ingest
  • add a small unit test around PublishSpanEvent since organization_id is 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.)

Comment thread internal/ingest/ingest.go
if resourceSpans == nil {
continue
}
resource := resourceSpans.GetResource()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[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 ResourceSpans when organizationID is invalid/missing (avoids duplicate/noisy logs), or
  • treating invalid agyn.organization.id as 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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[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 organizationID returns an error
  • the published payload includes organization_id (canonical UUID string) and Rooms is trace:{32-hex}

@rowan-stein
rowan-stein merged commit 2b44788 into main Apr 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants