()
| 772 | } |
| 773 | |
| 774 | async init() { |
| 775 | if (this.initialized) return |
| 776 | |
| 777 | try { |
| 778 | const hasAnalyticsConfig = Boolean(this.options.analytic) |
| 779 | if (!hasAnalyticsConfig && !tracingEnvEnabled()) return |
| 780 | |
| 781 | const initial = hasAnalyticsConfig ? JSON.parse(this.options.analytic) : {} |
| 782 | const { analytic, envCredentials } = applyEnvTracingProviders(initial) |
| 783 | for (const provider in analytic) { |
| 784 | const providerStatus = analytic[provider].status as boolean |
| 785 | if (providerStatus) { |
| 786 | const credentialData = |
| 787 | envCredentials[provider] ?? |
| 788 | (await getCredentialData((analytic[provider].credentialId as string) ?? '', this.options)) |
| 789 | await this.initializeProvider(provider, analytic[provider], credentialData) |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | this.initialized = true |
| 794 | } catch (e) { |
| 795 | throw new Error(e) |
| 796 | } |
| 797 | } |
| 798 | |
| 799 | hasActiveProviders(): boolean { |
| 800 | return Object.keys(this.handlers).length > 0 |
nothing calls this directly
no test coverage detected