public AspNetCoreHostingObserver(IMetricsObserverOptions options, IStats stats, ILogger <AspNetCoreHostingObserver> logger)
            : base(OBSERVER_NAME, DIAGNOSTIC_NAME, options, stats, logger)
        {
            PathMatcher = new Regex(options.IngressIgnorePattern);

            _responseTimeMeasure = Meter.CreateDoubleMeasure("http.server.requests.seconds");
            _serverCountMeasure  = Meter.CreateInt64Counter("http.server.requests.count");

            /*
             * //var view = View.Create(
             * //        ViewName.Create("http.server.request.time"),
             * //        "Total request time",
             * //        responseTimeMeasure,
             * //        Distribution.Create(BucketBoundaries.Create(new List<double>() { 0.0, 1.0, 5.0, 10.0, 100.0 })),
             * //        new List<ITagKey>() { statusTagKey, exceptionTagKey, methodTagKey, uriTagKey });
             *
             * //ViewManager.RegisterView(view);
             *
             * //view = View.Create(
             * //        ViewName.Create("http.server.request.count"),
             * //        "Total request counts",
             * //        serverCountMeasure,
             * //        Sum.Create(),
             * //        new List<ITagKey>() { statusTagKey, exceptionTagKey, methodTagKey, uriTagKey });
             *
             * //ViewManager.RegisterView(view);
             */
        }
Exemplo n.º 2
0
        public HttpClientCoreObserver(IMetricsObserverOptions options, IStats stats, ILogger <HttpClientCoreObserver> logger)
            : base(OBSERVER_NAME, DIAGNOSTIC_NAME, options, stats, logger)
        {
            PathMatcher         = new Regex(options.EgressIgnorePattern);
            _clientTimeMeasure  = Meter.CreateDoubleMeasure("http.client.request.time");
            _clientCountMeasure = Meter.CreateInt64Measure("http.client.request.count");

            /* TODO: figureout bound instruments & view API
             * var view = View.Create(
             *      ViewName.Create("http.client.request.time"),
             *      "Total request time",
             *      clientTimeMeasure,
             *      Distribution.Create(BucketBoundaries.Create(new List<double>() { 0.0, 1.0, 5.0, 10.0, 100.0 })),
             *      new List<ITagKey>() { statusTagKey, uriTagKey, methodTagKey, clientTagKey });
             * ViewManager.RegisterView(view);
             *
             * view = View.Create(
             *  ViewName.Create("http.client.request.count"),
             *  "Total request counts",
             *  clientCountMeasure,
             *  Sum.Create(),
             *  new List<ITagKey>() { statusTagKey, uriTagKey, methodTagKey, clientTagKey });
             *
             * ViewManager.RegisterView(view);
             */
        }