public ImageMetrics(IMetrics metrics)
 {
     ProcessedImagesCounter = metrics.Counter()
                              .Name("processed_images_total")
                              .Help("Total number of processed images.")
                              .Register();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RollbackMessageDecorator" /> class.
 /// </summary>
 /// <param name="metrics">The metrics factory.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public RollbackMessageDecorator(IMetrics metrics,
     IRollbackMessage handler,
     IConnectionInformation connectionInformation)
 {
     var name = handler.GetType().Name;
     _rollbackCounter = metrics.Counter($"{connectionInformation.QueueName}.{name}.RollbackCounter", Units.Items);
     _handler = handler;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SmartThreadPoolTaskScheduler"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="waitForFreeThread">The wait for free thread.</param>
        /// <param name="metrics">the metrics factory</param>
        public SmartThreadPoolTaskScheduler(ITaskSchedulerConfiguration configuration, 
            IWaitForEventOrCancelThreadPool waitForFreeThread,
            IMetrics metrics)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => waitForFreeThread, waitForFreeThread);
            Guard.NotNull(() => metrics, metrics);

            _configuration = configuration;
            _waitForFreeThread = waitForFreeThread;
            _metrics = metrics;
            _groups = new ConcurrentDictionary<IWorkGroup, WorkGroupWithItem>();
            _clients = new ConcurrentDictionary<int, int>();

            var name = GetType().Name;
            _taskCounter = metrics.Counter($"{name}.TaskCounter", Units.Items);
            _clientCounter = metrics.Counter($"{name}.ClientCounter", Units.Items);
        }
        public async Task InvokeAsync(HttpContext context, RequestDelegate next)
        {
            await next(context).ConfigureAwait(false);

            if (!context.Response.IsSuccessfulResponse())
            {
                await _metrics.Counter($"request-error-{context.Response.StatusCode}", 1, context.RequestAborted).ConfigureAwait(false);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueCreationDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public CommitMessageDecorator(IMetrics metrics,
                                      ICommitMessage handler,
                                      IConnectionInformation connectionInformation)
        {
            var name = "CommitMessage";

            _commitCounter = metrics.Counter($"{connectionInformation.QueueName}.{name}.CommitCounter", Units.Items);
            _handler       = handler;
        }
        /// <summary>Initializes a new instance of the <see cref="LinqCompileCacheDecorator"/> class.</summary>
        /// <param name="handler">The handler.</param>
        /// <param name="cacheProvider"></param>
        /// <param name="cachePolicy">The cache policy.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public LinqCompileCacheDecorator(
            ILinqCompiler handler,
            MemoryCacheProvider cacheProvider,
            ICachePolicy <ILinqCompiler> cachePolicy,
            IMetrics metrics,
            IConnectionInformation connectionInformation)
        {
            _handler      = handler;
            _cacheActions = Policy.Cache <Action <object, object> >(cacheProvider, new SlidingTtl(cachePolicy.SlidingExpiration)
                                                                    , OnCacheGetAction, OnCacheMissAction, (context, s) => { }, (context, s, arg3) => { },
                                                                    (context, s, arg3) => { });

            var name = handler.GetType().Name;

            _counterActionCacheHit    = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items);
            _counterActionCacheMiss   = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items);
            _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RollbackMessageDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public RollbackMessageDecorator(IMetrics metrics,
                                        IRollbackMessage handler,
                                        IConnectionInformation connectionInformation)
        {
            var name = "RollbackMessage";

            _rollbackCounter = metrics.Counter($"{connectionInformation.QueueName}.{name}.RollbackCounter", Units.Items);
            _handler         = handler;
        }
Exemple #8
0
        public MetricsContainer(IMetrics metrics)
        {
            this._metrics = metrics;
            var bms = metrics.Gauge()
                      .Name("bms_active_transactions")
                      .Help("The number of currently running requests.")
                      .LabelNames("operation_id")
                      .Register();

            this.AddGauge("bms_active_transactions", bms);

            var inq = metrics.Gauge()
                      .Name("bms_in_queue")
                      .Help("The number requests currently queuing.")
                      .LabelNames("ok")
                      .Register();

            this.AddGauge("bms_in_queue", inq);

            var exec = metrics.Gauge()
                       .Name("bms_exec")
                       .Help("The number currently executing requests.")
                       .LabelNames("ok")
                       .Register();

            this.AddGauge("bms_exec", exec);

            var vio = metrics.Counter()
                      .Name("bms_business_violation_total")
                      .Help("The number of business violations")
                      .LabelNames("operation_id")
                      .Register();

            this.AddCounter("bms_business_violation_total", vio);

            var total = metrics.Counter()
                        .Name("bms_requests_served")
                        .Help("The number of requests served")
                        .LabelNames("operation_id")
                        .Register();

            this.AddCounter("bms_requests_served", total);
        }
Exemple #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IClearExpiredMessages" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ClearErrorMessagesDecorator(IMetrics metrics,
                                           IClearErrorMessages handler,
                                           IConnectionInformation connectionInformation)
        {
            var name = "ClearErrorMessages";

            _timer   = metrics.Timer($"{connectionInformation.QueueName}.{name}.ResetTimer", Units.Calls);
            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.ResetCounter", Units.Items);
            _handler = handler;
        }
Exemple #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IClearExpiredMessages" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ClearExpiredMessagesDecorator(IMetrics metrics,
                                             IClearExpiredMessages handler,
                                             IConnectionInformation connectionInformation)
        {
            var name = handler.GetType().Name;

            _timer   = metrics.Timer($"{connectionInformation.QueueName}.{name}.ClearMessages.ResetTimer", Units.Calls);
            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.ClearMessages.ResetCounter", Units.Items);
            _handler = handler;
        }
Exemple #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SmartThreadPoolTaskScheduler"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="waitForFreeThread">The wait for free thread.</param>
        /// <param name="metrics">the metrics factory</param>
        public SmartThreadPoolTaskScheduler(ITaskSchedulerConfiguration configuration,
                                            IWaitForEventOrCancelThreadPool waitForFreeThread,
                                            IMetrics metrics)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => waitForFreeThread, waitForFreeThread);
            Guard.NotNull(() => metrics, metrics);

            _configuration     = configuration;
            _waitForFreeThread = waitForFreeThread;
            _metrics           = metrics;
            _groups            = new ConcurrentDictionary <IWorkGroup, WorkGroupWithItem>();
            _clients           = new ConcurrentDictionary <int, int>();

            var name = GetType().Name;

            _taskCounter   = metrics.Counter($"{name}.TaskCounter", Units.Items);
            _clientCounter = metrics.Counter($"{name}.ClientCounter", Units.Items);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueCreationDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ResetHeartBeatDecorator(IMetrics metrics,
                                       IResetHeartBeat handler,
                                       IConnectionInformation connectionInformation)
        {
            var name = handler.GetType().Name;

            _timer   = metrics.Timer($"{connectionInformation.QueueName}.{name}.ResetTimer", Units.Calls);
            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.ResetCounter", Units.Items);
            _handler = handler;
        }
 public DummyMetrics(IMetrics metrics)
 {
     _runs = metrics.Counter()
             .Name("myservice_dummy_runs")
             .Help("Number of times the dummy worker ran")
             .Register();
     _runDurations = metrics.Histogram()
                     .Name("myservice_dummy_duration_seconds")
                     .Help("Average duration of a dummy worker run")
                     .Register();
 }
 public ServiceInstanceMetrics(IMetrics metrics)
 {
     _provisioned =
         metrics.Counter()
         .Name("myvendor_servicebroker_serviceinstances_provisioned")
         .Help("The number of service instances that were provisioned.")
         .LabelNames("serviceId")
         .Register();
     _updated =
         metrics.Counter()
         .Name("myvendor_servicebroker_serviceinstances_updated")
         .Help("The number of service instances that were updated.")
         .LabelNames("serviceId")
         .Register();
     _deprovisioned =
         metrics.Counter()
         .Name("myvendor_servicebroker_serviceinstances_deprovisioned")
         .Help("The number of service instances that were deprovisioned.")
         .Register();
 }
Exemple #15
0
 public ContactMetrics(IMetrics metrics)
 {
     _writeDurations = metrics.Histogram()
                       .Name("myservice_contact_write_duration_seconds")
                       .Help("Average duration of persistence write operations for contacts")
                       .Register();
     _pokes = metrics.Counter()
              .Name("myservice_contact_pokes_total")
              .Help("Number of times contacts were poked")
              .Register();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SchedulerMessageHandler"/> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="metrics">metrics factory</param>
        public SchedulerMessageHandler(ILogFactory log,
                                       IMetrics metrics)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => metrics, metrics);

            _log = log.Create();

            var name = GetType().Name;

            _waitingOnFreeThreadCounter = metrics.Counter($"{name}.WaitingOnTaskCounter", Units.Items);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessageQueryDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ReceiveMessageQueryDecorator(IMetrics metrics,
                                            IQueryHandler <ReceiveMessageQuery, RedisMessage> handler,
                                            IConnectionInformation connectionInformation)
        {
            Guard.NotNull(() => metrics, metrics);
            Guard.NotNull(() => handler, handler);

            var name = handler.GetType().Name;

            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.HandleAsync.Expired", Units.Items);
            _handler = handler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DelayedProcessingActionDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public DelayedProcessingActionDecorator(IMetrics metrics,
            IDelayedProcessingAction handler,
            IConnectionInformation connectionInformation)
        {
            Guard.NotNull(() => metrics, metrics);
            Guard.NotNull(() => handler, handler);

            var name = handler.GetType().Name;
            _timer = metrics.Timer($"{connectionInformation.QueueName}.{name}.RunTimer", Units.Calls);
            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.RunCounter", Units.Items);
            _handler = handler;
        }
Exemple #19
0
        internal static void TryConfigure(IMetrics metrics, string serviceName)
        {
            if (_isConfigured)
            {
                return;
            }

            var bounds = new[] { 0, .005, .01, .025, .05, .075, .1, .25, .5, .75, 1, 2.5, 5, 7.5, 10, 30, 60, 120, 180, 240, 300 };

            _serviceName = serviceName;

            _consumerTimer = metrics.Histogram()
                             .Buckets(bounds)
                             .Name("app_message_processing_time_seconds")
                             .Help("The time to consume a message, in seconds.")
                             .LabelNames("service_name", "message_type")
                             .Register();

            _criticalTimer = metrics.Histogram()
                             .Buckets(bounds)
                             .Name("app_message_critical_time_seconds")
                             .Help("The time between when message is sent and when it is consumed, in seconds.")
                             .LabelNames("service_name", "message_type")
                             .Register();

            _messageCounter = metrics.Counter()
                              .Name("app_message_count")
                              .Help("The number of messages received.")
                              .LabelNames("service_name", "message_type")
                              .Register();

            _errorCounter = metrics.Counter()
                            .Name("app_message_failures_count")
                            .Help("The number of message processing failures.")
                            .LabelNames("service_name", "message_type")
                            .Register();

            _isConfigured = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DelayedProcessingActionDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public DelayedProcessingActionDecorator(IMetrics metrics,
                                                IDelayedProcessingAction handler,
                                                IConnectionInformation connectionInformation)
        {
            Guard.NotNull(() => metrics, metrics);
            Guard.NotNull(() => handler, handler);

            var name = handler.GetType().Name;

            _timer   = metrics.Timer($"{connectionInformation.QueueName}.{name}.RunTimer", Units.Calls);
            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.RunCounter", Units.Items);
            _handler = handler;
        }
Exemple #21
0
        public HttpMetrics(IMetrics m)
        {
            HttpRequestsTotal = m.Counter()
                                .Name("http_requests_total")
                                .Help("The total count of http requests")
                                .LabelNames("method", "handler", "code")
                                .Register();

            HttpRequestDurationSeconds = m.Histogram()
                                         .Name("http_request_duration_seconds")
                                         .Buckets(0, .005, .01, .025, .05, .075, .1, .25, .5, .75, 1, 2.5, 5, 7.5, 10, 30, 60, 120, 180, 240, 300)
                                         .Help("Total duration of http request")
                                         .LabelNames("method", "handler", "code")
                                         .Register();
        }
Exemple #22
0
        public async ValueTask Publish <TEvent>(TEvent @event, CancellationToken cancellationToken = default) where TEvent : IEvent
        {
            await _metrics.Counter(@event, cancellationToken).ConfigureAwait(false);

            var handlers = _resolver.ResolveAll <IEventHandler <TEvent> >();

            foreach (var handler in handlers)
            {
                await handler.Handle(@event).ConfigureAwait(false);
            }

            if (@event is IBusMessage message)
            {
                await _bus.Publish(@event, cancellationToken).ConfigureAwait(false);
            }
        }
Exemple #23
0
        /// <summary>
        /// Adds a new work group.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="concurrencyLevel">The concurrency level.</param>
        /// <param name="maxQueueSize">Maximum size of the queue. Work groups have a queue that is separate per queue, and is not shared with non work group items</param>
        /// <returns></returns>
        /// <exception cref="DotNetWorkQueueException">Start must be called on the scheduler before adding work groups</exception>
        public override IWorkGroup AddWorkGroup(string name, int concurrencyLevel, int maxQueueSize)
        {
            ThrowIfDisposed();

            var group = new WorkGroup(name, concurrencyLevel, maxQueueSize);

            if (_groups.ContainsKey(group))
            {
                return(_groups[group].GroupInfo);
            }

            var groupWithItem = new WorkGroupWithItem(group, _metrics.Counter(
                                                          $"work group {name}", Units.Items));

            _groups.TryAdd(group, groupWithItem);
            return(groupWithItem.GroupInfo);
        }
Exemple #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LinqCompileCacheDecorator" /> class.
        /// </summary>
        /// <param name="handler">The handler.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="cachePolicy">The cache policy.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public LinqCompileCacheDecorator(
            ILinqCompiler handler,
            ICacheManager <object> cache,
            ICachePolicy <ILinqCompiler> cachePolicy,
            IMetrics metrics,
            IConnectionInformation connectionInformation)
        {
            _handler    = handler;
            _cache      = cache;
            _itemPolicy = cachePolicy;
            var name = handler.GetType().Name;

            _counterActionCacheHit    = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items);
            _counterActionCacheMiss   = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items);
            _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items);

            _counterFunctionCacheHit    = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheHitCounter", Units.Items);
            _counterFunctionCacheMiss   = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheMissCounter", Units.Items);
            _counterFunctionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionUniqueFlaggedCounter", Units.Items);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LinqCompileCacheDecorator" /> class.
        /// </summary>
        /// <param name="handler">The handler.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="cachePolicy">The cache policy.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public LinqCompileCacheDecorator(
            ILinqCompiler handler,
            ObjectCache cache,
            ICachePolicy<ILinqCompiler> cachePolicy,
            IMetrics metrics,
             IConnectionInformation connectionInformation)
        {
            _handler = handler;
            _cache = cache;
            _itemPolicy = new CacheItemPolicy {SlidingExpiration = cachePolicy.SlidingExpiration};
            var name = handler.GetType().Name;

            _counterActionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items);
            _counterActionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items);
            _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items);

            _counterFunctionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheHiCountert", Units.Items);
            _counterFunctionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheMissCounter", Units.Items);
            _counterFunctionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionUniqueFlaggedCounter", Units.Items);

        }
 public static void Increment(this IMetrics metrics, string statName, double sampleRate = 1, params StatTag[] tags)
 => metrics.Counter(statName, 1, sampleRate, tags);
Exemple #27
0
        /// <summary>
        /// Adds a new work group.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="concurrencyLevel">The concurrency level.</param>
        /// <param name="maxQueueSize">Maximum size of the queue. Work groups have a queue that is separate per queue, and is not shared with non work group items</param>
        /// <returns></returns>
        /// <exception cref="DotNetWorkQueueException">Start must be called on the scheduler before adding work groups</exception>
        public override IWorkGroup AddWorkGroup(string name, int concurrencyLevel, int maxQueueSize)
        {
            ThrowIfDisposed();

            if (_smartThreadPool == null)
            {
                throw new DotNetWorkQueueException("Start must be called on the scheduler before adding work groups");
            }

            var group = new WorkGroup(name, concurrencyLevel, maxQueueSize);

            if (_groups.ContainsKey(group))
            {
                return(_groups[group].GroupInfo);
            }

            var groupWithItem = new WorkGroupWithItem(group, Policy.Bulkhead(concurrencyLevel, maxQueueSize, OnBulkheadRejected), _metrics.Counter(
                                                          $"work group {name}", Units.Items));

            _groups.TryAdd(group, groupWithItem);
            return(groupWithItem.GroupInfo);
        }
        private void Register(IMetrics metrics)
        {
            GcCollectionCount = metrics.Gauge()
                                .Name("coreclr_gc_collection_count")
                                .Help("The number of times a collection has occured in the given generation")
                                .LabelNames("generation")
                                .Register();

            NonpagedSystemMemorySize = metrics.Gauge()
                                       .Name("coreclr_process_nonpaged_system_memory_size_bytes")
                                       .Help("Pool Nonpaged Bytes")
                                       .Register();

            PagedMemorySize = metrics.Gauge()
                              .Name("coreclr_process_paged_memory_size_bytes")
                              .Help("Page File Bytes")
                              .Register();

            PagedSystemMemorySize = metrics.Gauge()
                                    .Name("coreclr_process_paged_system_memory_size_bytes")
                                    .Help("Pool Paged Bytes")
                                    .Register();

            PeakPagedMemorySize = metrics.Gauge()
                                  .Name("coreclr_process_peak_paged_memory_size_bytes")
                                  .Help("Page File Bytes Peak")
                                  .Register();

            PeakVirtualMemorySize = metrics.Gauge()
                                    .Name("coreclr_process_peak_virtual_memory_size_bytes")
                                    .Help("Virtual Bytes Peak")
                                    .Register();

            PeakWorkingSet = metrics.Gauge()
                             .Name("coreclr_process_peak_working_set_bytes")
                             .Help("Working Set Peak")
                             .Register();

            PrivateMemorySize = metrics.Gauge()
                                .Name("coreclr_process_private_memory_size_bytes")
                                .Help("Private Bytes")
                                .Register();

            VirtualMemorySize = metrics.Gauge()
                                .Name("coreclr_process_virtual_size_bytes")
                                .Help("Virtual Bytes")
                                .Register();

            WorkingSet = metrics.Gauge()
                         .Name("coreclr_working_set_bytes")
                         .Help("Working Set")
                         .Register();

            ThreadCount = metrics.Gauge()
                          .Name("coreclr_process_thread_count")
                          .Help("The number of threads in the .NET process")
                          .Register();

            UserProcessorTime = metrics.Gauge()
                                .Name("coreclr_process_user_processor_time_seconds")
                                .Help("The user processor time for this process")
                                .Register();

            PrivilegedProcessorTime = metrics.Gauge()
                                      .Name("coreclr_process_privileged_processor_time_seconds")
                                      .Help("The privileged processor time for this process")
                                      .Register();

            TotalProcessorTime = metrics.Gauge()
                                 .Name("coreclr_process_total_processor_time_seconds")
                                 .Help("The total processor time for this process")
                                 .Register();

            ProcessCpuSecondsTotal = metrics.Counter()
                                     .Name("process_cpu_seconds_total")
                                     .Help("Total user and system CPU time spent in seconds")
                                     .Register();

            ProcessOpenFds = metrics.Gauge()
                             .Name("process_open_fds")
                             .Help("Number of open file descriptors")
                             .Register();

            ProcessMaxFds = metrics.Gauge()
                            .Name("process_max_fds")
                            .Help("Number of open file descriptors")
                            .Register();

            ProcessVirtualMemoryBytes = metrics.Gauge()
                                        .Name("process_virtual_memory_bytes")
                                        .Help("Virtual memory size in bytes")
                                        .Register();

            ProcessResidentMemoryBytes = metrics.Gauge()
                                         .Name("process_resident_memory_bytes")
                                         .Help("Resident memory size in bytes")
                                         .Register();

            ProcessHeapBytes = metrics.Gauge()
                               .Name("process_resident_heap_bytes")
                               .Help("Process heap size in bytes")
                               .Register();

            ProcessStartTimeSeconds = metrics.Gauge()
                                      .Name("process_start_time_seconds")
                                      .Help("Start time of the process since unix epoch in seconds")
                                      .Register();
        }