public async Task CanQueryLongFormulas()
        {
            var client = new GraphiteClient(GraphiteHost)
            {
                UseSsl = false
            };
            var metrics = new SeriesListBase[768];

            for (int i = 0; i < metrics.Length; i++)
            {
                metrics[i] = new GraphitePath("prefix").Dot("path")
                             .Dot(Guid.NewGuid().ToString().Replace("-", String.Empty))
                             .Dot("category")
                             .Dot(Guid.NewGuid().ToString().Replace("-", String.Empty))
                             .Dot("value")
                             .Alias(i.ToString());
            }
            var metric = metrics.Sum();

            Assert.True(metric.ToString().Length > UInt16.MaxValue, "request too short to fail");
            try
            {
                await client.GetMetricsDataAsync(metric);
            }
            catch (UriFormatException)
            {
                throw;
            }
            catch
            {
                // ignored host may be not reachable
            }
        }
Beispiel #2
0
 /// <summary>
 /// fetch metric values from graphite
 /// </summary>
 /// <param name="target">path identifying one metric, optionally with functions acting on those metric</param>
 /// <param name="from">specify the relative or absolute beginning to graph</param>
 /// <param name="until">specify the relative or absolute end to graph</param>
 /// <param name="template">The target metrics can use a special <see cref="SeriesListBase.Template(string[])"/> function which allows the metric paths to contain variables</param>
 /// <param name="maxDataPoints"></param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None"/>.</param>
 /// <returns></returns>
 public Task <GraphiteMetricData[]> GetMetricsDataAsync(SeriesListBase target, string from = null, string until = null, IDictionary <string, string> template = null, ulong?maxDataPoints = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(GetMetricsDataAsync(new[] { target }, from, until, template, maxDataPoints, cancellationToken));
 }