Add a Dsn::org_id() helper so the SDK can derive its organization ID from SaaS DSNs as required by the strict trace continuation spec. This is the first implementation task in the strict trace continuation stack tracked by #1016.
The helper should parse SaaS-style hosts whose first DNS label is o<digits> and return None for self-hosted, Relay, malformed, or overflow cases. Add a CHANGELOG.md entry because this is a public API addition.
Implementation notes
Target files:
sentry-types/src/dsn.rs
sentry-types/src/protocol/v7.rs for the existing OrganizationId type
CHANGELOG.md
Implementation:
- Add
Dsn::org_id(&self) -> Option<OrganizationId>.
- Parse only the first host label.
- Accept labels matching
o<digits>.
- Return
None for labels such as oabc, 123, empty labels, self-hosted hosts, Relay hosts, and integer overflow.
Examples:
o123.ingest.sentry.io -> Some(123.into())
o123.sentry.io -> None
sentry.io -> None
relay.example.com -> None
localhost -> None
oabc.ingest.sentry.io -> None
Tests:
- Add unit tests in
sentry-types/src/dsn.rs for valid SaaS hosts, malformed first labels, self-hosted hosts, and overflow.
- Validate with
cargo test -p sentry-types dsn.
Add a
Dsn::org_id()helper so the SDK can derive its organization ID from SaaS DSNs as required by the strict trace continuation spec. This is the first implementation task in the strict trace continuation stack tracked by #1016.The helper should parse SaaS-style hosts whose first DNS label is
o<digits>and returnNonefor self-hosted, Relay, malformed, or overflow cases. Add aCHANGELOG.mdentry because this is a public API addition.Implementation notes
Target files:
sentry-types/src/dsn.rssentry-types/src/protocol/v7.rsfor the existingOrganizationIdtypeCHANGELOG.mdImplementation:
Dsn::org_id(&self) -> Option<OrganizationId>.o<digits>.Nonefor labels such asoabc,123, empty labels, self-hosted hosts, Relay hosts, and integer overflow.Examples:
o123.ingest.sentry.io->Some(123.into())o123.sentry.io->Nonesentry.io->Nonerelay.example.com->Nonelocalhost->Noneoabc.ingest.sentry.io->NoneTests:
sentry-types/src/dsn.rsfor valid SaaS hosts, malformed first labels, self-hosted hosts, and overflow.cargo test -p sentry-types dsn.