Пример #1
0
        public IDisposable CreateTracingMetricsTimerOnExistingTrace(
            [NotNull] Trace trace,
            string entityName,
            [CallerMemberName] string actionName = null,
            params string[] additionalLabels)
        {
            if (string.IsNullOrEmpty(_tracingServiceName))
            {
                throw new NullReferenceException($"{nameof(_tracingServiceName)} is not initialized");
            }

            if (Summary == null)
            {
                throw new NullReferenceException($"{nameof(Summary)} is not initialized");
            }

            var tracingTimer = new TracingTimer(trace, _tracingServiceName, actionName);
            var metricTimer  = new MetricsTimer(
                Summary,
                ConcatLabelValues(
                    actionName,
                    entityName,
                    _externalHttpServiceName,
                    null,
                    additionalLabels));


            return(new TimersWrapper(metricTimer, tracingTimer));
        }
Пример #2
0
        public IDisposable CreateTracingWithLoggingMetricsTimer(
            [NotNull] Dictionary <string, string> getTracingCallback,
            string entityName,
            [CallerMemberName] string actionName = null,
            object requestParams     = null,
            TimeSpan?longRequestTime = null,
            params string[] additionalLabels)
        {
            if (string.IsNullOrEmpty(_tracingServiceName))
            {
                throw new NullReferenceException($"{nameof(_tracingServiceName)} is not initialized");
            }

            if (Summary == null)
            {
                throw new NullReferenceException($"{nameof(Summary)} is not initialized");
            }

            var tracingTimer = new TracingTimer(Trace.Current, _tracingServiceName, actionName, getTracingCallback);
            var metricTimer  = new MetricsTimer(
                Summary,
                ConcatLabelValues(
                    actionName,
                    entityName,
                    _externalHttpServiceName,
                    null,
                    additionalLabels),
                longRequestTime ?? _longRequestTime,
                requestParams,
                _logSource);

            return(new TimersWrapper(metricTimer, tracingTimer));
        }
Пример #3
0
        public IDisposable CreateTracingTimer([NotNull] Dictionary <string, string> getTracingTagsCallback, [CallerMemberName] string actionName = null)
        {
            if (string.IsNullOrEmpty(_tracingServiceName))
            {
                throw new NullReferenceException($"{nameof(_tracingServiceName)} is not initialized");
            }

            var tracingTimer = new TracingTimer(Trace.Current, _tracingServiceName, actionName, getTracingTagsCallback);

            return(new TimersWrapper(tracingTimer));
        }
Пример #4
0
 public TimersWrapper(TracingTimer tracingTimer)
 {
     _tracingTimer = tracingTimer;
 }
Пример #5
0
 public TimersWrapper(MetricsTimer metricsTimer, TracingTimer tracingTimer)
 {
     _metricsTimer = metricsTimer;
     _tracingTimer = tracingTimer;
 }