コード例 #1
0
        public ITracingState AcceptDistributedTraceHeaders <T>(T carrier, Func <T, string, IEnumerable <string> > getter, TransportType transportType, DateTime transactionStartTime)
        {
            if (getter == null)
            {
                Log.Debug("getHeaders argument is null.");
                return(null);
            }

            try
            {
                var tracingState = TracingState.AcceptDistributedTraceHeaders(carrier, getter, transportType, _configurationService.Configuration.TrustedAccountKey, transactionStartTime);

                if (tracingState?.IngestErrors != null)
                {
                    ReportIncomingErrors(tracingState.IngestErrors);
                }

                if (_configurationService.Configuration.PayloadSuccessMetricsEnabled)
                {
                    if (tracingState?.NewRelicPayloadWasAccepted == true)
                    {
                        _agentHealthReporter.ReportSupportabilityDistributedTraceAcceptPayloadSuccess();
                    }

                    if (tracingState?.TraceContextWasAccepted == true)
                    {
                        _agentHealthReporter.ReportSupportabilityTraceContextAcceptSuccess();
                    }
                }

                return(tracingState);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(null);
            }
        }