コード例 #1
0
        public static MetricBuilder GetBuilder(this Reporter reporter, string alias)
        {
            var builder = new MetricBuilder();

            builder.WithTimestamp()
            .WithPath(GeneratePath(alias))
            .WithAlias(alias);

            return(builder);
        }
コード例 #2
0
        public static void Enqueue(this Reporter reporter, string alias, Dictionary <string, object> data = null)
        {
            var builder = new MetricBuilder();

            builder.WithTimestamp()
            .WithAlias(alias)
            .WithPath(GeneratePath(alias));

            if (data != null && data.Any())
            {
                foreach (var pair in data)
                {
                    builder.WithData(pair.Key, pair.Value);
                }
            }

            reporter.Enqueue(builder.Build());
        }
コード例 #3
0
        public static void Enqueue(this Reporter reporter, string providerName, string endpoint, long value, string responseCode)
        {
            var builder = new MetricBuilder();

            var itemName = endpoint;

            if (!string.IsNullOrEmpty(providerName))
            {
                itemName = $"{providerName}.{endpoint}";
            }

            var metric = builder.WithTimestamp()
                         .WithValue(value)
                         .WithPath(GeneratePath(itemName))
                         .WithAlias(itemName)
                         .WithMessage(responseCode).Build();

            reporter.Enqueue(metric);
        }