Exemplo n.º 1
0
        public SetMeterSample(IMetrics metrics)
        {
            _metrics = metrics;

            _errorMeter   = _metrics.Provider.Meter.Instance(SampleMetricsRegistry.Meters.Errors);
            _commandMeter = _metrics.Provider.Meter.Instance(SampleMetricsRegistry.Meters.CommandMeter);
        }
Exemplo n.º 2
0
 public MergeList(IMeter meter = default, UInt32 insertionLimit = INSERTION_LIMIT_DEFAULT, Int32 merges = MERGES_DEFAULT)
 {
     this.Meter           = meter;
     this.InsertionLimit  = insertionLimit;
     this.Merges          = merges;
     this.InsertionSorter = new InsertionList <T>(Meter);
 }
Exemplo n.º 3
0
 public BucketFactory(
     ClusterContext clusterContext,
     IScopeFactory scopeFactory,
     IRetryOrchestrator retryOrchestrator,
     IVBucketKeyMapperFactory vBucketKeyMapperFactory,
     IKetamaKeyMapperFactory ketamaKeyMapperFactory,
     ILogger <CouchbaseBucket> couchbaseLogger,
     ILogger <MemcachedBucket> memcachedLogger,
     IRedactor redactor,
     IBootstrapperFactory bootstrapperFactory,
     IRequestTracer tracer,
     IOperationConfigurator operationConfigurator,
     IRetryStrategy retryStrategy,
     IMeter meter
     )
 {
     _clusterContext          = clusterContext ?? throw new ArgumentNullException(nameof(clusterContext));
     _scopeFactory            = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _retryOrchestrator       = retryOrchestrator ?? throw new ArgumentNullException(nameof(retryOrchestrator));
     _vBucketKeyMapperFactory = vBucketKeyMapperFactory ?? throw new ArgumentNullException(nameof(vBucketKeyMapperFactory));
     _ketamaKeyMapperFactory  = ketamaKeyMapperFactory ?? throw new ArgumentNullException(nameof(ketamaKeyMapperFactory));
     _couchbaseLogger         = couchbaseLogger ?? throw new ArgumentNullException(nameof(couchbaseLogger));
     _memcachedLogger         = memcachedLogger ?? throw new ArgumentNullException(nameof(memcachedLogger));
     _redactor            = redactor ?? throw new ArgumentNullException(nameof(IRedactor));
     _bootstrapperFactory = bootstrapperFactory ?? throw new ArgumentNullException(nameof(bootstrapperFactory));
     _tracer = tracer ?? throw new ArgumentNullException(nameof(tracer));
     _operationConfigurator = operationConfigurator ?? throw new ArgumentNullException(nameof(operationConfigurator));
     _retryStrategy         = retryStrategy ?? throw new ArgumentNullException(nameof(retryStrategy));
     _meter = meter;
 }
Exemplo n.º 4
0
        public SetMeterSample(IMetrics metrics)
        {
            _metrics = metrics;

            _errorMeter   = _metrics.Advanced.Meter(SampleMetricsRegistry.Meters.Errors);
            _commandMeter = _metrics.Advanced.Meter(SampleMetricsRegistry.Meters.CommandMeter);
        }
Exemplo n.º 5
0
 public ProducerTopicMetrics(ClientIdAndTopic metricId)
 {
     this.MessageRate = MetersFactory.NewMeter(metricId + "MessagesPerSec", "messages", TimeSpan.FromSeconds(1));
     this.ByteRate = MetersFactory.NewMeter(metricId + "BytesPerSec", "bytes", TimeSpan.FromSeconds(1));
     this.DroppedMessageRate = MetersFactory.NewMeter(
         metricId + "DroppedMessagesPerSec", "drops", TimeSpan.FromSeconds(1));
 }
Exemplo n.º 6
0
        public void DrawMeter(IMeter meter, SpriteBatch spritebatch, Rectangle rect, float start, float end, Vector2 scale, Vector2 offset, Color color)
        {
            if (start == end)
            {
                return;
            }

            _effectsParams["BorderTexture"].SetValue(meter.BorderImage);
            _effectsParams["AlphaMaskTexture"].SetValue(meter.AlphaMaskImage);
            _effectsParams["Start"].SetValue(start);
            _effectsParams["End"].SetValue(end);
            _effectsParams["HasBorder"].SetValue(false);

            //update the position by adding the scale and offset
            var scaleOffset = new Vector2(((rect.Width - (rect.Width * scale.X)) * .5f),
                                          ((rect.Height - (rect.Height * scale.Y)) * .5f));

            rect.X      = (int)(scaleOffset.X + (rect.X + offset.X));
            rect.Y      = (int)(scaleOffset.Y + (rect.Y + offset.Y));
            rect.Width  = (int)(rect.Width * scale.X);
            rect.Height = (int)(rect.Height * scale.Y);

            //set the color alpha before we render
            var color4 = color.ToVector4();

            color.A = (byte)(255f * (Alpha * color4.W));

            spritebatch.Draw(meter.MeterImage, rect, null, color, 0f, Vector2.Zero, SpriteEffects.None, 0f);
        }
Exemplo n.º 7
0
        void bgw_DoWork(object sender, DoWorkEventArgs e)
        {
            if (Meter != null && (!Meter.Port.IsOpen || Meter.Port.PortName != ((string[])e.Argument)[0]))
            {
                Meter.Dispose();
                Meter = null;
                System.Threading.Thread.Sleep(2500);
            }

            Meter = (IMeter)Activator.CreateInstance(Type.GetType("GlucaTrack.Communication.Meters." + ((string[])e.Argument)[1] + ", GlucaTrack.Communication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"));
            Meter.ReadFinished += new EventHandler(OnReadFinished);
            Meter.RecordRead   += new EventHandler(OnRecordRead);
            Meter.HeaderRead   += new EventHandler(OnHeaderRead);

            Console.WriteLine("Connecting to " + ((string[])e.Argument)[0]);

            if (!Meter.Port.IsOpen)
            {
                Meter.Connect(((string[])e.Argument)[0]);
            }

            if (Meter.IsMeterConnected(((string[])e.Argument)[0]))
            {
                if (!Meter.Port.IsOpen)
                {
                    Meter.Connect(((string[])e.Argument)[0]);
                }

                Meter.Port.DiscardInBuffer();
                Meter.Port.DiscardOutBuffer();
                Meter.ReadData();
            }
        }
        internal CouchbaseBucket(string name, ClusterContext context, IScopeFactory scopeFactory, IRetryOrchestrator retryOrchestrator,
                                 IVBucketKeyMapperFactory vBucketKeyMapperFactory, ILogger <CouchbaseBucket> logger, IRedactor redactor, IBootstrapperFactory bootstrapperFactory,
                                 IRequestTracer tracer, IOperationConfigurator operationConfigurator, IRetryStrategy retryStrategy, IMeter meter)
            : base(name, context, scopeFactory, retryOrchestrator, logger, redactor, bootstrapperFactory, tracer, operationConfigurator, retryStrategy)
        {
            _vBucketKeyMapperFactory = vBucketKeyMapperFactory ?? throw new ArgumentNullException(nameof(vBucketKeyMapperFactory));
            _meter = meter;

            _viewClientLazy = new Lazy <IViewClient>(() =>
                                                     context.ServiceProvider.GetRequiredService <IViewClient>()
                                                     );
            _viewManagerLazy = new Lazy <IViewIndexManager>(() =>
                                                            new ViewIndexManager(name,
                                                                                 context.ServiceProvider.GetRequiredService <IServiceUriProvider>(),
                                                                                 context.ServiceProvider.GetRequiredService <CouchbaseHttpClient>(),
                                                                                 context.ServiceProvider.GetRequiredService <ILogger <ViewIndexManager> >(),
                                                                                 redactor));

            _collectionManagerLazy = new Lazy <ICouchbaseCollectionManager>(() =>
                                                                            new CollectionManager(name,
                                                                                                  context.ServiceProvider.GetRequiredService <IServiceUriProvider>(),
                                                                                                  context.ServiceProvider.GetRequiredService <CouchbaseHttpClient>(),
                                                                                                  context.ServiceProvider.GetRequiredService <ILogger <CollectionManager> >(),
                                                                                                  redactor)
                                                                            );
        }
Exemplo n.º 9
0
        private void applyDriver()
        {
            int idxDriver = cbDriverName.SelectedIndex;

            if (idxDriver == -1)
            {
                DriverSelected = false;
                DriverInstanceReady?.Invoke(this, new DriverInstanceReadyArgs(null, null));
                return;
            }

            List <Type> driverTypesList = getDriverTypes();

            if (idxDriver >= driverTypesList.Count)
            {
                DriverSelected = false;
                DriverInstanceReady?.Invoke(this, new DriverInstanceReadyArgs(null, null));
                return;
            }

            _meterType = driverTypesList[idxDriver];
            _meterInterfaceInstance = (IMeter)Activator.CreateInstance(MeterType);
            DriverSelected          = true;

            DriverInstanceReady?.Invoke(this, new DriverInstanceReadyArgs(MeterInterfaceInstance, MeterType));
        }
Exemplo n.º 10
0
        private void CtlConnectionSettings1_SettingsApplied(object sender, PollingLibraries.LibPorts.EventArgsSettingsApplied e)
        {
            if (e.VPort == null)
            {
                ctlMeters1.Enabled = false;
                return;
            }

            // если компонент выбора драйвера включен, будем создавать объекты при помощи
            // рефлексии, иначе - задавая тип вручную.

            if (ctlSelectDriver1.Enabled)
            {
                IMeter iMeter = ctlSelectDriver1.MeterInterfaceInstance;
                ctlMeters1.Initialize(iMeter, e.VPort);
            }
            else
            {
                // объявляем тип вручную
                SET4tmDriver meter = new SET4tmDriver();
                ctlMeters1.Initialize(meter, e.VPort);
            }

            ctlMeters1.Enabled = true;
        }
 public MultiContextMetrics(IMetrics metrics)
 {
     _firstCounter  = metrics.Provider.Counter.Instance(SampleMetricsRegistry.Contexts.FirstContext.Counters.Counter);
     _secondCounter = metrics.Provider.Counter.Instance(
         SampleMetricsRegistry.Contexts.SecondContext.Counters.Counter);
     _secondMeter = metrics.Provider.Meter.Instance(SampleMetricsRegistry.Contexts.SecondContext.Meters.Requests);
 }
Exemplo n.º 12
0
 public ProducerTopicMetrics(ClientIdAndTopic metricId)
 {
     this.MessageRate        = MetersFactory.NewMeter(metricId + "MessagesPerSec", "messages", TimeSpan.FromSeconds(1));
     this.ByteRate           = MetersFactory.NewMeter(metricId + "BytesPerSec", "bytes", TimeSpan.FromSeconds(1));
     this.DroppedMessageRate = MetersFactory.NewMeter(
         metricId + "DroppedMessagesPerSec", "drops", TimeSpan.FromSeconds(1));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceivePoisonMessageDecorator" /> class.
 /// </summary>
 /// <param name="metrics">The metrics factory.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public ReceivePoisonMessageDecorator(IMetrics metrics,
     IReceivePoisonMessage handler,
     IConnectionInformation connectionInformation)
 {
     var name = handler.GetType().Name;
     _meterError = metrics.Meter($"{connectionInformation.QueueName}.{name}.PoisonHandleMeter", Units.Items);
     _handler = handler;
 }
Exemplo n.º 14
0
        public MeterWidget(IScreen screen, IMeter meter)
            : base(meter.Position.Width, meter.Position.Height)
        {
            _screen = screen;

            Meter = meter;
            SetMeterPosition(screen);
        }
Exemplo n.º 15
0
 public AppMetricsMeter(
     IMetrics metrics, IMeter meter, string bucket, string name)
 {
     _metrics = metrics;
     _meter   = meter;
     Context  = bucket;
     Name     = name;
 }
Exemplo n.º 16
0
        public void TimerProc()
        {
            string gatewayIP = InSnergyService.getGatewayIP(this.m_gatewayID);

            this.labDevIp.Text = gatewayIP;
            System.Collections.Generic.Dictionary <string, IMeter> branch = InSnergyService.GetBranch(this.m_gatewayID, this.m_branchID);
            foreach (DataGridViewRow dataGridViewRow in (System.Collections.IEnumerable) this.dgvSubMeters.Rows)
            {
                string key    = dataGridViewRow.Cells[11].Value.ToString();
                string value  = "";
                string value2 = "";
                string value3 = "";
                string value4 = "";
                string value5 = "";
                string value6 = "";
                if (branch.ContainsKey(key))
                {
                    IMeter meter = branch[key];
                    if (meter.listParam.ContainsKey(2))
                    {
                        double dvalue = meter.listParam[2].dvalue;
                        value = dvalue.ToString("F2");
                    }
                    if (meter.listParam.ContainsKey(1))
                    {
                        double dvalue = meter.listParam[1].dvalue;
                        value2 = dvalue.ToString("F2");
                    }
                    if (meter.listParam.ContainsKey(3))
                    {
                        double dvalue = meter.listParam[3].dvalue;
                        value3 = dvalue.ToString("F1");
                    }
                    if (meter.listParam.ContainsKey(5))
                    {
                        double dvalue = meter.listParam[5].dvalue;
                        value4 = dvalue.ToString("F2");
                    }
                    if (meter.listParam.ContainsKey(8))
                    {
                        double dvalue = meter.listParam[8].dvalue;
                        value5 = dvalue.ToString("F3");
                    }
                    if (meter.listParam.ContainsKey(4))
                    {
                        double dvalue = meter.listParam[4].dvalue;
                        value6 = dvalue.ToString("F2");
                    }
                }
                dataGridViewRow.Cells[1].Value = value;
                dataGridViewRow.Cells[2].Value = value2;
                dataGridViewRow.Cells[3].Value = value3;
                dataGridViewRow.Cells[4].Value = value4;
                dataGridViewRow.Cells[5].Value = value5;
                dataGridViewRow.Cells[6].Value = value6;
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceivePoisonMessageDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ReceivePoisonMessageDecorator(IMetrics metrics,
                                             IReceivePoisonMessage handler,
                                             IConnectionInformation connectionInformation)
        {
            var name = "ReceivePoisonMessage";

            _meterError = metrics.Meter($"{connectionInformation.QueueName}.{name}.PoisonHandleMeter", Units.Items);
            _handler    = handler;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiveMessagesErrorDecorator" /> class.
 /// </summary>
 /// <param name="metrics">The metrics factory.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public ReceiveMessagesErrorDecorator(IMetrics metrics,
     IReceiveMessagesError handler,
     IConnectionInformation connectionInformation)
 {
     var name = handler.GetType().Name;
     _meterError = metrics.Meter($"{connectionInformation.QueueName}.{name}.MessageFailedProcessingErrorMeter", Units.Items);
     _meterRetry = metrics.Meter($"{connectionInformation.QueueName}.{name}.MessageFailedProcessingRetryMeter", Units.Items);
     _handler = handler;
 }
Exemplo n.º 19
0
        public MeterForwarder(IMeter meter)
        {
            _meter = meter;

            _listener = new MeterListener();
            _listener.InstrumentPublished = InstrumentPublished;
            _listener.SetMeasurementEventCallback <long>(MeasurementCallback);
            _listener.Start();
        }
Exemplo n.º 20
0
        public static MeterValue GetCurrentValue(IMeter metric)
        {
            var implementation = metric as IMeterMetric;

            if (implementation != null)
            {
                return(implementation.Value);
            }
            return(EmptyMeter);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessagesErrorDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ReceiveMessagesErrorDecorator(IMetrics metrics,
                                             IReceiveMessagesError handler,
                                             IConnectionInformation connectionInformation)
        {
            var name = "ReceiveMessagesError";

            _meterError = metrics.Meter($"{connectionInformation.QueueName}.{name}.MessageFailedProcessingErrorMeter", Units.Items);
            _meterRetry = metrics.Meter($"{connectionInformation.QueueName}.{name}.MessageFailedProcessingRetryMeter", Units.Items);
            _handler    = handler;
        }
        public override async Task OnActionExecutingAsync(HttpActionContext actionContext,
                                                          CancellationToken cancellationToken)
        {
            _meter     = Metering.GetGlobalMeter();
            _stopwatch = new Stopwatch();
            _stopwatch.Start();
            AddCountMetric("count");       //meters the count of api call

            await base.OnActionExecutingAsync(actionContext, cancellationToken);
        }
Exemplo n.º 23
0
        public GenCounterBenchmark_3()
        {
            _meter            = new GenevaMeter("testMeter", new MdmMetricFactory(), "testMonitoringAccount");
            _counter5DNullDim = (Counter5DNullDim)Metric.CreateCounter5DNullDim(_meter);
            _counter5D1Change = (Counter5D1Change)Metric.CreateCounter5D1Change(_meter);
            _counter5D3Change = (Counter5D3Change)Metric.CreateCounter5D3Change(_meter);

            _counter10D3Change  = (Counter10D3Change)Metric.CreateCounter10D3Change(_meter);
            _counter10D5Change  = (Counter10D5Change)Metric.CreateCounter10D5Change(_meter);
            _counter10D10Change = (Counter10D10Change)Metric.CreateCounter10D10Change(_meter);
        }
Exemplo n.º 24
0
        public ProducerStats(string clientId)
        {
            this.ClientId = clientId;
            this.SerializationErrorRate = MetersFactory.NewMeter(
                clientId + "-SerializationErrorsPerSec", "errors", TimeSpan.FromSeconds(1));

            this.ResendRate = MetersFactory.NewMeter(clientId + "-ResendsPerSec", "resends", TimeSpan.FromSeconds(1));

            this.FailedSendRate = MetersFactory.NewMeter(
                clientId + "-FailedSendsPerSec", "failed sends", TimeSpan.FromSeconds(1));
        }
        public ProducerStats(string clientId)
        {
            this.ClientId = clientId;
            this.SerializationErrorRate = MetersFactory.NewMeter(
                clientId + "-SerializationErrorsPerSec", "errors", TimeSpan.FromSeconds(1));

            this.ResendRate = MetersFactory.NewMeter(clientId + "-ResendsPerSec", "resends", TimeSpan.FromSeconds(1));

            this.FailedSendRate = MetersFactory.NewMeter(
                clientId + "-FailedSendsPerSec", "failed sends", TimeSpan.FromSeconds(1));
        }
Exemplo n.º 26
0
        private static void StubFindSerialDevices(object sender, DoWorkEventArgs e)
        {
            DeviceInfo dinfo = null;

            string comport = (string)e.Argument;

            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = comport;
            }

            var MeterTypes = Assembly.GetExecutingAssembly().GetTypes()
                             .Where(t => t.IsClass)     // Only include classes
                             .Where(t => t.IsSubclassOf(typeof(AbstractMeter)))
                             .Where(t => t.GetInterfaces().Contains(typeof(IMeter)))
                             .OrderBy(t => t.Namespace)
                             .ThenBy(t => t.Name);

            //for each com port test each meter type to see if its on that port
            foreach (var reflect in MeterTypes)
            {
                Type   t     = reflect.UnderlyingSystemType;
                IMeter meter = (IMeter)Activator.CreateInstance(t);

                //if failed to connect skip this meter
                if (!meter.Connect(comport))
                {
                    continue;
                }

                try
                {
                    Console.WriteLine("Testing " + comport + " for " + reflect.UnderlyingSystemType.ToString());
                    if (meter.Port.IsOpen && meter.IsMeterConnected(comport))
                    {
                        dinfo             = new DeviceInfo();
                        dinfo.DeviceType  = t;
                        dinfo.ComPortName = comport;
                        dinfo.HIDDevice   = false;
                        dinfo.Device      = meter;

                        lock (DevicesFound)
                        {
                            DevicesFound.Add(dinfo);
                            return; //found a device so return.  Can be removed to find all devices on a system.
                        }
                    }
                }//try
                finally
                {
                    meter.Dispose();
                }
            }
        }
Exemplo n.º 27
0
 public Probe(ProbeOptions options, IMeter meter, IMqttAdapter adapter, ILogger <Probe> logger)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     this.metrics = options.Metrics;
     this.delay   = options.InterSeriesDelay;
     this.meter   = meter ?? throw new ArgumentNullException(nameof(meter));
     this.adapter = adapter ?? throw new ArgumentNullException(nameof(adapter));
     this.logger  = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemplo n.º 28
0
        /// <summary>
        /// Construct a new <see cref="MeterValueEvent{V}"/> based on the specified predicate.
        /// </summary>
        /// <param name="meter">
        /// The <see cref="IMeter"/> to monitor.
        /// </param>
        /// <param name="attainedValue">
        /// The <see cref="Predicate{T}"/> that will be used to check if the current
        /// <see cref="IMeter"/> value.  The predicate will be passed an object equivalent
        /// to the <see cref="IMeter.CurrentValue"/> property of the supplied <c>meter</c>.
        /// </param>
        public MeterValueEvent(IMeter meter, Predicate <V> attainedValue)
        {
            meter.ValueChanged += Meter_ValueChanged;

            lock (this)
            {
                this.ValueMeter    = meter;
                this.attainedValue = attainedValue;

                waitHandle = CreateWaitHandle(this.attainedValue((V)meter.CurrentValue));
            }
        }
Exemplo n.º 29
0
 public MeterScreen(IMeter meter,
                    Point meterPosition,
                    TransitionWipeType transitionStyle,
                    ContentManager content,
                    VerticalAlignment vert    = VerticalAlignment.Top,
                    HorizontalAlignment horiz = HorizontalAlignment.Center) : base("MeterScreen", content)
 {
     Meter           = meter;
     MeterPosition   = meterPosition;
     TransitionStyle = transitionStyle;
     Vert            = vert;
     Horiz           = horiz;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiveMessagesDecorator" /> class.
 /// </summary>
 /// <param name="metrics">The metrics factory.</param>
 /// <param name="headers">The headers.</param>
 /// <param name="getTime">The get time.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public ReceiveMessagesDecorator(IMetrics metrics,
     IHeaders headers,
     IGetTimeFactory getTime,
     IReceiveMessages handler,
     IConnectionInformation connectionInformation)
 {
     var name = handler.GetType().Name;
     _meter = metrics.Meter($"{connectionInformation.QueueName}.{name}.ReceiveMessageMeter", Units.Items);
     _waitTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.WaitForDeQueueMeter", Units.None);
     _handler = handler;
     _getTime = getTime;
     _headers = headers;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SendMessagesDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public SendMessagesDecorator(IMetrics metrics,
            ISendMessages handler,
            IConnectionInformation connectionInformation)
        {
            var name = "SendMessages";
            _sendTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendTimer", Units.Calls);
            _sendBatchTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchTimer", Units.Calls);
            _sendAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendAsyncTimer", Units.Calls);
            _sendBatchAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchAsyncTimer", Units.Calls);

            _sendMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesMeter", Units.Items, TimeUnits.Minutes);
            _sendErrorMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesErrorMeter", Units.Items, TimeUnits.Minutes);
            _handler = handler;
        }
Exemplo n.º 32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessagesDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="getTime">The get time.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ReceiveMessagesDecorator(IMetrics metrics,
                                        IHeaders headers,
                                        IGetTimeFactory getTime,
                                        IReceiveMessages handler,
                                        IConnectionInformation connectionInformation)
        {
            var name = "ReceiveMessages";

            _meter     = metrics.Meter($"{connectionInformation.QueueName}.{name}.ReceiveMessageMeter", Units.Items);
            _waitTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.WaitForDeQueueMeter", Units.None);
            _handler   = handler;
            _getTime   = getTime;
            _headers   = headers;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SendMessagesDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public SendMessagesDecorator(IMetrics metrics,
            ISendMessages handler,
            IConnectionInformation connectionInformation)
        {
            var name = handler.GetType().Name;
            _sendTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendTimer", Units.Calls);
            _sendBatchTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchTimer", Units.Calls);
            _sendAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendAsyncTimer", Units.Calls);
            _sendBatchAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchAsyncTimer", Units.Calls);

            _sendMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesMeter", Units.Items, TimeUnits.Minutes);
            _sendErrorMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesErrorMeter", Units.Items, TimeUnits.Minutes);
            _handler = handler;
        }
 public ClusterNodeFactory(ClusterContext clusterContext, IConnectionPoolFactory connectionPoolFactory, ILogger <ClusterNode> logger,
                           ObjectPool <OperationBuilder> operationBuilderPool, ICircuitBreaker circuitBreaker, ISaslMechanismFactory saslMechanismFactory,
                           IIpEndPointService ipEndPointService, IRedactor redactor, IRequestTracer tracer, IMeter meter)
 {
     _clusterContext        = clusterContext ?? throw new ArgumentNullException(nameof(clusterContext));
     _connectionPoolFactory = connectionPoolFactory ?? throw new ArgumentNullException(nameof(connectionPoolFactory));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _operationBuilderPool = operationBuilderPool ?? throw new ArgumentNullException(nameof(operationBuilderPool));
     _circuitBreaker       = circuitBreaker ?? throw new ArgumentException(nameof(circuitBreaker));
     _saslMechanismFactory = saslMechanismFactory ?? throw new ArgumentNullException(nameof(saslMechanismFactory));
     _ipEndPointService    = ipEndPointService ?? throw new ArgumentNullException(nameof(ipEndPointService));
     _redactor             = redactor ?? throw new ArgumentNullException(nameof(redactor));
     _tracer = tracer ?? throw new ArgumentNullException(nameof(tracer));
     _meter  = meter ?? throw new ArgumentNullException(nameof(meter));
 }
        public EMHVerificationResult(Meter_Id?MeterId                     = null,
                                     IMeter Meter                         = null,
                                     DateTime?Timestamp                   = null,
                                     String InfoStatus                    = null,
                                     UInt32?SecondsIndex                  = null,
                                     String PaginationId                  = null,
                                     OBIS?OBIS                            = null,
                                     Int32?UnitEncoded                    = null,
                                     Int32?Scale                          = null,
                                     UInt64?Value                         = null,
                                     String LogBookIndex                  = null,
                                     String AuthorizationStart            = null,
                                     String AuthorizationStop             = null,
                                     DateTime?AuthorizationStartTimestamp = null,
                                     String PublicKey                     = null,
                                     String PublicKeyFormat               = null,
                                     String PublicKeySignatures           = null,
                                     IEMHSignature Signature              = null,

                                     String SHA256value        = null,
                                     VerificationResult?Status = null,
                                     String ErrorMessage       = null)
        {
            this.MeterId                     = MeterId;
            this.Meter                       = Meter;
            this.Timestamp                   = Timestamp;
            this.InfoStatus                  = InfoStatus;
            this.SecondsIndex                = SecondsIndex;
            this.PaginationId                = PaginationId;
            this.OBIS                        = OBIS;
            this.UnitEncoded                 = UnitEncoded;
            this.Scale                       = Scale;
            this.Value                       = Value;
            this.LogBookIndex                = LogBookIndex;
            this.AuthorizationStart          = AuthorizationStart;
            this.AuthorizationStop           = AuthorizationStop;
            this.AuthorizationStartTimestamp = AuthorizationStartTimestamp;
            this.PublicKey                   = PublicKey;
            this.PublicKeyFormat             = PublicKeyFormat;
            this.PublicKeySignatures         = PublicKeySignatures;
            this.Signature                   = Signature;

            this.SHA256Value  = SHA256value;
            this.Status       = Status;
            this.ErrorMessage = ErrorMessage;
        }
Exemplo n.º 36
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IMarket marketsCasted = item.As <IMarket>();

                if ((marketsCasted != null))
                {
                    this._parent.Markets.Add(marketsCasted);
                }
                IMarketProduct marketProductsCasted = item.As <IMarketProduct>();

                if ((marketProductsCasted != null))
                {
                    this._parent.MarketProducts.Add(marketProductsCasted);
                }
                IMeter metersCasted = item.As <IMeter>();

                if ((metersCasted != null))
                {
                    this._parent.Meters.Add(metersCasted);
                }
                if ((this._parent.Pnode == null))
                {
                    IPnode pnodeCasted = item.As <IPnode>();
                    if ((pnodeCasted != null))
                    {
                        this._parent.Pnode = pnodeCasted;
                        return;
                    }
                }
                if ((this._parent.Organisation == null))
                {
                    IErpOrganisation organisationCasted = item.As <IErpOrganisation>();
                    if ((organisationCasted != null))
                    {
                        this._parent.Organisation = organisationCasted;
                        return;
                    }
                }
                IResourceGroup resourceGroupsCasted = item.As <IResourceGroup>();

                if ((resourceGroupsCasted != null))
                {
                    this._parent.ResourceGroups.Add(resourceGroupsCasted);
                }
            }
Exemplo n.º 37
0
		protected override void Visit(IMeter meter)
		{
			sb.AppendFormat("{0:0.##}/{1}", meter.Rate, meter.Interval.ToString().ToLower());
		}
Exemplo n.º 38
0
 protected virtual void SetWrappee(IMeter value)
 {
     this.wrappee = value;
 }
Exemplo n.º 39
0
 public void ReportMeter(string name, IMeter value, Unit unit, TimeUnit rateUnit)
 {
 }
Exemplo n.º 40
0
		protected abstract void Visit(IMeter meter);
Exemplo n.º 41
0
 public MeterWrapper(IMeter meter)
 {
     wrappee = meter;
 }
Exemplo n.º 42
0
 /// <summary>
 /// Creates a new <see cref="ReownedMeter"/>
 /// </summary>
 /// <param name="newOwner">The new owner for the meter</param>
 /// <param name="meter">The meter to wrap</param>
 public ReownedMeter(object newOwner, IMeter meter)
     : base(meter)
 {
     this.Owner = newOwner;
 }
Exemplo n.º 43
0
        void bgw_DoWork(object sender, DoWorkEventArgs e)
        {
            if (Meter != null && (!Meter.Port.IsOpen || Meter.Port.PortName != ((string[])e.Argument)[0]))
            {
                Meter.Dispose();
                Meter = null;
                System.Threading.Thread.Sleep(2500);
            }

            Meter = (IMeter)Activator.CreateInstance(Type.GetType("GlucaTrack.Communication.Meters." + ((string[])e.Argument)[1] + ", GlucaTrack.Communication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"));
            Meter.ReadFinished += new EventHandler(OnReadFinished);
            Meter.RecordRead += new EventHandler(OnRecordRead);
            Meter.HeaderRead += new EventHandler(OnHeaderRead);

            Console.WriteLine("Connecting to " + ((string[])e.Argument)[0]);

            if (!Meter.Port.IsOpen)
            {
                Meter.Connect(((string[])e.Argument)[0]);
            }

            if (Meter.IsMeterConnected(((string[])e.Argument)[0]))
            {
                if (!Meter.Port.IsOpen)
                {
                    Meter.Connect(((string[])e.Argument)[0]);
                }

                Meter.Port.DiscardInBuffer();
                Meter.Port.DiscardOutBuffer();
                Meter.ReadData();
            }
        }
Exemplo n.º 44
0
			public IMeter Meter(IMeter parent, string instance, Interval interval)
			{
				return new DefaultMeter(parent, instance, interval);
			}