Пример #1
0
        protected override void OnCreated(CreateOrderPayload payload)
        {
            var span = Spans[payload.OperationId];

            span.Finish();
            Spans.Remove(payload.OperationId);
        }
Пример #2
0
        protected override void OnCreating(CreateOrderPayload payload)
        {
            var scope = _tracer.BuildSpan("Create order").StartActive();

            scope.Span.Log(new Dictionary <string, object>()
            {
                { "dto", payload.Dto }
            });

            Spans.Add(payload.OperationId, scope.Span);
        }
        protected override void OnCreationError(CreateOrderPayload payload)
        {
            OrderCreationErrorTotal.Inc();

            if (Operations.TryGetValue(payload.OperationId, out var startedAt))
            {
                var duration = payload.Timestamp.Subtract(startedAt).TotalMilliseconds;
                OrderCreationDuration.Observe(duration);
                Operations.Remove(payload.OperationId);
            }
        }
Пример #4
0
        protected override void OnCreationError(CreateOrderPayload payload)
        {
            var span = Spans[payload.OperationId];
            var e    = payload.Exception;

            span.SetTag(Tags.Error, true);
            span.Log(new Dictionary <string, object>(3)
            {
                { LogFields.Event, Tags.Error.Key },
                { LogFields.ErrorKind, e.GetType().Name },
                { LogFields.ErrorObject, e }
            });
            Spans.Remove(payload.OperationId);
        }
 protected override void OnCreationError(CreateOrderPayload payload)
 {
     _logger.LogError(payload.Exception, $"Order ${JsonSerializer.Serialize(payload.Dto)} creation error");
 }
 protected override void OnCreated(CreateOrderPayload payload)
 {
     _logger.LogInformation($"Order ${payload.Order.Id} created");
 }
 protected override void OnCreating(CreateOrderPayload payload)
 {
     _logger.LogInformation($"Creating order ${JsonSerializer.Serialize(payload.Dto)}");
 }
 protected override void OnCreating(CreateOrderPayload payload)
 {
     Operations.Add(payload.OperationId, payload.Timestamp);
 }