A fluent library for exporting graph images from CloudWatch metrics.
- netstandard2.0
- .NET Framework 4.7.1
var provider = new ServiceCollection()
.AddSingleton<IAmazonCloudWatch>(new AmazonCloudWatchClient(RegionEndpoint.EUWest1))
.AddCloudWatchGraphs()
.BuildServiceProvider();
var plotBuilder = provider.GetService<IPlotBuilder>();
var plotModel = await plotBuilder.WithTime(DateTime.UtcNow.AddDays(-12), DateTime.UtcNow)
.AddMetric("AWS/Logs", "IncomingBytes")
.WithLabel("Average Incoming Bytes")
.PlotGraph(GraphType.Line, StatisticType.Average, TimeSpan.FromMinutes(30))
.WithTitle("CloudWatch Logs Incoming Bytes")
.Generate();
var svgExporter = new SvgExporter
{
Width = 750,
Height = 300
};
using (var output = File.Open("example.svg", FileMode.Create))
{
svgExporter.Export(plotModel, output);
}