public void Create_Should_Return_A_GaugeModel() { var name = "Name"; var helpText = "HelpText"; var labels = new[] { "name, env" }; var labelValues = new[] { "orders", "prod" }; var count = 12; var gaugeModel = GaugeHelper.Create(name, helpText, labels, labelValues, count); Assert.Equal(gaugeModel.Name, name); Assert.Equal(gaugeModel.Help, helpText); Assert.Equal(gaugeModel.Labels, labels); Assert.Equal(gaugeModel.LabelValues, labelValues); Assert.Equal(gaugeModel.Value, count); }
public async Task <List <GaugeModel> > CreateMetricsAsync(IServiceBusNamespace serviceBusNamespace) { List <GaugeModel> gaugeModels = new List <GaugeModel>(); var topics = await GetTopicsAsync(serviceBusNamespace); foreach (var topic in topics) { _logger.LogTrace($"{DateTime.Now:o} - Create gaugemodel for topic: {topic.Name}"); gaugeModels.Add(GaugeHelper.Create("servicebus_topic_active_messages", "The number of active messages in the topic.", new[] { "name" }, new[] { topic.Name }, topic.ActiveMessageCount)); gaugeModels.Add(GaugeHelper.Create("servicebus_topic_scheduled_messages", "The number of messages sent to the topic that are yet to be released for consumption.", new[] { "name" }, new[] { topic.Name }, topic.ScheduledMessageCount)); gaugeModels.Add(GaugeHelper.Create("servicebus_topic_dead_letter_messages", "The number of messages in the dead-letter topic.", new[] { "name" }, new[] { topic.Name }, topic.DeadLetterMessageCount)); gaugeModels.Add(GaugeHelper.Create("servicebus_topic_transfer_messages", "The number of messages transferred to another topic, topic, or subscription.", new[] { "name" }, new[] { topic.Name }, topic.TransferMessageCount)); gaugeModels.Add(GaugeHelper.Create("servicebus_topic_transfer_dead_letter_messages", "The number of messages transferred into dead letters.", new[] { "name" }, new[] { topic.Name }, topic.TransferDeadLetterMessageCount)); } return(gaugeModels); }
public async Task <List <GaugeModel> > CreateMetricsAsync(IServiceBusNamespace serviceBusNamespace) { List <GaugeModel> gaugeModels = new List <GaugeModel>(); var queues = await GetQueuesAsync(serviceBusNamespace); foreach (var queue in queues) { _logger.LogTrace($"{DateTime.Now:o} - Create gaugemodel for queue: {queue.Name}"); gaugeModels.Add(GaugeHelper.Create("servicebus_queue_active_messages", "The number of messages in the queue.", new[] { "name" }, new[] { queue.Name }, queue.MessageCount)); gaugeModels.Add(GaugeHelper.Create("servicebus_queue_scheduled_messages", "The number of messages sent to the queue that are yet to be released for consumption.", new[] { "name" }, new[] { queue.Name }, queue.ScheduledMessageCount)); gaugeModels.Add(GaugeHelper.Create("servicebus_queue_dead_letter_messages", "The number of messages in the dead-letter queue.", new[] { "name" }, new[] { queue.Name }, queue.DeadLetterMessageCount)); gaugeModels.Add(GaugeHelper.Create("servicebus_queue_size_bytes", "The current size of the queue, in bytes.", new[] { "name" }, new[] { queue.Name }, queue.CurrentSizeInBytes)); gaugeModels.Add(GaugeHelper.Create("servicebus_queue_transfer_dead_letter_messages", "The number of messages transferred into dead letters.", new[] { "name" }, new[] { queue.Name }, queue.TransferDeadLetterMessageCount)); gaugeModels.Add(GaugeHelper.Create("servicebus_queue_transfer_messages", "The number of messages transferred to another queue, topic, or subscription.", new[] { "name" }, new[] { queue.Name }, queue.TransferMessageCount)); } return(gaugeModels); }