Esempio n. 1
0
        public OpenTelemetryCollectorLogger(MeterFactory meterFactory, string metricsPrefix = "magiconion", string version = null, IEnumerable <KeyValuePair <string, string> > defaultLabels = null)
        {
            if (meterFactory == null)
            {
                throw new ArgumentNullException(nameof(meterFactory));
            }

            // configure defaultTags included as default tag
            this.defaultLabels = defaultLabels ?? Array.Empty <KeyValuePair <string, string> >();

            // todo: how to description?
            var meter = meterFactory.GetMeter("MagicOnion", version);

            // Service build time. ms
            buildServiceDefinitionMeasure = meter.CreateDoubleMeasure($"{metricsPrefix}_buildservicedefinition_duration_milliseconds"); // sum

            // Unary request count. num
            unaryRequestCounter = meter.CreateInt64Counter($"{metricsPrefix}_unary_requests_count");        // sum
            // Unary API request size. bytes
            unaryRequestSizeMeasure = meter.CreateInt64Measure($"{metricsPrefix}_unary_request_size");      // sum
            // Unary API response size. bytes
            unaryResponseSizeMeasure = meter.CreateInt64Measure($"{metricsPrefix}_unary_response_size");    // sum
            // Unary API error Count. num
            unaryErrorCounter = meter.CreateInt64Counter($"{metricsPrefix}_unary_error_count");             // sum
            // Unary API elapsed time. ms
            unaryElapsedMeasure = meter.CreateDoubleMeasure($"{metricsPrefix}_unary_elapsed_milliseconds"); // sum

            // StreamingHub error Count. num
            streamingHubErrorCounter = meter.CreateInt64Counter($"{metricsPrefix}_streaminghub_error_count");             // sum
            // StreamingHub elapsed time. ms
            streamingHubElapsedMeasure = meter.CreateDoubleMeasure($"{metricsPrefix}_streaminghub_elapsed_milliseconds"); // sum
            // StreamingHub request count. num
            streamingHubRequestCounter = meter.CreateInt64Counter($"{metricsPrefix}_streaminghub_requests_count");        // sum
            // StreamingHub request size. bytes
            streamingHubRequestSizeMeasure = meter.CreateInt64Measure($"{metricsPrefix}_streaminghub_request_size");      // sum
            // StreamingHub response size. bytes
            streamingHubResponseSizeMeasure = meter.CreateInt64Measure($"{metricsPrefix}_streaminghub_response_size");    // sum
            // ConnectCount - DisconnectCount = current connect count. (successfully disconnected)
            // StreamingHub connect count. num
            streamingHubConnectCounter = meter.CreateInt64Counter($"{metricsPrefix}_streaminghub_connect_count");       // sum
            // StreamingHub disconnect count. num
            streamingHubDisconnectCounter = meter.CreateInt64Counter($"{metricsPrefix}_streaminghub_disconnect_count"); // sum

            // HubBroadcast request count. num
            broadcastRequestCounter = meter.CreateInt64Counter($"{metricsPrefix}_broadcast_requests_count");   // sum
            // HubBroadcast request size. num
            broadcastRequestSizeMeasure = meter.CreateInt64Measure($"{metricsPrefix}_broadcast_request_size"); // sum
            // HubBroadcast group count. num
            broadcastGroupCounter = meter.CreateInt64Counter($"{metricsPrefix}_broadcast_group_count");        // sum
        }
        public OpenTelemetryCollectorLogger(MeterFactory meterFactory, string version = null, IEnumerable <KeyValuePair <string, string> > defaultLabels = null)
        {
            if (meterFactory == null)
            {
                throw new ArgumentNullException(nameof(meterFactory));
            }

            // configure defaultTags included as default tag
            this.defaultLabels = defaultLabels ?? Array.Empty <KeyValuePair <string, string> >();

            // todo: how to description?
            var meter = meterFactory.GetMeter("MagicOnion", version);

            // Service build time. ms
            buildServiceDefinitionMeasure = meter.CreateDoubleMeasure("MagicOnion/measure/BuildServiceDefinition");    // sum
            // Unary request count. num
            unaryRequestCounter = meter.CreateInt64Counter("MagicOnion/measure/UnaryRequest");                         // sum
            // Unary API response size. bytes
            unaryResponseSizeMeasure = meter.CreateInt64Measure("MagicOnion/measure/UnaryResponseSize");               // sum
            // Unary API error Count. num
            unaryErrorCounter = meter.CreateInt64Counter("MagicOnion/measure/UnaryErrorCount");                        // sum
            // Unary API elapsed time. ms
            unaryElapsedMeasure = meter.CreateDoubleMeasure("MagicOnion/measure/UnaryElapsed");                        // sum
            // StreamingHub API error Count. num
            streamingHubErrorCounter = meter.CreateInt64Counter("MagicOnion/measure/StreamingHubErrorCount");          // sum
            // StreamingHub API elapsed time. ms
            streamingHubElapsedMeasure = meter.CreateDoubleMeasure("MagicOnion/measure/StreamingHubElapsed");          // sum
            // StreamingHub request count. num
            streamingHubRequestCounter = meter.CreateInt64Counter("MagicOnion/measure/StreamingHubRequest");           // sum
            // StreamingHub API response size. bytes
            streamingHubResponseSizeMeasure = meter.CreateInt64Measure("MagicOnion/measure/StreamingHubResponseSize"); // sum
            // ConnectCount - DisconnectCount = current connect count. (successfully disconnected)
            // StreamingHub connect count. num
            streamingHubConnectCounter = meter.CreateInt64Counter("MagicOnion/measure/StreamingHubConnect");       // sum
            // StreamingHub disconnect count. num
            streamingHubDisconnectCounter = meter.CreateInt64Counter("MagicOnion/measure/StreamingHubDisconnect"); // sum
        }
Esempio n. 3
0
 void IAppMetrics.Initialize(MeterFactory meterFactory)
 {
     this.meter = meterFactory.GetMeter("Sample App");
     this.openTelemetryProcessedItemCounter       = meter.CreateInt64Counter("Processed Item");
     this.openTelemetryProcessedFailedItemCounter = meter.CreateInt64Counter("Processed Failed Item");
 }
Esempio n. 4
0
 void IAppMetrics.Initialize(MeterFactory meterFactory)
 {
     this.meter = meterFactory.GetMeter("Sample App");
     this.openTelemetryItemEnqueuedCounter = meter.CreateInt64Counter("Enqueued Item");
 }