The Interface which defines the InternalSdkStats manager, which is responsible for creating and managing the InternalSdkStats instance.

3.3.7

interface IStatsMgr {
    enabled: boolean;
    init: (<CfgType>(core: IAppInsightsCore<CfgType>, createStatsCore: CreateStatsCoreFn, featureName?: string, useFeature?: UseFeatureFn) => IUnloadHook);
    newInst: ((state: IInternalSdkStatsState) => IInternalSdkStats);
}

Properties

Properties

enabled: boolean

If there is a manager instance available, this will identify if the manager is enabled or not.

True if the manager is enabled, false otherwise.

init: (<CfgType>(core: IAppInsightsCore<CfgType>, createStatsCore: CreateStatsCoreFn, featureName?: string, useFeature?: UseFeatureFn) => IUnloadHook)

Initialize and associate this manager with the provided core instance. The manager reads its configuration directly from the single global config (config.stats) and gates itself behind the SDK Stats feature flag, so any changes made via the CDN / dynamic config are picked up at runtime.

Type declaration

    • <CfgType>(core, createStatsCore, featureName?, useFeature?): IUnloadHook
    • Type Parameters

      Parameters

      • core: IAppInsightsCore<CfgType>

        The core instance to associate with this manager.

      • createStatsCore: CreateStatsCoreFn

        Creates an isolated, initialized core for SDK Stats. The callback lets each SKU select the appropriate channel and plugins without using the customer's pipeline.

      • OptionalfeatureName: string

        The optional featureOptIn name used to gate the manager. Defaults to the SDK Stats feature (STATS_SDK_FEATURE) which is enabled by default and can be opted-out via the featureOptIn configuration.

      • OptionaluseFeature: UseFeatureFn

        Optional feature operation throttle supplied by the SKU.

      Returns IUnloadHook

      The unload hook for the stats beat manager, which can be used to unload and disable the manager. This may return null if the manager cannot be initialized.

This method should be called only once, and it may throw an error if called multiple times.

Returns a new IInternalSdkStats instance for the current state which includes the endpoint. This method should be called only after the manager has been initialized and the IInternalSdkStatsConfig has been set, otherwise it will return null.

Type declaration