Пример #1
0
        static void ConfigureMetrics(string serviceName, Action <PrometheusMetricsOptions> configure)
        {
            var options = PrometheusMetricsOptions.Default;

            configure?.Invoke(options);

            PrometheusMetrics.TryConfigure(GetServiceName(serviceName), options);
        }
Пример #2
0
        public static void ConnectMetrics(this IBusControl busControl, string serviceName = "")
        {
            PrometheusMetrics.TryConfigure(
                string.IsNullOrWhiteSpace(serviceName)
                    ? Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName)
                    : serviceName);

            busControl.ConnectReceiveObserver(new PrometheusMetricsObservers(serviceName));
        }
Пример #3
0
        public static void UsePrometheusMetrics <T>(this IPipeConfigurator <T> configurator,
                                                    string serviceName = null)
            where T : class, ConsumeContext
        {
            PrometheusMetrics.TryConfigure(
                string.IsNullOrWhiteSpace(serviceName)
                    ? Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName)
                    : serviceName);

            configurator.AddPipeSpecification(new PrometheusSpecification <T>());
        }
Пример #4
0
 public PrometheusMetricsObservers(string serviceName)
 {
     PrometheusMetrics.TryConfigure(serviceName);
 }