/// <summary> /// Creates a new InfluxDB report that uses the Line Protocol syntax. /// </summary> /// <param name="config">The InfluxDB configuration object.</param> public InfluxdbBaseReport(InfluxConfig config = null) { this.config = GetDefaultConfig(config) ?? new InfluxConfig(); this.converter = config.Converter; this.formatter = config.Formatter; this.writer = config.Writer; ValidateConfig(this.config); }
/// <summary> /// Sets the <see cref="InfluxdbFormatter.ReplaceSpaceChar"/> property on this instance to the specified value and returns this <see cref="InfluxdbFormatter"/> instance. /// </summary> /// <param name="formatter">The InfluxDB metric formatter.</param> /// <param name="replaceChars">The character(s) to replace all space characters with (underscore by default). If <see cref="String.Empty"/>, removes all spaces. If null, spaces are not replaced.</param> /// <returns>This <see cref="InfluxdbFormatter"/> instance.</returns> public static InfluxdbFormatter WithReplaceSpaces(this InfluxdbFormatter formatter, String replaceChars = "_") { formatter.ReplaceSpaceChar = replaceChars; return(formatter); }
/// <summary> /// Sets the <see cref="InfluxdbFormatter.LowercaseNames"/> property on this instance to the specified value and returns this <see cref="InfluxdbFormatter"/> instance. /// </summary> /// <param name="formatter">The InfluxDB metric formatter.</param> /// <param name="lowercaseNames">If set to true will convert all context names, metric names, tag keys, and field keys to lowercase. If false, it does not modify the names. The default value is true.</param> /// <returns>This <see cref="InfluxdbFormatter"/> instance.</returns> public static InfluxdbFormatter WithLowercase(this InfluxdbFormatter formatter, Boolean lowercaseNames = true) { formatter.LowercaseNames = lowercaseNames; return(formatter); }
/// <summary> /// Sets the FieldKeyFormatter on this instance to the specified value and returns this <see cref="InfluxdbFormatter"/> instance. /// </summary> /// <param name="formatter">The InfluxDB metric formatter.</param> /// <param name="fieldFormatter">The field key formatter function.</param> /// <returns>This <see cref="InfluxdbFormatter"/> instance.</returns> public static InfluxdbFormatter WithFieldFormatter(this InfluxdbFormatter formatter, InfluxdbFormatter.FieldKeyFormatterDelegate fieldFormatter) { formatter.FieldKeyFormatter = fieldFormatter; return(formatter); }
/// <summary> /// Sets the TagKeyFormatter on this instance to the specified value and returns this <see cref="InfluxdbFormatter"/> instance. /// </summary> /// <param name="formatter">The InfluxDB metric formatter.</param> /// <param name="tagFormatter">The tag key formatter function.</param> /// <returns>This <see cref="InfluxdbFormatter"/> instance.</returns> public static InfluxdbFormatter WithTagFormatter(this InfluxdbFormatter formatter, InfluxdbFormatter.TagKeyFormatterDelegate tagFormatter) { formatter.TagKeyFormatter = tagFormatter; return(formatter); }
/// <summary> /// Sets the MetricNameFormatter on this instance to the specified value and returns this <see cref="InfluxdbFormatter"/> instance. /// </summary> /// <param name="formatter">The InfluxDB metric formatter.</param> /// <param name="metricFormatter">The metric name formatter function.</param> /// <returns>This <see cref="InfluxdbFormatter"/> instance.</returns> public static InfluxdbFormatter WithMetricFormatter(this InfluxdbFormatter formatter, InfluxdbFormatter.MetricFormatterDelegate metricFormatter) { formatter.MetricNameFormatter = metricFormatter; return(formatter); }
/// <summary> /// Sets the ContextNameFormatter on this instance to the specified value and returns this <see cref="InfluxdbFormatter"/> instance. /// </summary> /// <param name="formatter">The InfluxDB metric formatter.</param> /// <param name="contextFormatter">The context name formatter function.</param> /// <returns>This <see cref="InfluxdbFormatter"/> instance.</returns> public static InfluxdbFormatter WithContextFormatter(this InfluxdbFormatter formatter, InfluxdbFormatter.ContextFormatterDelegate contextFormatter) { formatter.ContextNameFormatter = contextFormatter; return(formatter); }
/// <summary> /// Sets the Formatter on the InfluxDB reporter configuration and returns the same instance. /// </summary> /// <param name="config">The InfluxDB reporter configuration.</param> /// <param name="formatter">The InfluxDB metric formatter.</param> /// <param name="configFunc">A lambda expression that allows further configuration of the <see cref="InfluxdbFormatter"/> using fluent syntax.</param> /// <returns>This <see cref="InfluxConfig"/> instance.</returns> public static InfluxConfig WithFormatter(this InfluxConfig config, InfluxdbFormatter formatter, Action <InfluxdbFormatter> configFunc = null) { configFunc?.Invoke(formatter); config.Formatter = formatter; return(config); }