public HangfireMetric(HangfireMetricOptions options)
        {
            // Validate TelemtryClient
            if (options.TelemetryClient == null)
            {
                throw new ArgumentNullException(nameof(options.TelemetryClient));
            }

            _telemetryClient = options.TelemetryClient;

            // Validate TelemtryClient
            if (options.HangfireMonitoringApi == null)
            {
                throw new ArgumentNullException(nameof(options.HangfireMonitoringApi));
            }

            _hangfireApi = options.HangfireMonitoringApi;

            // Set metric prefix
            _metricPrefix = options.MetricPrefix;

            if (string.IsNullOrWhiteSpace(_metricPrefix))
            {
                _metricPrefix = "hangfire";
            }

            // Set push interval
            PushInterval = options.PushInterval;

            if (PushInterval == null)
            {
                PushInterval = new TimeSpan(0, 1, 0);
            }

            Task.Run(MetricLoopAsync);
        }
 public static HangfireMetric Use(HangfireMetricOptions options)
 {
     return(new HangfireMetric(options));
 }