Exemple #1
0
        public void WithFlowingContextGlobal_should_return_a_tracer_that_adds_global_value_of_given_type_to_spans()
        {
            FlowingContext.Globals.Set("123");

            enrichedTracer = baseTracer.WithFlowingContextGlobal <string>(globalName);

            enrichedTracer.BeginSpan();

            spanBuilder.Received().SetAnnotation(globalName, "123", Arg.Any <bool>());
        }
        public void WithAnnotation_should_return_a_tracer_that_adds_given_annotation_when_value_is_not_null()
        {
            enrichedTracer = baseTracer.WithAnnotation("key", "value");

            enrichedTracer.BeginSpan();

            spanBuilder.Received().SetAnnotation("key", "value", Arg.Any <bool>());
        }
Exemple #3
0
        public void Should_record_request_annotations()
        {
            Run();

            spanBuilder.Received(1).SetAnnotation(WellKnownAnnotations.Http.Request.Method, request.Method);
            spanBuilder.Received(1).SetAnnotation(WellKnownAnnotations.Http.Request.Url, request.Url.ToString());
            spanBuilder.Received(1).SetAnnotation(WellKnownAnnotations.Http.Request.TargetService, targetService);
            spanBuilder.Received(1).SetAnnotation(WellKnownAnnotations.Http.Request.TargetEnvironment, targetEnvironment);
        }
        public void Should_write_provided_operation_name_on_dispose_if_nothing_else_was_called()
        {
            var specializedBuilder = BeginSpan("op");

            builder.DidNotReceive().SetAnnotation(WellKnownAnnotations.Common.Operation, Arg.Any <string>());

            specializedBuilder.Dispose();

            builder.Received(1).SetAnnotation(WellKnownAnnotations.Common.Operation, "op");
        }