AppMetrics / InfluxDB

App Metrics Extensions for InfluxDB reporting
https://www.app-metrics.io/reporting/reporters/influx-data/
Apache License 2.0
17 stars 13 forks source link

Allow loading reporter settings from config #19

Closed alhardy closed 6 years ago

alhardy commented 7 years ago

Dependency on Microsoft DI and Configuration has been removed by default, still require a way to load settings from config

alhardy commented 6 years ago

Simplest approach is the following from an application point of view. This way AppMetrics doesn't need any custom configuration of sorts or a dependency on IConfiguration

var influxOptions = new MetricsReportingInfluxDbOptions();
configuration.GetSection(nameof(MetricsReportingInfluxDbOptions)).Bind(influxOptions);

...
 builder.Report.ToInfluxDb(influxOptions);
...
stukselbax commented 6 years ago

Before finding this, I have read your docs, and haven't find the way to do this. It is worth adding to the documentation. Also it would be great if such things could be available out of the box.

alhardy commented 6 years ago

Cool, open a new issue?

alhardy commented 6 years ago

Feel free to PR to documentation