Exemple #1
0
        // Builder Methods
        public ApiCallMetricBuilder WithActionTime(ApiMetricRequestContext context)
        {
            // TODO: [TESTS] (ApiCallMetricBuilder.WithActionTime) Add tests
            if (context?.ActionStartTime == null || !context.ActionEndTime.HasValue)
            {
                return(this);
            }

            if (context.ActionStartTime.Value > context.ActionEndTime.Value)
            {
                return(this);
            }

            _builder.WithTag(Tags.RanAction, true)
            .WithField(
                Fields.ActionTime,
                (context.ActionEndTime.Value - context.ActionStartTime.Value).TotalMilliseconds
                );

            return(this);
        }