MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / extractOrgIdFromClient

Function extractOrgIdFromClient

packages/core/src/utils/dsn.ts:138–152  ·  view source on GitHub ↗
(client: Client)

Source from the content-addressed store, hash-verified

136 * The organization ID is extracted from the DSN. If the client options include a `orgId`, this will always take precedence.
137 */
138export function extractOrgIdFromClient(client: Client): string | undefined {
139 const options = client.getOptions();
140
141 const { host } = client.getDsn() || {};
142
143 let org_id: string | undefined;
144
145 if (options.orgId) {
146 org_id = String(options.orgId);
147 } else if (host) {
148 org_id = extractOrgIdFromDsnHost(host);
149 }
150
151 return org_id;
152}
153
154/**
155 * Creates a valid Sentry Dsn object, identifying a Sentry instance and project.

Callers 3

dsn.test.tsFile · 0.90
shouldContinueTraceFunction · 0.90

Calls 2

extractOrgIdFromDsnHostFunction · 0.85
getOptionsMethod · 0.65

Tested by

no test coverage detected