UNPKG

@datadog/mobile-react-native

Version:

A client-side React Native module to interact with Datadog

376 lines 14.7 kB
import type { ProxyConfiguration } from './ProxyConfiguration'; import type { SdkVerbosity } from './SdkVerbosity'; import { TrackingConsent } from './TrackingConsent'; import type { LogEventMapper } from './logs/types'; import type { ActionEventMapper } from './rum/eventMappers/actionEventMapper'; import type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper'; import type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper'; import type { FirstPartyHost } from './rum/types'; export declare enum VitalsUpdateFrequency { FREQUENT = "FREQUENT", AVERAGE = "AVERAGE", RARE = "RARE", NEVER = "NEVER" } export declare enum UploadFrequency { /** * Upload data every 1000ms. */ FREQUENT = "FREQUENT", /** * Upload data every 5000ms. */ AVERAGE = "AVERAGE", /** * Upload data every 10000ms. */ RARE = "RARE" } export declare enum BatchSize { /** * Upload less frequent, larger batches of data */ LARGE = "LARGE", /** * Use default size for batches of data */ MEDIUM = "MEDIUM", /** * Upload more frequent, smaller batches of data */ SMALL = "SMALL" } export declare enum BatchProcessingLevel { /** * Only 1 batch will be sent in a single upload cycle. */ LOW = "LOW", /** * 10 batches will be sent in a single upload cycle */ MEDIUM = "MEDIUM", /** * 100 batches will be sent in a single upload cycle. */ HIGH = "HIGH" } export type FirstPartyHostsConfiguration = (FirstPartyHost | LegacyFirstPartyHost)[]; export type LegacyFirstPartyHost = string; export type CustomEndpoints = { rum?: string; logs?: string; trace?: string; }; /** * Defaults legacy first party hosts format to Datadog first party hosts to keep * retro-compatibility before OTel support was introduced. */ export declare const formatFirstPartyHosts: (firstPartyHosts: FirstPartyHostsConfiguration) => FirstPartyHost[]; export declare const DEFAULTS: { nativeCrashReportEnabled: boolean; sessionSamplingRate: number; resourceTracingSamplingRate: number; site: string; longTaskThresholdMs: number; nativeLongTaskThresholdMs: number; nativeViewTracking: boolean; nativeInteractionTracking: boolean; getFirstPartyHosts: () => never[]; getAdditionalConfiguration: () => {}; trackingConsent: TrackingConsent; telemetrySampleRate: number; vitalsUpdateFrequency: VitalsUpdateFrequency; logEventMapper: null; errorEventMapper: null; resourceEventMapper: null; actionEventMapper: null; trackFrustrations: boolean; uploadFrequency: UploadFrequency; batchSize: BatchSize; trackBackgroundEvents: boolean; getCustomEndpoints: () => {}; bundleLogsWithRum: boolean; bundleLogsWithTraces: boolean; useAccessibilityLabel: boolean; trackWatchdogTerminations: boolean; batchProcessingLevel: BatchProcessingLevel; }; /** * The SDK configuration class. * It will be used to configure the SDK functionality at initialization. */ export declare class DdSdkReactNativeConfiguration { readonly clientToken: string; readonly env: string; readonly applicationId: string; readonly trackInteractions: boolean; readonly trackResources: boolean; readonly trackErrors: boolean; readonly trackingConsent: TrackingConsent; readonly useAccessibilityLabel: boolean; /** * Enables crash reporting for native platforms (iOS, Android). Default `false`. */ nativeCrashReportEnabled: boolean; /** * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release. */ sampleRate?: number; /** * Percentage of sampled RUM sessions. Range `0`-`100`. */ sessionSamplingRate: number; /** * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`. */ resourceTracingSamplingRate: number; site: string; /** * Verbosity for internal SDK logging. * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation. */ verbosity: SdkVerbosity | undefined; /** * Enables native views tracking. * Set to `true` if you use a custom navigation system relying on native views. */ nativeViewTracking: boolean; /** * Enables native interaction tracking. * Set to `true` if you want to track interactions on native screens. */ nativeInteractionTracking: boolean; proxyConfig?: ProxyConfiguration; serviceName?: string; /** * List of your backends hosts to enable tracing with. * Regular expressions are NOT supported. * * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`. */ firstPartyHosts: FirstPartyHostsConfiguration; /** * Overrides the reported version of the app. * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`. * Other special characters are converted to underscores. * * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format. * * 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. */ version?: string; /** * Add a suffix to the reported version of the app. * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`. * Other special characters are converted to underscores. * * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format. * * A dash (`-`) will be automatically added between the version and the suffix */ versionSuffix?: string; /** * The sampling rate for Internal Telemetry (info related to the work of the * SDK internals). * * The sampling rate must be a value between 0 and 100. A value of 0 means no * telemetry will be sent, 100 means all telemetry will be sent. When * `telemetrySampleRate` is not set, the default value from the iOS and * Android SDK is used, which is 20. */ telemetrySampleRate: number; /** * The threshold for native long tasks reporting in milliseconds. * * - Setting it to `0` or `false` disables native long task reporting. * - Values below `100` will be raised to `100`. * - Values above `5000` will be lowered to `5000`. * * Default value is `200`. */ nativeLongTaskThresholdMs: number | false; /** * The threshold for javascript long tasks reporting in milliseconds. * * - Setting it to `0` or `false` disables javascript long task reporting. * - Values below `100` will be raised to `100`. * - Values above `5000` will be lowered to `5000`. * * Default value is `0` */ longTaskThresholdMs: number | false; /** * Sets the preferred frequency for collecting mobile vitals. */ vitalsUpdateFrequency: VitalsUpdateFrequency; /** * Enables tracking of frustration signals (error taps). Defaults to `true`. */ trackFrustrations: boolean; /** * Sets the preferred frequency for uploading batches of data. */ uploadFrequency: UploadFrequency; /** * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers. * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests. */ batchSize: BatchSize; /** * Enables tracking of RUM event when no RUM View is active. * * By default, background events are not tracked. Enabling this feature might increase the * number of sessions tracked and impact your billing. */ trackBackgroundEvents: boolean; /** * Enables RUM correlation with logs. * * By default, RUM is enabled for logs. */ bundleLogsWithRum: boolean; /** * Enables Traces correlation with logs. * * By default, Traces is enabled for logs. */ bundleLogsWithTraces: boolean; /** * Sets the preferred level for processing batches of data. */ batchProcessingLevel: BatchProcessingLevel; /** * Enables tracking of non-fatal ANRs on Android. * By default, the reporting of non-fatal ANRs on Android 30+ is disabled because it would * create too much noise over fatal ANRs. On Android 29 and below, however, * the reporting of non-fatal ANRs is enabled by default, * as fatal ANRs cannot be reported on those versions. */ trackNonFatalAnrs?: boolean; /** * The app hang threshold in seconds for non-fatal app hangs on iOS. * * App hangs are an iOS-specific type of error that happens when the application is unresponsive for too long. * By default, app hangs reporting is disabled, but you can enable it and set your * own threshold to monitor app hangs that last more than a specified * duration by using the this parameter. * * Set the `appHangThreshold` parameter to the minimal duration you want * app hangs to be reported. For example, enter 0.25 to report hangs lasting at least 250 ms. * See [Configure the app hang threshold](https://docs.datadoghq.com/real_user_monitoring/error_tracking/mobile/ios/?tab=cocoapods#configure-the-app-hang-threshold) * for more guidance on what to set this value to. */ appHangThreshold?: number; /** * The amount of time after a view starts where a Resource should be * considered when calculating Time to Network-Settled (TNS). TNS will be * calculated using all resources that start withing the specified threshold, in seconds. * Defaults to 0.1 seconds. */ initialResourceThreshold?: number; /** * Determines whether the SDK should track application termination by the watchdog on iOS. Default: `false`. */ trackWatchdogTerminations: boolean; /** * Specifies a custom prop to name RUM actions on elements having an `onPress` prop. * * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name: * * ```js * <TouchableOpacity testID="Dismiss notification" onPress={() => dismiss()}> * ``` * * `dd-action-name` is favored when both attributes are present on an element. */ actionNameAttribute?: string; logEventMapper: LogEventMapper | null; errorEventMapper: ErrorEventMapper | null; resourceEventMapper: ResourceEventMapper | null; actionEventMapper: ActionEventMapper | null; additionalConfiguration: { [k: string]: any; }; customEndpoints: CustomEndpoints; constructor(clientToken: string, env: string, applicationId: string, trackInteractions?: boolean, trackResources?: boolean, trackErrors?: boolean, trackingConsent?: TrackingConsent, useAccessibilityLabel?: boolean); } /** * Auto Instrumentation configuration passed to DatadogProvider. * Does not include default values. */ export type AutoInstrumentationConfiguration = { readonly trackInteractions: boolean; readonly trackResources: boolean; readonly firstPartyHosts?: FirstPartyHostsConfiguration; readonly resourceTracingSamplingRate?: number; readonly trackErrors: boolean; readonly logEventMapper?: LogEventMapper | null; readonly errorEventMapper?: ErrorEventMapper | null; readonly resourceEventMapper?: ResourceEventMapper | null; readonly actionEventMapper?: ActionEventMapper | null; readonly useAccessibilityLabel?: boolean; readonly actionNameAttribute?: string; }; /** * Parameters needed to start auto instrumentation. Includes default values. */ export type AutoInstrumentationParameters = { readonly trackInteractions: boolean; readonly trackResources: boolean; readonly firstPartyHosts: FirstPartyHostsConfiguration; readonly resourceTracingSamplingRate: number; readonly trackErrors: boolean; readonly logEventMapper: LogEventMapper | null; readonly errorEventMapper: ErrorEventMapper | null; readonly resourceEventMapper: ResourceEventMapper | null; readonly actionEventMapper: ActionEventMapper | null; readonly useAccessibilityLabel: boolean; readonly actionNameAttribute?: string; }; /** * We could use `Proxy` instead of this function, but `Proxy` is not available on * the older android jsc that can still be used. */ export declare const addDefaultValuesToAutoInstrumentationConfiguration: (features: AutoInstrumentationConfiguration) => AutoInstrumentationParameters; export type PartialInitializationConfiguration = { readonly clientToken: string; readonly env: string; readonly applicationId: string; readonly sessionSamplingRate?: number; readonly site?: string; readonly verbosity?: SdkVerbosity | undefined; readonly nativeViewTracking?: boolean; readonly nativeInteractionTracking?: boolean; readonly proxyConfig?: ProxyConfiguration; readonly serviceName?: string; readonly version?: string; versionSuffix?: string; readonly additionalConfiguration?: { [k: string]: any; }; readonly trackingConsent?: TrackingConsent; readonly longTaskThresholdMs?: number | false; readonly nativeLongTaskThresholdMs?: number | false; readonly nativeCrashReportEnabled?: boolean; readonly telemetrySampleRate?: number; readonly vitalsUpdateFrequency?: VitalsUpdateFrequency; readonly trackFrustrations?: boolean; readonly uploadFrequency?: UploadFrequency; readonly batchSize?: BatchSize; readonly trackBackgroundEvents?: boolean; readonly customEndpoints?: CustomEndpoints; readonly bundleLogsWithRum?: boolean; readonly bundleLogsWithTraces?: boolean; readonly batchProcessingLevel?: BatchProcessingLevel; readonly initialResourceThreshold?: number; }; export declare const buildConfigurationFromPartialConfiguration: (features: AutoInstrumentationConfiguration, configuration: PartialInitializationConfiguration) => DdSdkReactNativeConfiguration; export declare class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration { initializationMode: InitializationMode; } export declare enum InitializationMode { SYNC = "SYNC", ASYNC = "ASYNC" } export type InitializationModeForTelemetry = 'LEGACY' | 'SYNC' | 'ASYNC' | 'PARTIAL' | 'FILE'; //# sourceMappingURL=DdSdkReactNativeConfiguration.d.ts.map