예제 #1
0
        private ConfigDelta ParseConfigPayload(HttpResponseMessage httpResponse, ConfigPayload configPayload)
        {
            if (httpResponse.Headers?.ETag == null)
            {
                throw new FailedToFetchConfigException("Response from APM Server doesn't have ETag header");
            }

            var eTag = httpResponse.Headers.ETag.ToString();

            var configParser = new ConfigParser(_logger, configPayload, eTag);

            if (configPayload.UnknownKeys != null && !configPayload.UnknownKeys.IsEmpty())
            {
                _logger.Info()
                ?.Log("Central configuration response contains keys that are not in the list of options"
                      + " that can be changed after Agent start: {UnknownKeys}. Supported options: {ReloadableOptions}."
                      , string.Join(", ", configPayload.UnknownKeys.Select(kv => $"`{kv.Key}'"))
                      , string.Join(", ", ConfigPayload.SupportedOptions.Select(k => $"`{k}'")));
            }

            return(new ConfigDelta(
                       captureBody: configParser.CaptureBody,
                       captureBodyContentTypes: configParser.CaptureBodyContentTypes,
                       transactionMaxSpans: configParser.TransactionMaxSpans,
                       transactionSampleRate: configParser.TransactionSampleRate,
                       eTag: eTag
                       ));
        }
예제 #2
0
 public ConfigParser(IApmLogger logger, ConfigPayload configPayload, string eTag) : base(logger, ThisClassName)
 {
     _configPayload = configPayload;
     _eTag          = eTag;
 }