OpenTelemetry SDK
    Preparing search index...
    • Read an instrumentation's declarative config and map it onto config fields.

      Builds typed readers over the instrumentation's own node and the shared general node, passes them to reader, and returns a partial config to merge over the current one. Nested fields are deep-merged with currentConfig, so declarative config that sets one leaf does not drop sibling leaves set in code. Reading never throws (a reader error is caught and warned), because setConfigProvider() must not. Properties the instrumentation owns but the reader did not read are reported together as unhandled.

      setConfigProvider(configProvider: ConfigProvider): void {
      const config = readDeclarativeConfig({
      configProvider,
      instrumentationName: this.instrumentationName,
      generalDomains: ['http'],
      currentConfig: this.getConfig() as Record<string, unknown>,
      diag: this._diag,
      reader: (own, general): Partial<MyConfig> => ({
      redactedQueryParams: own.getStringArray('redacted_query_params'),
      }),
      });
      if (Object.keys(config).length > 0) {
      this.setConfig({ ...this.getConfig(), ...config });
      }
      }

      Type Parameters

      • ConfigType

      Parameters

      • opts: {
            configProvider: ConfigProvider;
            currentConfig?: Record<string, unknown>;
            diag?: DiagLogger;
            generalDomains?: string[];
            instrumentationName: string;
            reader: DeclarativeConfigReader<ConfigType>;
        }
        • configProvider: ConfigProvider
        • OptionalcurrentConfig?: Record<string, unknown>

          The instrumentation's current config. Nested fields are merged over the matching branch of this, so declarative config that sets one leaf does not drop sibling leaves set in code.

        • Optionaldiag?: DiagLogger
        • OptionalgeneralDomains?: string[]

          The general domains this instrumentation is responsible for, e.g. ['http']. Unhandled properties are reported for these domains only, because general is shared between instrumentations.

        • instrumentationName: string
        • reader: DeclarativeConfigReader<ConfigType>

      Returns Partial<ConfigType>