コード例 #1
0
        protected GrpcRequestMiddlewareBase(GrpcMetricsOptionsBase?options, TCollector?customMetric)
        {
            MetricFactory = Metrics.WithCustomRegistry(options?.Registry ?? Metrics.DefaultRegistry);

            if (customMetric != null)
            {
                _metric = customMetric;
                ValidateNoUnexpectedLabelNames();
            }
            else
            {
                _metric = CreateMetricInstance(DefaultLabels);
            }
        }
コード例 #2
0
ファイル: MetricFactory.cs プロジェクト: HammerAlf/Runtime
 /// <summary>
 /// Initializes a new instance of the <see cref="MetricFactory"/> class.
 /// </summary>
 /// <param name="innerMetricFactory">The inner <see cref="Prometheus.MetricFactory"/> for Prometheus.</param>
 public MetricFactory(Prometheus.MetricFactory innerMetricFactory)
 {
     _innerMetricFactory = innerMetricFactory;
 }
コード例 #3
0
 protected override ICollector <ICounter> CreateMetricInstance(string[] labelNames) => MetricFactory.CreateCounter(
     "grpc_requests_received_total",
     "Number of gRPC requests received (including those currently being processed).",
     new CounterConfiguration
 {
     LabelNames = labelNames
 });