@datadog/mobile-react-native 2.0.0-rc.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,7 +53,7 @@ const formatFirstPartyHosts = firstPartyHosts => {
53
53
  if (isLegacyFirstPartyHost(host)) {
54
54
  return {
55
55
  match: host,
56
- propagatorTypes: [_types.PropagatorType.DATADOG]
56
+ propagatorTypes: [_types.PropagatorType.DATADOG, _types.PropagatorType.TRACECONTEXT]
57
57
  };
58
58
  }
59
59
 
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","UploadFrequency","BatchSize","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","PropagatorType","DATADOG","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","uploadFrequency","batchSize","MEDIUM","trackBackgroundEvents","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","actionNameAttribute","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;AAMA;;;;IAEYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA,qB;;IAOAC,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;A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C,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport enum UploadFrequency {\n /**\n * Upload data every 1000ms.\n */\n FREQUENT = 'FREQUENT',\n /**\n * Upload data every 5000ms.\n */\n AVERAGE = 'AVERAGE',\n /**\n * Upload data every 10000ms.\n */\n RARE = 'RARE'\n}\n\nexport enum BatchSize {\n /**\n * Upload less frequent, larger batches of data\n */\n LARGE = 'LARGE',\n /**\n * Use default size for batches of data\n */\n MEDIUM = 'MEDIUM',\n /**\n * Upload more frequent, smaller batches of data\n */\n SMALL = 'SMALL'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [PropagatorType.DATADOG]\n };\n }\n return host;\n });\n};\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null,\n trackFrustrations: true,\n uploadFrequency: UploadFrequency.AVERAGE,\n batchSize: BatchSize.MEDIUM,\n trackBackgroundEvents: false\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\n\n /**\n * Sets the preferred frequency for uploading batches of data.\n */\n public uploadFrequency: UploadFrequency = DEFAULTS.uploadFrequency;\n\n /**\n * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.\n * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.\n */\n public batchSize: BatchSize = DEFAULTS.batchSize;\n\n /**\n * Enables tracking of RUM event when no RUM View is active.\n *\n * By default, background events are not tracked. Enabling this feature might increase the\n * number of sessions tracked and impact your billing.\n */\n public trackBackgroundEvents: boolean = DEFAULTS.trackBackgroundEvents;\n\n /**\n * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.\n *\n * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:\n *\n * ```js\n * <TouchableOpacity testID=\"Dismiss notification\" onPress={() => dismiss()}>\n * ```\n *\n * `dd-action-name` is favored when both attributes are present on an element.\n */\n public actionNameAttribute?: string;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n readonly trackFrustrations?: boolean;\n readonly uploadFrequency?: UploadFrequency;\n readonly batchSize?: BatchSize;\n readonly trackBackgroundEvents?: boolean;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionNameAttribute',\n value: features.actionNameAttribute\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
1
+ {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","UploadFrequency","BatchSize","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","PropagatorType","DATADOG","TRACECONTEXT","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","uploadFrequency","batchSize","MEDIUM","trackBackgroundEvents","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","actionNameAttribute","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;AAMA;;;;IAEYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA,qB;;IAOAC,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e;;IAeAC,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;AAsBZ,MAAMC,sBAAsB,GACxBC,cAD2B,IAEc;AACzC,SAAO,OAAOA,cAAP,KAA0B,QAAjC;AACH,CAJD;AAMA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAC9BC,eADiC,IAEd;AACnB,SAAOA,eAAe,CAACC,GAAhB,CAAoBC,IAAI,IAAI;AAC/B,QAAIL,sBAAsB,CAACK,IAAD,CAA1B,EAAkC;AAC9B,aAAO;AACHC,QAAAA,KAAK,EAAED,IADJ;AAEHE,QAAAA,eAAe,EAAE,CACbC,sBAAeC,OADF,EAEbD,sBAAeE,YAFF;AAFd,OAAP;AAOH;;AACD,WAAOL,IAAP;AACH,GAXM,CAAP;AAYH,CAfM;;;AAiBP,MAAMM,QAAQ,GAAG;AACbC,EAAAA,wBAAwB,EAAE,KADb;AAEbC,EAAAA,mBAAmB,EAAE,KAFR;AAGbC,EAAAA,2BAA2B,EAAE,IAHhB;AAIbC,EAAAA,IAAI,EAAE,KAJO;AAKbC,EAAAA,mBAAmB,EAAE,CALR;AAMbC,EAAAA,yBAAyB,EAAE,GANd;AAObC,EAAAA,kBAAkB,EAAE,KAPP;AAQbC,EAAAA,yBAAyB,EAAE,KARd;AASbC,EAAAA,k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AACII,IAAAA,IAAI,EAAE,mBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAAChB;AAFpB,GADqB,EAKrBwB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACY;AAFpB,GADqB,EAKrBJ,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CA7EM;;;;AA+EA,MAAMK,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport enum UploadFrequency {\n /**\n * Upload data every 1000ms.\n */\n FREQUENT = 'FREQUENT',\n /**\n * Upload data every 5000ms.\n */\n AVERAGE = 'AVERAGE',\n /**\n * Upload data every 10000ms.\n */\n RARE = 'RARE'\n}\n\nexport enum BatchSize {\n /**\n * Upload less frequent, larger batches of data\n */\n LARGE = 'LARGE',\n /**\n * Use default size for batches of data\n */\n MEDIUM = 'MEDIUM',\n /**\n * Upload more frequent, smaller batches of data\n */\n SMALL = 'SMALL'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [\n PropagatorType.DATADOG,\n PropagatorType.TRACECONTEXT\n ]\n };\n }\n return host;\n });\n};\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null,\n trackFrustrations: true,\n uploadFrequency: UploadFrequency.AVERAGE,\n batchSize: BatchSize.MEDIUM,\n trackBackgroundEvents: false\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\n\n /**\n * Sets the preferred frequency for uploading batches of data.\n */\n public uploadFrequency: UploadFrequency = DEFAULTS.uploadFrequency;\n\n /**\n * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.\n * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.\n */\n public batchSize: BatchSize = DEFAULTS.batchSize;\n\n /**\n * Enables tracking of RUM event when no RUM View is active.\n *\n * By default, background events are not tracked. Enabling this feature might increase the\n * number of sessions tracked and impact your billing.\n */\n public trackBackgroundEvents: boolean = DEFAULTS.trackBackgroundEvents;\n\n /**\n * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.\n *\n * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:\n *\n * ```js\n * <TouchableOpacity testID=\"Dismiss notification\" onPress={() => dismiss()}>\n * ```\n *\n * `dd-action-name` is favored when both attributes are present on an element.\n */\n public actionNameAttribute?: string;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n readonly trackFrustrations?: boolean;\n readonly uploadFrequency?: UploadFrequency;\n readonly batchSize?: BatchSize;\n readonly trackBackgroundEvents?: boolean;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionNameAttribute',\n value: features.actionNameAttribute\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getTracingHeaders = exports.B3_MULTI_SAMPLED_HEADER_KEY = exports.B3_MULTI_SPAN_ID_HEADER_KEY = exports.B3_MULTI_TRACE_ID_HEADER_KEY = exports.B3_HEADER_KEY = exports.TRACECONTEXT_HEADER_KEY = exports.PARENT_ID_HEADER_KEY = exports.TRACE_ID_HEADER_KEY = exports.ORIGIN_RUM = exports.ORIGIN_HEADER_KEY = exports.SAMPLING_PRIORITY_HEADER_KEY = void 0;
6
+ exports.getTracingHeaders = exports.B3_MULTI_SAMPLED_HEADER_KEY = exports.B3_MULTI_SPAN_ID_HEADER_KEY = exports.B3_MULTI_TRACE_ID_HEADER_KEY = exports.B3_HEADER_KEY = exports.TRACESTATE_HEADER_KEY = exports.TRACECONTEXT_HEADER_KEY = exports.PARENT_ID_HEADER_KEY = exports.TRACE_ID_HEADER_KEY = exports.ORIGIN_RUM = exports.ORIGIN_HEADER_KEY = exports.SAMPLING_PRIORITY_HEADER_KEY = void 0;
7
7
 
8
8
  var _types = require("../../../types");
9
9
 
@@ -32,6 +32,8 @@ const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';
32
32
  exports.PARENT_ID_HEADER_KEY = PARENT_ID_HEADER_KEY;
33
33
  const TRACECONTEXT_HEADER_KEY = 'traceparent';
34
34
  exports.TRACECONTEXT_HEADER_KEY = TRACECONTEXT_HEADER_KEY;
35
+ const TRACESTATE_HEADER_KEY = 'tracestate';
36
+ exports.TRACESTATE_HEADER_KEY = TRACESTATE_HEADER_KEY;
35
37
  const B3_HEADER_KEY = 'b3';
36
38
  exports.B3_HEADER_KEY = B3_HEADER_KEY;
37
39
  const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';
@@ -78,6 +80,12 @@ const getTracingHeaders = tracingAttributes => {
78
80
  parentId: tracingAttributes.spanId,
79
81
  isSampled: tracingAttributes.samplingPriorityHeader === '1'
80
82
  })
83
+ }, {
84
+ header: TRACESTATE_HEADER_KEY,
85
+ value: generateTraceStateHeader({
86
+ parentId: tracingAttributes.spanId,
87
+ isSampled: tracingAttributes.samplingPriorityHeader === '1'
88
+ })
81
89
  });
82
90
  break;
83
91
  }
@@ -125,6 +133,16 @@ const generateTraceContextHeader = ({
125
133
  return `${version}-${traceId.toPaddedString(16, 32)}-${parentId.toPaddedString(16, 16)}-${flags}`;
126
134
  };
127
135
 
136
+ const generateTraceStateHeader = ({
137
+ parentId,
138
+ isSampled
139
+ }) => {
140
+ const sampled = `s:${isSampled ? '1' : '0'}`;
141
+ const origin = 'o:rum';
142
+ const parent = `p:${parentId.toPaddedString(16, 16)}`;
143
+ return `dd=${sampled};${origin};${parent}`;
144
+ };
145
+
128
146
  const generateB3Header = ({
129
147
  traceId,
130
148
  spanId,
@@ -1 +1 @@
1
- {"version":3,"sources":["distributedTracingHeaders.ts"],"names":["SAMPLING_PRIORITY_HEADER_KEY","ORIGIN_HEADER_KEY","ORIGIN_RUM","TRACE_ID_HEADER_KEY","PARENT_ID_HEADER_KEY","TRACECONTEXT_HEADER_KEY","B3_HEADER_KEY","B3_MULTI_TRACE_ID_HEADER_KEY","B3_MULTI_SPAN_ID_HEADER_KEY","B3_MULTI_SAMPLED_HEADER_KEY","getTracingHeaders","tracingAttributes","headers","tracingStrategy","propagatorTypes","forEach","propagator","PropagatorType","DATADOG","push","header","value","samplingPriorityHeader","traceId","toString","spanId","TRACECONTEXT","generateTraceContextHeader","version","parentId","isSampled","B3","generateB3Header","B3MULTI","toPaddedString","flags"],"mappings":";;;;;;;AAMA;;AANA;AACA;AACA;AACA;AACA;AAUO,MAAMA,4BAA4B,GAAG,6BAArC;AACP;AACA;AACA;;;AACO,MAAMC,iBAAiB,GAAG,kBAA1B;;AACA,MAAMC,UAAU,GAAG,KAAnB;;AACA,MAAMC,mBAAmB,GAAG,oBAA5B;;AACA,MAAMC,oBAAoB,GAAG,qBAA7B;AACP;AACA;AACA;;;AACO,MAAMC,uBAAuB,GAAG,aAAhC;;AACA,MAAMC,aAAa,GAAG,IAAtB;;AACA,MAAMC,4BAA4B,GAAG,cAArC;;AACA,MAAMC,2BAA2B,GAAG,aAApC;;AACA,MAAMC,2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BE,EAAAA,MAFsB;AAGtBK,EAAAA;AAHsB,CAAD,KAQnB;AACF,QAAMK,KAAK,GAAGL,SAAS,GAAG,GAAH,GAAS,GAAhC;AACA,SAAQ,GAAEP,OAAO,CAACW,cAAR,CAAuB,EAAvB,EAA2B,EAA3B,CAA+B,IAAGT,MAAM,CAACS,cAAP,CACxC,EADwC,EAExC,EAFwC,CAG1C,IAAGC,KAAM,EAHX;AAIH,CAdD","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { PropagatorType } from '../../../types';\n\nimport type {\n DdRumResourceTracingAttributes,\n SpanId,\n TraceId\n} from './distributedTracing';\n\nexport const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';\n/**\n * Datadog headers\n */\nexport const ORIGIN_HEADER_KEY = 'x-datadog-origin';\nexport const ORIGIN_RUM = 'rum';\nexport const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';\nexport const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';\n/**\n * OTel headers\n */\nexport const TRACECONTEXT_HEADER_KEY = 'traceparent';\nexport const B3_HEADER_KEY = 'b3';\nexport const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';\nexport const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';\nexport const B3_MULTI_SAMPLED_HEADER_KEY = 'X-B3-Sampled';\n\nexport const getTracingHeaders = (\n tracingAttributes: DdRumResourceTracingAttributes\n): { header: string; value: string }[] => {\n const headers: { header: string; value: string }[] = [];\n if (tracingAttributes.tracingStrategy === 'DISCARD') {\n return headers;\n }\n tracingAttributes.propagatorTypes.forEach(propagator => {\n switch (propagator) {\n case PropagatorType.DATADOG: {\n headers.push(\n {\n header: ORIGIN_HEADER_KEY,\n value: ORIGIN_RUM\n },\n {\n header: SAMPLING_PRIORITY_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n },\n {\n header: TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toString(10)\n },\n {\n header: PARENT_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toString(10)\n }\n );\n break;\n }\n case PropagatorType.TRACECONTEXT: {\n headers.push({\n header: TRACECONTEXT_HEADER_KEY,\n value: generateTraceContextHeader({\n version: '00',\n traceId: tracingAttributes.traceId,\n parentId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n });\n break;\n }\n case PropagatorType.B3: {\n headers.push({\n header: B3_HEADER_KEY,\n value: generateB3Header({\n traceId: tracingAttributes.traceId,\n spanId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n });\n break;\n }\n case PropagatorType.B3MULTI: {\n headers.push(\n {\n header: B3_MULTI_TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toPaddedString(16, 32)\n },\n {\n header: B3_MULTI_SPAN_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toPaddedString(16, 16)\n },\n {\n header: B3_MULTI_SAMPLED_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n }\n );\n }\n }\n });\n\n return headers;\n};\n\nconst generateTraceContextHeader = ({\n version,\n traceId,\n parentId,\n isSampled\n}: {\n version: string;\n traceId: TraceId;\n parentId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '01' : '00';\n return `${version}-${traceId.toPaddedString(\n 16,\n 32\n )}-${parentId.toPaddedString(16, 16)}-${flags}`;\n};\n\nconst generateB3Header = ({\n traceId,\n spanId,\n isSampled\n}: {\n traceId: TraceId;\n spanId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '1' : '0';\n return `${traceId.toPaddedString(16, 32)}-${spanId.toPaddedString(\n 16,\n 16\n )}-${flags}`;\n};\n"]}
1
+ {"version":3,"sources":["distributedTracingHeaders.ts"],"names":["SAMPLING_PRIORITY_HEADER_KEY","ORIGIN_HEADER_KEY","ORIGIN_RUM","TRACE_ID_HEADER_KEY","PARENT_ID_HEADER_KEY","TRACECONTEXT_HEADER_KEY","TRACESTATE_HEADER_KEY","B3_HEADER_KEY","B3_MULTI_TRACE_ID_HEADER_KEY","B3_MULTI_SPAN_ID_HEADER_KEY","B3_MULTI_SAMPLED_HEADER_KEY","getTracingHeaders","tracingAttributes","headers","tracingStrategy","propagatorTypes","forEach","propagator","PropagatorType","DATADOG","push","header","value","samplingPriorityHeader","traceId","toString","spanId","TRACECONTEXT","generateTraceContextHeader","version","parentId","isSampled","generateTraceStateHeader","B3","generateB3Header","B3MULTI","toPaddedString","flags","sampled","origin","parent"],"mappings":";;;;;;;AAMA;;AANA;AACA;AACA;AACA;AACA;AAUO,MAAMA,4BAA4B,GAAG,6BAArC;AACP;AACA;AACA;;;AACO,MAAMC,iBAAiB,GAAG,kBAA1B;;AACA,MAAMC,UAAU,GAAG,KAAnB;;AACA,MAAMC,mBAAmB,GAAG,oBAA5B;;AACA,MAAMC,oBAAoB,GAAG,qBAA7B;AACP;AACA;AACA;;;AACO,MAAMC,uBAAuB,GAAG,aAAhC;;AACA,MAAMC,qBAAqB,GAAG,YAA9B;;AACA,MAAMC,aAAa,GAAG,IAAtB;;AACA,MAAMC,4BAA4B,GAAG,cAArC;;AACA,MAAMC,2BAA2B,GAAG,aAApC;;AACA,MAAMC,2BAA2B,GAAG,cAApC;;;AAEA,MAAMC,iBAAiB,GAC1BC,iBAD6B,IAES;AACtC,QAAMC,OAA4C,GAAG,EAArD;;AACA,MAAID,iBAAiB,CAACE,eAAlB,KAAsC,SAA1C,EAAqD;AACjD,WAAOD,OAAP;AACH;;AACDD,EAAAA,iBAAiB,CAACG,eAAlB,CAAkCC,OAAlC,CAA0CC,UAAU,IAAI;AACpD,YAAQA,UAAR;AACI,WAAKC,sBAAeC,OAApB;AAA6B;AACzBN,UAAAA,OAAO,CAACO,IAAR,CACI;AACIC,YAAAA,MAAM,EAAEpB,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AAM,GAAI,KAAIV,QAAQ,CAACM,cAAT,CAAwB,EAAxB,EAA4B,EAA5B,CAAgC,EAApD;AAEA,SAAQ,MAAKE,OAAQ,IAAGC,MAAO,IAAGC,MAAO,EAAzC;AACH,CAZD;;AAcA,MAAMN,gBAAgB,GAAG,CAAC;AACtBV,EAAAA,OADsB;AAEtBE,EAAAA,MAFsB;AAGtBK,EAAAA;AAHsB,CAAD,KAQnB;AACF,QAAMM,KAAK,GAAGN,SAAS,GAAG,GAAH,GAAS,GAAhC;AACA,SAAQ,GAAEP,OAAO,CAACY,cAAR,CAAuB,EAAvB,EAA2B,EAA3B,CAA+B,IAAGV,MAAM,CAACU,cAAP,CACxC,EADwC,EAExC,EAFwC,CAG1C,IAAGC,KAAM,EAHX;AAIH,CAdD","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { PropagatorType } from '../../../types';\n\nimport type {\n DdRumResourceTracingAttributes,\n SpanId,\n TraceId\n} from './distributedTracing';\n\nexport const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';\n/**\n * Datadog headers\n */\nexport const ORIGIN_HEADER_KEY = 'x-datadog-origin';\nexport const ORIGIN_RUM = 'rum';\nexport const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';\nexport const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';\n/**\n * OTel headers\n */\nexport const TRACECONTEXT_HEADER_KEY = 'traceparent';\nexport const TRACESTATE_HEADER_KEY = 'tracestate';\nexport const B3_HEADER_KEY = 'b3';\nexport const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';\nexport const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';\nexport const B3_MULTI_SAMPLED_HEADER_KEY = 'X-B3-Sampled';\n\nexport const getTracingHeaders = (\n tracingAttributes: DdRumResourceTracingAttributes\n): { header: string; value: string }[] => {\n const headers: { header: string; value: string }[] = [];\n if (tracingAttributes.tracingStrategy === 'DISCARD') {\n return headers;\n }\n tracingAttributes.propagatorTypes.forEach(propagator => {\n switch (propagator) {\n case PropagatorType.DATADOG: {\n headers.push(\n {\n header: ORIGIN_HEADER_KEY,\n value: ORIGIN_RUM\n },\n {\n header: SAMPLING_PRIORITY_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n },\n {\n header: TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toString(10)\n },\n {\n header: PARENT_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toString(10)\n }\n );\n break;\n }\n case PropagatorType.TRACECONTEXT: {\n headers.push(\n {\n header: TRACECONTEXT_HEADER_KEY,\n value: generateTraceContextHeader({\n version: '00',\n traceId: tracingAttributes.traceId,\n parentId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n },\n {\n header: TRACESTATE_HEADER_KEY,\n value: generateTraceStateHeader({\n parentId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n }\n );\n break;\n }\n case PropagatorType.B3: {\n headers.push({\n header: B3_HEADER_KEY,\n value: generateB3Header({\n traceId: tracingAttributes.traceId,\n spanId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n });\n break;\n }\n case PropagatorType.B3MULTI: {\n headers.push(\n {\n header: B3_MULTI_TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toPaddedString(16, 32)\n },\n {\n header: B3_MULTI_SPAN_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toPaddedString(16, 16)\n },\n {\n header: B3_MULTI_SAMPLED_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n }\n );\n }\n }\n });\n\n return headers;\n};\n\nconst generateTraceContextHeader = ({\n version,\n traceId,\n parentId,\n isSampled\n}: {\n version: string;\n traceId: TraceId;\n parentId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '01' : '00';\n return `${version}-${traceId.toPaddedString(\n 16,\n 32\n )}-${parentId.toPaddedString(16, 16)}-${flags}`;\n};\n\nconst generateTraceStateHeader = ({\n parentId,\n isSampled\n}: {\n parentId: SpanId;\n isSampled: boolean;\n}) => {\n const sampled = `s:${isSampled ? '1' : '0'}`;\n const origin = 'o:rum';\n const parent = `p:${parentId.toPaddedString(16, 16)}`;\n\n return `dd=${sampled};${origin};${parent}`;\n};\n\nconst generateB3Header = ({\n traceId,\n spanId,\n isSampled\n}: {\n traceId: TraceId;\n spanId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '1' : '0';\n return `${traceId.toPaddedString(16, 32)}-${spanId.toPaddedString(\n 16,\n 16\n )}-${flags}`;\n};\n"]}
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = '2.0.0-rc.0';
8
+ const version = '2.0.1';
9
9
  exports.version = version;
10
10
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,YAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.0.0-rc.0';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.0.1';\n"]}
@@ -46,7 +46,7 @@ export const formatFirstPartyHosts = firstPartyHosts => {
46
46
  if (isLegacyFirstPartyHost(host)) {
47
47
  return {
48
48
  match: host,
49
- propagatorTypes: [PropagatorType.DATADOG]
49
+ propagatorTypes: [PropagatorType.DATADOG, PropagatorType.TRACECONTEXT]
50
50
  };
51
51
  }
52
52
 
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["TrackingConsent","PropagatorType","VitalsUpdateFrequency","UploadFrequency","BatchSize","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","DATADOG","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","uploadFrequency","batchSize","MEDIUM","trackBackgroundEvents","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","actionNameAttribute","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAIA,SAASA,eAAT,QAAgC,mBAAhC;AAMA,SAASC,cAAT,QAA+B,aAA/B;AAEA,WAAYC,qBAAZ;;WAAYA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,KAAAA,qB;;AAOZ,WAAYC,eAAZ;;WAAYA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,KAAAA,e;;AAeZ,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,KAAAA,S;;AAsBZ,MAAMC,sBAAsB,GACxBC,cAD2B,IAEc;AACzC,SAAO,OAAOA,cAAP,KAA0B,QAAjC;AACH,CAJD;AAMA;AACA;AACA;AACA;;;AACA,OAAO,MAAMC,qBAAqB,GAC9BC,eADiC,IAEd;AACnB,SAAOA,eAAe,CAACC,GAAhB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AAAEI,IAAAA,IAAI,EAAE,iBAAR;AAA2BD,IAAAA,KAAK,EAAEJ,QAAQ,CAACzC;AAA3C,GADqB,EAErBiD,gBAFqB,CAAzB;AAIAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,gBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACnB;AAFpB,GADqB,EAKrB2B,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,kBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAAClB;AAFpB,GADqB,EAKrB0B,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACjB;AAFpB,GADqB,EAKrByB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,mBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAAChB;AAFpB,GADqB,EAKrBwB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACY;AAFpB,GADqB,EAKrBJ,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CA7EM;AA+EP,OAAO,MAAMK,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;AAIhF,WAAYD,kBAAZ;;WAAYA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,KAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport enum UploadFrequency {\n /**\n * Upload data every 1000ms.\n */\n FREQUENT = 'FREQUENT',\n /**\n * Upload data every 5000ms.\n */\n AVERAGE = 'AVERAGE',\n /**\n * Upload data every 10000ms.\n */\n RARE = 'RARE'\n}\n\nexport enum BatchSize {\n /**\n * Upload less frequent, larger batches of data\n */\n LARGE = 'LARGE',\n /**\n * Use default size for batches of data\n */\n MEDIUM = 'MEDIUM',\n /**\n * Upload more frequent, smaller batches of data\n */\n SMALL = 'SMALL'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [PropagatorType.DATADOG]\n };\n }\n return host;\n });\n};\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null,\n trackFrustrations: true,\n uploadFrequency: UploadFrequency.AVERAGE,\n batchSize: BatchSize.MEDIUM,\n trackBackgroundEvents: false\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\n\n /**\n * Sets the preferred frequency for uploading batches of data.\n */\n public uploadFrequency: UploadFrequency = DEFAULTS.uploadFrequency;\n\n /**\n * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.\n * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.\n */\n public batchSize: BatchSize = DEFAULTS.batchSize;\n\n /**\n * Enables tracking of RUM event when no RUM View is active.\n *\n * By default, background events are not tracked. Enabling this feature might increase the\n * number of sessions tracked and impact your billing.\n */\n public trackBackgroundEvents: boolean = DEFAULTS.trackBackgroundEvents;\n\n /**\n * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.\n *\n * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:\n *\n * ```js\n * <TouchableOpacity testID=\"Dismiss notification\" onPress={() => dismiss()}>\n * ```\n *\n * `dd-action-name` is favored when both attributes are present on an element.\n */\n public actionNameAttribute?: string;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n readonly trackFrustrations?: boolean;\n readonly uploadFrequency?: UploadFrequency;\n readonly batchSize?: BatchSize;\n readonly trackBackgroundEvents?: boolean;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionNameAttribute',\n value: features.actionNameAttribute\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
1
+ {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["TrackingConsent","PropagatorType","VitalsUpdateFrequency","UploadFrequency","BatchSize","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","DATADOG","TRACECONTEXT","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","uploadFrequency","batchSize","MEDIUM","trackBackgroundEvents","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","actionNameAttribute","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAIA,SAASA,eAAT,QAAgC,mBAAhC;AAMA,SAASC,cAAT,QAA+B,aAA/B;AAEA,WAAYC,qBAAZ;;WAAYA,qB;AAAAA,EAAAA,qB;AA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ADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACY;AAFpB,GADqB,EAKrBJ,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CA7EM;AA+EP,OAAO,MAAMK,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;AAIhF,WAAYD,kBAAZ;;WAAYA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,KAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport enum UploadFrequency {\n /**\n * Upload data every 1000ms.\n */\n FREQUENT = 'FREQUENT',\n /**\n * Upload data every 5000ms.\n */\n AVERAGE = 'AVERAGE',\n /**\n * Upload data every 10000ms.\n */\n RARE = 'RARE'\n}\n\nexport enum BatchSize {\n /**\n * Upload less frequent, larger batches of data\n */\n LARGE = 'LARGE',\n /**\n * Use default size for batches of data\n */\n MEDIUM = 'MEDIUM',\n /**\n * Upload more frequent, smaller batches of data\n */\n SMALL = 'SMALL'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [\n PropagatorType.DATADOG,\n PropagatorType.TRACECONTEXT\n ]\n };\n }\n return host;\n });\n};\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null,\n trackFrustrations: true,\n uploadFrequency: UploadFrequency.AVERAGE,\n batchSize: BatchSize.MEDIUM,\n trackBackgroundEvents: false\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\n\n /**\n * Sets the preferred frequency for uploading batches of data.\n */\n public uploadFrequency: UploadFrequency = DEFAULTS.uploadFrequency;\n\n /**\n * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.\n * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.\n */\n public batchSize: BatchSize = DEFAULTS.batchSize;\n\n /**\n * Enables tracking of RUM event when no RUM View is active.\n *\n * By default, background events are not tracked. Enabling this feature might increase the\n * number of sessions tracked and impact your billing.\n */\n public trackBackgroundEvents: boolean = DEFAULTS.trackBackgroundEvents;\n\n /**\n * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.\n *\n * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:\n *\n * ```js\n * <TouchableOpacity testID=\"Dismiss notification\" onPress={() => dismiss()}>\n * ```\n *\n * `dd-action-name` is favored when both attributes are present on an element.\n */\n public actionNameAttribute?: string;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n readonly trackFrustrations?: boolean;\n readonly uploadFrequency?: UploadFrequency;\n readonly batchSize?: BatchSize;\n readonly trackBackgroundEvents?: boolean;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionNameAttribute',\n value: features.actionNameAttribute\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
@@ -18,6 +18,7 @@ export const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';
18
18
  */
19
19
 
20
20
  export const TRACECONTEXT_HEADER_KEY = 'traceparent';
21
+ export const TRACESTATE_HEADER_KEY = 'tracestate';
21
22
  export const B3_HEADER_KEY = 'b3';
22
23
  export const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';
23
24
  export const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';
@@ -59,6 +60,12 @@ export const getTracingHeaders = tracingAttributes => {
59
60
  parentId: tracingAttributes.spanId,
60
61
  isSampled: tracingAttributes.samplingPriorityHeader === '1'
61
62
  })
63
+ }, {
64
+ header: TRACESTATE_HEADER_KEY,
65
+ value: generateTraceStateHeader({
66
+ parentId: tracingAttributes.spanId,
67
+ isSampled: tracingAttributes.samplingPriorityHeader === '1'
68
+ })
62
69
  });
63
70
  break;
64
71
  }
@@ -104,6 +111,16 @@ const generateTraceContextHeader = ({
104
111
  return `${version}-${traceId.toPaddedString(16, 32)}-${parentId.toPaddedString(16, 16)}-${flags}`;
105
112
  };
106
113
 
114
+ const generateTraceStateHeader = ({
115
+ parentId,
116
+ isSampled
117
+ }) => {
118
+ const sampled = `s:${isSampled ? '1' : '0'}`;
119
+ const origin = 'o:rum';
120
+ const parent = `p:${parentId.toPaddedString(16, 16)}`;
121
+ return `dd=${sampled};${origin};${parent}`;
122
+ };
123
+
107
124
  const generateB3Header = ({
108
125
  traceId,
109
126
  spanId,
@@ -1 +1 @@
1
- {"version":3,"sources":["distributedTracingHeaders.ts"],"names":["PropagatorType","SAMPLING_PRIORITY_HEADER_KEY","ORIGIN_HEADER_KEY","ORIGIN_RUM","TRACE_ID_HEADER_KEY","PARENT_ID_HEADER_KEY","TRACECONTEXT_HEADER_KEY","B3_HEADER_KEY","B3_MULTI_TRACE_ID_HEADER_KEY","B3_MULTI_SPAN_ID_HEADER_KEY","B3_MULTI_SAMPLED_HEADER_KEY","getTracingHeaders","tracingAttributes","headers","tracingStrategy","propagatorTypes","forEach","propagator","DATADOG","push","header","value","samplingPriorityHeader","traceId","toString","spanId","TRACECONTEXT","generateTraceContextHeader","version","parentId","isSampled","B3","generateB3Header","B3MULTI","toPaddedString","flags"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,cAAT,QAA+B,gBAA/B;AAQA,OAAO,MAAMC,4BAA4B,GAAG,6BAArC;AACP;AACA;AACA;;AACA,OAAO,MAAMC,iBAAiB,G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AAIhCC,EAAAA;AAJgC,CAAD,KAU7B;AACF,QAAMK,KAAK,GAAGL,SAAS,GAAG,IAAH,GAAU,IAAjC;AACA,SAAQ,GAAEF,OAAQ,IAAGL,OAAO,CAACW,cAAR,CACjB,EADiB,EAEjB,EAFiB,CAGnB,IAAGL,QAAQ,CAACK,cAAT,CAAwB,EAAxB,EAA4B,EAA5B,CAAgC,IAAGC,KAAM,EAH9C;AAIH,CAhBD;;AAkBA,MAAMH,gBAAgB,GAAG,CAAC;AACtBT,EAAAA,OADsB;AAEtBE,EAAAA,MAFsB;AAGtBK,EAAAA;AAHsB,CAAD,KAQnB;AACF,QAAMK,KAAK,GAAGL,SAAS,GAAG,GAAH,GAAS,GAAhC;AACA,SAAQ,GAAEP,OAAO,CAACW,cAAR,CAAuB,EAAvB,EAA2B,EAA3B,CAA+B,IAAGT,MAAM,CAACS,cAAP,CACxC,EADwC,EAExC,EAFwC,CAG1C,IAAGC,KAAM,EAHX;AAIH,CAdD","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { PropagatorType } from '../../../types';\n\nimport type {\n DdRumResourceTracingAttributes,\n SpanId,\n TraceId\n} from './distributedTracing';\n\nexport const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';\n/**\n * Datadog headers\n */\nexport const ORIGIN_HEADER_KEY = 'x-datadog-origin';\nexport const ORIGIN_RUM = 'rum';\nexport const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';\nexport const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';\n/**\n * OTel headers\n */\nexport const TRACECONTEXT_HEADER_KEY = 'traceparent';\nexport const B3_HEADER_KEY = 'b3';\nexport const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';\nexport const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';\nexport const B3_MULTI_SAMPLED_HEADER_KEY = 'X-B3-Sampled';\n\nexport const getTracingHeaders = (\n tracingAttributes: DdRumResourceTracingAttributes\n): { header: string; value: string }[] => {\n const headers: { header: string; value: string }[] = [];\n if (tracingAttributes.tracingStrategy === 'DISCARD') {\n return headers;\n }\n tracingAttributes.propagatorTypes.forEach(propagator => {\n switch (propagator) {\n case PropagatorType.DATADOG: {\n headers.push(\n {\n header: ORIGIN_HEADER_KEY,\n value: ORIGIN_RUM\n },\n {\n header: SAMPLING_PRIORITY_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n },\n {\n header: TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toString(10)\n },\n {\n header: PARENT_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toString(10)\n }\n );\n break;\n }\n case PropagatorType.TRACECONTEXT: {\n headers.push({\n header: TRACECONTEXT_HEADER_KEY,\n value: generateTraceContextHeader({\n version: '00',\n traceId: tracingAttributes.traceId,\n parentId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n });\n break;\n }\n case PropagatorType.B3: {\n headers.push({\n header: B3_HEADER_KEY,\n value: generateB3Header({\n traceId: tracingAttributes.traceId,\n spanId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n });\n break;\n }\n case PropagatorType.B3MULTI: {\n headers.push(\n {\n header: B3_MULTI_TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toPaddedString(16, 32)\n },\n {\n header: B3_MULTI_SPAN_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toPaddedString(16, 16)\n },\n {\n header: B3_MULTI_SAMPLED_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n }\n );\n }\n }\n });\n\n return headers;\n};\n\nconst generateTraceContextHeader = ({\n version,\n traceId,\n parentId,\n isSampled\n}: {\n version: string;\n traceId: TraceId;\n parentId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '01' : '00';\n return `${version}-${traceId.toPaddedString(\n 16,\n 32\n )}-${parentId.toPaddedString(16, 16)}-${flags}`;\n};\n\nconst generateB3Header = ({\n traceId,\n spanId,\n isSampled\n}: {\n traceId: TraceId;\n spanId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '1' : '0';\n return `${traceId.toPaddedString(16, 32)}-${spanId.toPaddedString(\n 16,\n 16\n )}-${flags}`;\n};\n"]}
1
+ {"version":3,"sources":["distributedTracingHeaders.ts"],"names":["PropagatorType","SAMPLING_PRIORITY_HEADER_KEY","ORIGIN_HEADER_KEY","ORIGIN_RUM","TRACE_ID_HEADER_KEY","PARENT_ID_HEADER_KEY","TRACECONTEXT_HEADER_KEY","TRACESTATE_HEADER_KEY","B3_HEADER_KEY","B3_MULTI_TRACE_ID_HEADER_KEY","B3_MULTI_SPAN_ID_HEADER_KEY","B3_MULTI_SAMPLED_HEADER_KEY","getTracingHeaders","tracingAttributes","headers","tracingStrategy","propagatorTypes","forEach","propagator","DATADOG","push","header","value","samplingPriorityHeader","traceId","toString","spanId","TRACECONTEXT","generateTraceContextHeader","version","parentId","isSampled","generateTraceStateHeader","B3","generateB3Header","B3MULTI","toPaddedString","flags","sampled","origin","parent"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,cAAT,QAA+B,gBAA/B;AAQA,OAAO,MAAMC,4BAA4B,GAAG,6BAArC;AACP;AACA;AACA;;AACA,OAAO,MAAMC,iBAAiB,GAAG,kBAA1B;AACP,OAAO,MAAMC,UAAU,GAAG,KAAnB;AACP,OAAO,MAAMC,mBAAmB,GAAG,oBAA5B;AACP,OAAO,MAAMC,oBAAoB,GAAG,qBAA7B;AACP;AACA;AACA;;AACA,OAAO,MAAMC,uBAAuB,GAAG,aAAhC;AACP,OAAO,MAAMC,qBAAqB,GAAG,YAA9B;AACP,OAAO,MAAMC,aAAa,GAAG,IAAtB;AACP,OAAO,MAAMC,4BAA4B,GAAG,cAArC;AACP,OAAO,MAA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AAK,GAAGN,SAAS,GAAG,IAAH,GAAU,IAAjC;AACA,SAAQ,GAAEF,OAAQ,IAAGL,OAAO,CAACY,cAAR,CACjB,EADiB,EAEjB,EAFiB,CAGnB,IAAGN,QAAQ,CAACM,cAAT,CAAwB,EAAxB,EAA4B,EAA5B,CAAgC,IAAGC,KAAM,EAH9C;AAIH,CAhBD;;AAkBA,MAAML,wBAAwB,GAAG,CAAC;AAC9BF,EAAAA,QAD8B;AAE9BC,EAAAA;AAF8B,CAAD,KAM3B;AACF,QAAMO,OAAO,GAAI,KAAIP,SAAS,GAAG,GAAH,GAAS,GAAI,EAA3C;AACA,QAAMQ,MAAM,GAAG,OAAf;AACA,QAAMC,MAAM,GAAI,KAAIV,QAAQ,CAACM,cAAT,CAAwB,EAAxB,EAA4B,EAA5B,CAAgC,EAApD;AAEA,SAAQ,MAAKE,OAAQ,IAAGC,MAAO,IAAGC,MAAO,EAAzC;AACH,CAZD;;AAcA,MAAMN,gBAAgB,GAAG,CAAC;AACtBV,EAAAA,OADsB;AAEtBE,EAAAA,MAFsB;AAGtBK,EAAAA;AAHsB,CAAD,KAQnB;AACF,QAAMM,KAAK,GAAGN,SAAS,GAAG,GAAH,GAAS,GAAhC;AACA,SAAQ,GAAEP,OAAO,CAACY,cAAR,CAAuB,EAAvB,EAA2B,EAA3B,CAA+B,IAAGV,MAAM,CAACU,cAAP,CACxC,EADwC,EAExC,EAFwC,CAG1C,IAAGC,KAAM,EAHX;AAIH,CAdD","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { PropagatorType } from '../../../types';\n\nimport type {\n DdRumResourceTracingAttributes,\n SpanId,\n TraceId\n} from './distributedTracing';\n\nexport const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';\n/**\n * Datadog headers\n */\nexport const ORIGIN_HEADER_KEY = 'x-datadog-origin';\nexport const ORIGIN_RUM = 'rum';\nexport const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';\nexport const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';\n/**\n * OTel headers\n */\nexport const TRACECONTEXT_HEADER_KEY = 'traceparent';\nexport const TRACESTATE_HEADER_KEY = 'tracestate';\nexport const B3_HEADER_KEY = 'b3';\nexport const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';\nexport const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';\nexport const B3_MULTI_SAMPLED_HEADER_KEY = 'X-B3-Sampled';\n\nexport const getTracingHeaders = (\n tracingAttributes: DdRumResourceTracingAttributes\n): { header: string; value: string }[] => {\n const headers: { header: string; value: string }[] = [];\n if (tracingAttributes.tracingStrategy === 'DISCARD') {\n return headers;\n }\n tracingAttributes.propagatorTypes.forEach(propagator => {\n switch (propagator) {\n case PropagatorType.DATADOG: {\n headers.push(\n {\n header: ORIGIN_HEADER_KEY,\n value: ORIGIN_RUM\n },\n {\n header: SAMPLING_PRIORITY_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n },\n {\n header: TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toString(10)\n },\n {\n header: PARENT_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toString(10)\n }\n );\n break;\n }\n case PropagatorType.TRACECONTEXT: {\n headers.push(\n {\n header: TRACECONTEXT_HEADER_KEY,\n value: generateTraceContextHeader({\n version: '00',\n traceId: tracingAttributes.traceId,\n parentId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n },\n {\n header: TRACESTATE_HEADER_KEY,\n value: generateTraceStateHeader({\n parentId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n }\n );\n break;\n }\n case PropagatorType.B3: {\n headers.push({\n header: B3_HEADER_KEY,\n value: generateB3Header({\n traceId: tracingAttributes.traceId,\n spanId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n });\n break;\n }\n case PropagatorType.B3MULTI: {\n headers.push(\n {\n header: B3_MULTI_TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toPaddedString(16, 32)\n },\n {\n header: B3_MULTI_SPAN_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toPaddedString(16, 16)\n },\n {\n header: B3_MULTI_SAMPLED_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n }\n );\n }\n }\n });\n\n return headers;\n};\n\nconst generateTraceContextHeader = ({\n version,\n traceId,\n parentId,\n isSampled\n}: {\n version: string;\n traceId: TraceId;\n parentId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '01' : '00';\n return `${version}-${traceId.toPaddedString(\n 16,\n 32\n )}-${parentId.toPaddedString(16, 16)}-${flags}`;\n};\n\nconst generateTraceStateHeader = ({\n parentId,\n isSampled\n}: {\n parentId: SpanId;\n isSampled: boolean;\n}) => {\n const sampled = `s:${isSampled ? '1' : '0'}`;\n const origin = 'o:rum';\n const parent = `p:${parentId.toPaddedString(16, 16)}`;\n\n return `dd=${sampled};${origin};${parent}`;\n};\n\nconst generateB3Header = ({\n traceId,\n spanId,\n isSampled\n}: {\n traceId: TraceId;\n spanId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '1' : '0';\n return `${traceId.toPaddedString(16, 32)}-${spanId.toPaddedString(\n 16,\n 16\n )}-${flags}`;\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '2.0.0-rc.0';
2
+ export const version = '2.0.1';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,YAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.0.0-rc.0';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.0.1';\n"]}
@@ -11,6 +11,7 @@ export declare const PARENT_ID_HEADER_KEY = "x-datadog-parent-id";
11
11
  * OTel headers
12
12
  */
13
13
  export declare const TRACECONTEXT_HEADER_KEY = "traceparent";
14
+ export declare const TRACESTATE_HEADER_KEY = "tracestate";
14
15
  export declare const B3_HEADER_KEY = "b3";
15
16
  export declare const B3_MULTI_TRACE_ID_HEADER_KEY = "X-B3-TraceId";
16
17
  export declare const B3_MULTI_SPAN_ID_HEADER_KEY = "X-B3-SpanId";
@@ -1 +1 @@
1
- export declare const version = "2.0.0-rc.0";
1
+ export declare const version = "2.0.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native",
3
- "version": "2.0.0-rc.0",
3
+ "version": "2.0.1",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -94,5 +94,5 @@
94
94
  "javaPackageName": "com.datadog.reactnative"
95
95
  }
96
96
  },
97
- "gitHead": "b669a61b193a49c512116947c8ca46e27cc2eb67"
97
+ "gitHead": "cbcf40557c1d86879429a894c6672e5c81ebd0a8"
98
98
  }
@@ -75,7 +75,10 @@ export const formatFirstPartyHosts = (
75
75
  if (isLegacyFirstPartyHost(host)) {
76
76
  return {
77
77
  match: host,
78
- propagatorTypes: [PropagatorType.DATADOG]
78
+ propagatorTypes: [
79
+ PropagatorType.DATADOG,
80
+ PropagatorType.TRACECONTEXT
81
+ ]
79
82
  };
80
83
  }
81
84
  return host;
@@ -514,8 +514,14 @@ describe('DdSdkReactNative', () => {
514
514
  '_dd.native_view_tracking': false,
515
515
  '_dd.native_interaction_tracking': false,
516
516
  '_dd.first_party_hosts': [
517
- { match: 'api.example.com', propagatorTypes: ['datadog'] },
518
- { match: 'something.fr', propagatorTypes: ['datadog'] }
517
+ {
518
+ match: 'api.example.com',
519
+ propagatorTypes: ['datadog', 'tracecontext']
520
+ },
521
+ {
522
+ match: 'something.fr',
523
+ propagatorTypes: ['datadog']
524
+ }
519
525
  ]
520
526
  });
521
527
  expect(DdRumResourceTracking.startTracking).toHaveBeenCalledTimes(
@@ -524,8 +530,14 @@ describe('DdSdkReactNative', () => {
524
530
  expect(DdRumResourceTracking.startTracking).toHaveBeenCalledWith({
525
531
  tracingSamplingRate: 42,
526
532
  firstPartyHosts: [
527
- { match: 'api.example.com', propagatorTypes: ['datadog'] },
528
- { match: 'something.fr', propagatorTypes: ['datadog'] }
533
+ {
534
+ match: 'api.example.com',
535
+ propagatorTypes: ['datadog', 'tracecontext']
536
+ },
537
+ {
538
+ match: 'something.fr',
539
+ propagatorTypes: ['datadog']
540
+ }
529
541
  ]
530
542
  });
531
543
  });
@@ -24,6 +24,7 @@ export const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';
24
24
  * OTel headers
25
25
  */
26
26
  export const TRACECONTEXT_HEADER_KEY = 'traceparent';
27
+ export const TRACESTATE_HEADER_KEY = 'tracestate';
27
28
  export const B3_HEADER_KEY = 'b3';
28
29
  export const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';
29
30
  export const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';
@@ -60,16 +61,26 @@ export const getTracingHeaders = (
60
61
  break;
61
62
  }
62
63
  case PropagatorType.TRACECONTEXT: {
63
- headers.push({
64
- header: TRACECONTEXT_HEADER_KEY,
65
- value: generateTraceContextHeader({
66
- version: '00',
67
- traceId: tracingAttributes.traceId,
68
- parentId: tracingAttributes.spanId,
69
- isSampled:
70
- tracingAttributes.samplingPriorityHeader === '1'
71
- })
72
- });
64
+ headers.push(
65
+ {
66
+ header: TRACECONTEXT_HEADER_KEY,
67
+ value: generateTraceContextHeader({
68
+ version: '00',
69
+ traceId: tracingAttributes.traceId,
70
+ parentId: tracingAttributes.spanId,
71
+ isSampled:
72
+ tracingAttributes.samplingPriorityHeader === '1'
73
+ })
74
+ },
75
+ {
76
+ header: TRACESTATE_HEADER_KEY,
77
+ value: generateTraceStateHeader({
78
+ parentId: tracingAttributes.spanId,
79
+ isSampled:
80
+ tracingAttributes.samplingPriorityHeader === '1'
81
+ })
82
+ }
83
+ );
73
84
  break;
74
85
  }
75
86
  case PropagatorType.B3: {
@@ -124,6 +135,20 @@ const generateTraceContextHeader = ({
124
135
  )}-${parentId.toPaddedString(16, 16)}-${flags}`;
125
136
  };
126
137
 
138
+ const generateTraceStateHeader = ({
139
+ parentId,
140
+ isSampled
141
+ }: {
142
+ parentId: SpanId;
143
+ isSampled: boolean;
144
+ }) => {
145
+ const sampled = `s:${isSampled ? '1' : '0'}`;
146
+ const origin = 'o:rum';
147
+ const parent = `p:${parentId.toPaddedString(16, 16)}`;
148
+
149
+ return `dd=${sampled};${origin};${parent}`;
150
+ };
151
+
127
152
  const generateB3Header = ({
128
153
  traceId,
129
154
  spanId,
@@ -22,7 +22,8 @@ import {
22
22
  B3_MULTI_SPAN_ID_HEADER_KEY,
23
23
  B3_MULTI_SAMPLED_HEADER_KEY,
24
24
  ORIGIN_RUM,
25
- ORIGIN_HEADER_KEY
25
+ ORIGIN_HEADER_KEY,
26
+ TRACESTATE_HEADER_KEY
26
27
  } from '../../../distributedTracing/distributedTracingHeaders';
27
28
  import { firstPartyHostsRegexMapBuilder } from '../../../distributedTracing/firstPartyHosts';
28
29
  import {
@@ -54,6 +55,10 @@ const flushPromises = () =>
54
55
  new Promise(jest.requireActual('timers').setImmediate);
55
56
  let xhrProxy;
56
57
 
58
+ const hexToDecimal = (hex: string): string => {
59
+ return BigInt(`0x${hex}`).toString(10);
60
+ };
61
+
57
62
  beforeEach(() => {
58
63
  DdNativeRum.startResource.mockClear();
59
64
  DdNativeRum.stopResource.mockClear();
@@ -444,8 +449,74 @@ describe('XHRProxy', () => {
444
449
  await flushPromises();
445
450
 
446
451
  // THEN
447
- const headerValue = xhr.requestHeaders[TRACECONTEXT_HEADER_KEY];
448
- expect(headerValue).toMatch(/^00-[0-9a-f]{32}-[0-9a-f]{16}-01$/);
452
+ const contextHeader = xhr.requestHeaders[TRACECONTEXT_HEADER_KEY];
453
+ expect(contextHeader).toMatch(/^00-[0-9a-f]{32}-[0-9a-f]{16}-01$/);
454
+
455
+ // Parent value of the context header is the 3rd part of it
456
+ const parentValue = contextHeader.split('-')[2];
457
+ const stateHeader = xhr.requestHeaders[TRACESTATE_HEADER_KEY];
458
+ expect(stateHeader).toBe(`dd=s:1;o:rum;p:${parentValue}`);
459
+ });
460
+
461
+ it('adds tracing headers with matching value when all headers are added', async () => {
462
+ // GIVEN
463
+ const method = 'GET';
464
+ const url = 'https://api.example.com:443/v2/user';
465
+ xhrProxy.onTrackingStart({
466
+ tracingSamplingRate: 100,
467
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
468
+ {
469
+ match: 'example.com',
470
+ propagatorTypes: [PropagatorType.DATADOG]
471
+ },
472
+ {
473
+ match: 'example.com',
474
+ propagatorTypes: [PropagatorType.TRACECONTEXT]
475
+ },
476
+ {
477
+ match: 'example.com',
478
+ propagatorTypes: [PropagatorType.B3]
479
+ },
480
+ {
481
+ match: 'example.com',
482
+ propagatorTypes: [PropagatorType.B3MULTI]
483
+ }
484
+ ])
485
+ });
486
+
487
+ // WHEN
488
+ const xhr = new XMLHttpRequestMock();
489
+ xhr.open(method, url);
490
+ xhr.send();
491
+ xhr.notifyResponseArrived();
492
+ xhr.complete(200, 'ok');
493
+ await flushPromises();
494
+
495
+ // THEN
496
+ const datadogTraceValue = xhr.requestHeaders[TRACE_ID_HEADER_KEY];
497
+ const datadogParentValue = xhr.requestHeaders[PARENT_ID_HEADER_KEY];
498
+
499
+ const contextHeader = xhr.requestHeaders[TRACECONTEXT_HEADER_KEY];
500
+ const traceContextValue = contextHeader.split('-')[1];
501
+ const parentContextValue = contextHeader.split('-')[2];
502
+
503
+ const b3MultiTraceHeader =
504
+ xhr.requestHeaders[B3_MULTI_TRACE_ID_HEADER_KEY];
505
+ const b3MultiParentHeader =
506
+ xhr.requestHeaders[B3_MULTI_SPAN_ID_HEADER_KEY];
507
+
508
+ const b3Header = xhr.requestHeaders[B3_HEADER_KEY];
509
+ const traceB3Value = b3Header.split('-')[0];
510
+ const parentB3Value = b3Header.split('-')[1];
511
+
512
+ expect(hexToDecimal(traceContextValue)).toBe(datadogTraceValue);
513
+ expect(hexToDecimal(parentContextValue)).toBe(datadogParentValue);
514
+
515
+ expect(hexToDecimal(b3MultiTraceHeader)).toBe(datadogTraceValue);
516
+ expect(hexToDecimal(b3MultiParentHeader)).toBe(datadogParentValue);
517
+
518
+ expect(hexToDecimal(traceB3Value)).toBe(datadogTraceValue);
519
+ expect(hexToDecimal(parentB3Value)).toBe(datadogParentValue);
449
520
  });
450
521
 
451
522
  it('adds tracecontext request headers when the host is instrumented with tracecontext and request is sampled', async () => {
@@ -171,7 +171,12 @@ describe('DatadogProvider', () => {
171
171
  expect(
172
172
  NativeModules.DdSdk.initialize.mock.calls[0][0]
173
173
  .additionalConfig['_dd.first_party_hosts']
174
- ).toEqual([{ match: 'api.com', propagatorTypes: ['datadog'] }]);
174
+ ).toEqual([
175
+ {
176
+ match: 'api.com',
177
+ propagatorTypes: ['datadog', 'tracecontext']
178
+ }
179
+ ]);
175
180
  expect(NativeModules.DdRum.addAction).toHaveBeenCalledTimes(1);
176
181
  });
177
182
  });
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '2.0.0-rc.0';
2
+ export const version = '2.0.1';