Ejemplo n.º 1
0
        public ISpan Start()
        {
            ISpan innerSpan = _innerSpanBuilder.Start();
            ISpan span      = new AdvancedSpan(innerSpan, _traceContext, true);

            return(span);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> RebuildFromFormFile([FromForm][Required] IFormFile file)
        {
            bool zipRequest = Request.Path.ToString().ToLower().EndsWith(Constants.Endpoints.ZIP_FILE);

            _logger.LogInformation($"[{UserAgentInfo.ClientTypeString}]:: {nameof(RebuildFromFormFile)} method invoked");

            string originalStoreFilePath = string.Empty;
            string rebuiltStoreFilePath  = string.Empty;
            string fileId                      = string.Empty;
            string tempFolderPath              = Path.Combine(Constants.VAR_PATH, $"{Guid.NewGuid()}");
            string extractedFolderPath         = Path.Combine(tempFolderPath, $"{Guid.NewGuid()}");
            string extractedRebuildZipFilePath = Path.Combine(tempFolderPath, $"{Guid.NewGuid()}");
            string extractedRebuildFolderPath  = Path.Combine(tempFolderPath, $"{Guid.NewGuid()}");
            CloudProxyResponseModel cloudProxyResponseModel = new CloudProxyResponseModel();

            ISpanBuilder builder = _tracer.BuildSpan("Post::Data");
            ISpan        span    = builder.Start();

            // Set some context data
            span.Log("Rebuild file");
            span.SetTag("Jaeger Testing Client", "POST api/Rebuild/file request");

            try
            {
                if (!_fileUtility.TryReadFormFile(file, out byte[] fileBytes))
        public async Task <IActionResult> DetermineFileTypeFromBase64([FromBody][Required] Base64Request request)
        {
            _logger.LogInformation($"[{UserAgentInfo.ClientTypeString}]:: {nameof(DetermineFileTypeFromBase64)} method invoked");

            string originalStoreFilePath = string.Empty;
            string rebuiltStoreFilePath  = string.Empty;
            string fileId = string.Empty;
            CloudProxyResponseModel cloudProxyResponseModel = new CloudProxyResponseModel();

            ISpanBuilder builder = _tracer.BuildSpan("Post::Data");
            ISpan        span    = builder.Start();

            // Set some context data
            span.Log("File Type Detection base64");
            span.SetTag("Jaeger Testing Client", "POST api/FileTypeDetection/base64 request");

            try
            {
                if (!ModelState.IsValid)
                {
                    cloudProxyResponseModel.Errors.AddRange(ModelState.Values.SelectMany(v => v.Errors).Select(x => x.ErrorMessage));
                    return(BadRequest(cloudProxyResponseModel));
                }

                if (!_fileUtility.TryGetBase64File(request.Base64, out byte[] file))
Ejemplo n.º 4
0
        public static ISpan StartNonActive(this ISpanBuilder spanBuilder)
        {
            AdvancedSpanBuilder advancedSpanBuilder = spanBuilder as AdvancedSpanBuilder;

            ISpan span = advancedSpanBuilder != null
                            ? advancedSpanBuilder.StartNonActive()
                            : spanBuilder.Start();

            return(span);
        }
Ejemplo n.º 5
0
        public virtual ISpan Start()
        {
            var span = _spanBuilder.Start();

            _hooks.OnSpanStarted(span, _operationName);
            var callback  = _hooks.OnSpanStartedWithFinishCallback(span, _operationName);
            var spanHooks = new SpanDecoratorHooks(_hooks, callback);

            var decorator = new SpanDecorator(span, _tracer, _operationName, spanHooks);

            ApplyPostponedTags(decorator);
            return(decorator);
        }
Ejemplo n.º 6
0
        public void Start()
        {
            string       expectedOperationName = "Testoperation";
            Tracer       tracer  = new Tracer();
            ISpanBuilder builder = tracer.BuildSpan(expectedOperationName);
            ISpan        span    = builder.Start();

            string[] actualSpanFields     = span.ToString().Split(";");
            string   actualOperationName  = actualSpanFields[0];
            string   actualStartTimeStamp = actualSpanFields[1];
            string   actualSpanContext    = actualSpanFields[2];

            Assert.AreEqual(expectedOperationName, actualOperationName);
            Assert.IsNotNull(actualStartTimeStamp);
        }
        private ISpan BuildNewSpanWithDefaultTags(CommandStartedEvent @event)
        {
            IScope activeScope = _tracer.ScopeManager.Active;

            ISpanBuilder span = _tracer
                                .BuildSpan($"{CallistoConstants.TracerPrefix}-{MongoCommandHelper.NormalizeCommandName(@event.CommandName)}")
                                .WithTag(Tags.SpanKind, Tags.SpanKindClient)
                                .WithTag(Tags.Component, "Solari.Callisto")
                                .WithTag(Tags.DbStatement, SanitateDbStatement(@event.Command.ToString()))
                                .WithTag(Tags.DbInstance, @event.DatabaseNamespace.DatabaseName)
                                .WithTag("mongodb.host", @event.ConnectionId.ServerId.EndPoint.ToString())
                                .WithTag("mongodb.host.clusterid", @event.ConnectionId.ServerId.ClusterId.ToString())
                                .WithTag(Tags.DbType, "MongoDb");

            return(activeScope?.Span == null?span.Start() : span.AsChildOf(_tracer.ScopeManager.Active.Span).Start());
        }
        public void TestStartTimestamp()
        {
            MockTracer     tracer = new MockTracer();
            DateTimeOffset startTimestamp;
            {
                ISpanBuilder fooSpan = tracer.BuildSpan("foo");
                Thread.Sleep(20);
                startTimestamp = DateTimeOffset.Now;
                fooSpan.Start().Finish();
            }
            List <MockSpan> finishedSpans = tracer.FinishedSpans();

            Assert.Single(finishedSpans);
            MockSpan span = finishedSpans[0];

            Assert.True(startTimestamp <= span.StartTimestamp);
            Assert.True(DateTimeOffset.Now >= span.FinishTimestamp);
        }