Esempio n. 1
0
        public async Task RaiseMetricShouldBeSuccessful()
        {
            IMetricDestination    target = new DogMetrics(_testApiKey);
            HoundMetricCollection data   = GetTestMetrics();

            HoundResult eventResponse = await target.RaiseMetric(data);

            eventResponse.IsSuccess.ShouldBeTrue();
        }
        internal static HttpContent GetHttpContent(HoundMetricCollection houndMetricCollection, string prefix)
        {
            var metricRequest = new MetricRequest
            {
                Series = new List <MetricSeries>
                {
                    new MetricSeries
                    {
                        Host   = houndMetricCollection.Host,
                        Title  = $"{prefix}.{houndMetricCollection.Title.ToLowerInvariant().Replace(' ', '.')}",
                        Points = houndMetricCollection.Points.Select(p => new List <decimal> {
                            GetPosixDateTime(p.Timestamp), p.Value
                        } as IEnumerable <decimal>)
                    }
                }
            };

            HttpContent content = new StringContent(JsonConvert.SerializeObject(metricRequest));

            content.Headers.Remove("Content-type");
            content.Headers.Add("Content-type", "application/json");

            return(content);
        }