Exemple #1
0
 public void Push()
 {
     if (Interlocked.CompareExchange(ref _isPush, 1, 0) == 0)
     {
         _fields["elapsed_milliseconds"] = ((Stopwatch.GetTimestamp() - _currentTimestamp) * 1000) / (float)Stopwatch.Frequency;
         _collector.Push(new Payload(new Point(_measurement, _fields, _tags, _utcTimestamp.HasValue ? _utcTimestamp : DateTime.UtcNow)));
     }
 }
 public void Push()
 {
     if (Interlocked.CompareExchange(ref _isPush, 1, 0) == 0)
     {
         _fields["elapsed_microseconds"] = StopwatchUtils.GetElapsedMicroseconds(_currentTimestamp);
         _collector.Push(new Payload(new Point(_measurement, _fields, _tags, _utcTimestamp.HasValue ? _utcTimestamp : DateTime.UtcNow)));
     }
 }
Exemple #3
0
        public Task Invoke(MethodProfilingContext profilingContext)
        {
            var profilingFields = new FieldCollection();
            var profilingTags   = new TagCollection();

            _tagReader.Read(profilingTags);
            profilingFields[MethodProfilingConstants.ElapsedMicroseconds] = profilingContext.ElapsedMicroseconds;
            profilingTags[MethodProfilingConstants.ImplementationType]    = profilingContext.ImplementationType;
            profilingTags[MethodProfilingConstants.MethodName]            = profilingContext.MethodName;
            profilingTags[MethodProfilingConstants.Namespace]             = profilingContext.Namespace;
            profilingTags[MethodProfilingConstants.ServiceType]           = profilingContext.ServiceType;
            var point = new Point(profilingContext.ProfilerName, profilingFields, profilingTags);

            return(Task.FromResult(_collector.Push(new Payload(point))));
        }
        public Task Invoke(ApplicationThreadingProfilingContext profilingContext)
        {
            var profilingFields = new FieldCollection();
            var profilingTags   = new TagCollection();

            profilingFields.Add(ApplicationProfilingConstants.AvailableCompletionPortThreads, profilingContext.AvailableCompletionPortThreads);
            profilingFields.Add(ApplicationProfilingConstants.AvailableWorkerThreads, profilingContext.AvailableWorkerThreads);
            profilingFields.Add(ApplicationProfilingConstants.MinCompletionPortThreads, profilingContext.MinCompletionPortThreads);
            profilingFields.Add(ApplicationProfilingConstants.MinWorkerThreads, profilingContext.MinWorkerThreads);
            profilingFields.Add(ApplicationProfilingConstants.MaxCompletionPortThreads, profilingContext.MaxCompletionPortThreads);
            profilingFields.Add(ApplicationProfilingConstants.MaxWorkerThreads, profilingContext.MaxWorkerThreads);

            profilingTags.Add(ProfilingConstants.ApplicationName, _applicationOptions.ApplicationName);
            profilingTags.Add(ProfilingConstants.Environment, _applicationOptions.Environment);

            var point = new Point(profilingContext.ProfilerName, profilingFields, profilingTags, DateTime.UtcNow);

            return(Task.FromResult(_collector.Push(new Payload(point))));
        }
        public Task Invoke(RedisProfilingContext profilingContext)
        {
            var points = new List <Point>();

            foreach (var command in profilingContext.ProfilingCommands)
            {
                var redisProfilingFields = new FieldCollection();
                var redisProfilingTags   = new TagCollection();
                _tagReader.Read(redisProfilingTags);
                redisProfilingFields[RedisProfilingConstants.Elapsed]        = command.Elapsed.Milliseconds;
                redisProfilingFields[RedisProfilingConstants.OperationCount] = command.OperationCount.ToString();
                redisProfilingTags[RedisProfilingConstants.ClientName]       = command.ClientName;
                redisProfilingTags[RedisProfilingConstants.Command]          = command.Command;
                redisProfilingTags[RedisProfilingConstants.Db]     = command.Db.ToString();
                redisProfilingTags[RedisProfilingConstants.Server] = command.Server.ToString();
                points.Add(new Point(profilingContext.ProfilerName, redisProfilingFields, redisProfilingTags));
            }
            return(Task.FromResult(_collector.Push(new Payload(points))));
        }
        public Task Invoke(ApplicationGCProfilingContext profilingContext)
        {
            var profilingFields = new FieldCollection();
            var profilingTags   = new TagCollection();

            profilingFields.Add(ApplicationProfilingConstants.Gen0_CollectionCount, profilingContext.Gen0_CollectionCount);
            profilingFields.Add(ApplicationProfilingConstants.Gen1_CollectionCount, profilingContext.Gen1_CollectionCount);
            profilingFields.Add(ApplicationProfilingConstants.Gen2_CollectionCount, profilingContext.Gen2_CollectionCount);
            profilingFields.Add(ApplicationProfilingConstants.TotalCollectionCount, profilingContext.TotalCollectionCount);
            profilingFields.Add(ApplicationProfilingConstants.TotalMemory, profilingContext.TotalMemory);

            profilingTags.Add(ProfilingConstants.ApplicationName, _applicationOptions.ApplicationName);
            profilingTags.Add(ProfilingConstants.Environment, _applicationOptions.Environment);
            profilingTags.Add(ApplicationProfilingConstants.GCLatencyMode, profilingContext.GCLatencyMode);
            profilingTags.Add(ApplicationProfilingConstants.GCMode, profilingContext.GCMode);

            var point = new Point(profilingContext.ProfilerName, profilingFields, profilingTags, DateTime.UtcNow);

            return(Task.FromResult(_collector.Push(new Payload(point))));
        }
        public Task Invoke(RedisProfilingContext profilingContext)
        {
            var points = new List <Point>();

            foreach (var command in profilingContext.ProfilingCommands)
            {
                var redisProfilingFields = new FieldCollection();
                var redisProfilingTags   = new TagCollection();
                redisProfilingFields.Add(RedisProfilingConstants.Elapsed, command.Elapsed.Milliseconds);
                redisProfilingFields.Add(RedisProfilingConstants.OperationCount, command.OperationCount.ToString());
                redisProfilingTags.Add(ProfilingConstants.ApplicationName, _apmOptions.ApplicationName);
                redisProfilingTags.Add(ProfilingConstants.Environment, _apmOptions.Environment);
                redisProfilingTags.Add(RedisProfilingConstants.ClientName, command.ClientName);
                redisProfilingTags.Add(RedisProfilingConstants.Command, command.Command);
                redisProfilingTags.Add(RedisProfilingConstants.Db, command.Db.ToString());
                redisProfilingTags.Add(RedisProfilingConstants.Server, command.Server.ToString());
                points.Add(new Point(profilingContext.ProfilerName, redisProfilingFields, redisProfilingTags));
            }
            return(Task.FromResult(_collector.Push(new Payload(points))));
        }
        public Task Invoke(HttpProfilingContext profilingContext)
        {
            var httpProfilingFields = new FieldCollection();
            var httProfilingTags    = new TagCollection();

            _tagReader.Read(httProfilingTags);
            httpProfilingFields[HttpProfilingConstants.Elapsed]   = profilingContext.Elapsed;
            httProfilingTags[HttpProfilingConstants.HttpHost]     = profilingContext.HttpHost;
            httProfilingTags[HttpProfilingConstants.HttpMethod]   = profilingContext.HttpMethod;
            httProfilingTags[HttpProfilingConstants.HttpPath]     = profilingContext.HttpPath;
            httProfilingTags[HttpProfilingConstants.HttpPort]     = profilingContext.HttpPort;
            httProfilingTags[HttpProfilingConstants.HttpProtocol] = profilingContext.HttpProtocol;
            httProfilingTags[HttpProfilingConstants.HttpScheme]   = profilingContext.HttpScheme;
            httProfilingTags[HttpProfilingConstants.StatusCode]   = profilingContext.StatusCode;
            httProfilingTags[HttpProfilingConstants.IdentityAuthenticationType] = profilingContext.IdentityAuthenticationType;
            httProfilingTags[HttpProfilingConstants.IdentityName]        = profilingContext.IdentityName;
            httProfilingTags[HttpProfilingConstants.RequestContentType]  = profilingContext.RequestContentType;
            httProfilingTags[HttpProfilingConstants.ResponseContentType] = profilingContext.ResponseContentType;
            var point = new Point(profilingContext.ProfilerName, httpProfilingFields, httProfilingTags);

            return(Task.FromResult(_collector.Push(new Payload(new Point[] { point }))));
        }
        public Task Invoke(HttpProfilingContext profilingContext)
        {
            var httpProfilingFields = new FieldCollection();
            var httProfilingTags    = new TagCollection();

            httpProfilingFields.Add(HttpProfilingConstants.Elapsed, profilingContext.Elapsed);
            httProfilingTags.Add(ProfilingConstants.ApplicationName, _apmOptions.ApplicationName);
            httProfilingTags.Add(ProfilingConstants.Environment, _apmOptions.Environment);
            httProfilingTags.Add(HttpProfilingConstants.HttpHost, profilingContext.HttpHost);
            httProfilingTags.Add(HttpProfilingConstants.HttpMethod, profilingContext.HttpMethod);
            httProfilingTags.Add(HttpProfilingConstants.HttpPath, profilingContext.HttpPath);
            httProfilingTags.Add(HttpProfilingConstants.HttpPort, profilingContext.HttpPort);
            httProfilingTags.Add(HttpProfilingConstants.HttpProtocol, profilingContext.HttpProtocol);
            httProfilingTags.Add(HttpProfilingConstants.HttpScheme, profilingContext.HttpScheme);
            httProfilingTags.Add(HttpProfilingConstants.StatusCode, profilingContext.StatusCode);
            httProfilingTags.Add(HttpProfilingConstants.IdentityAuthenticationType, profilingContext.IdentityAuthenticationType);
            httProfilingTags.Add(HttpProfilingConstants.IdentityName, profilingContext.IdentityName);
            httProfilingTags.Add(HttpProfilingConstants.RequestContentType, profilingContext.RequestContentType);
            httProfilingTags.Add(HttpProfilingConstants.ResponseContentType, profilingContext.ResponseContentType);
            var point = new Point(profilingContext.ProfilerName, httpProfilingFields, httProfilingTags);

            return(Task.FromResult(_collector.Push(new Payload(new Point[] { point }))));
        }