/// <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);
 }
Ejemplo n.º 2
0
 public void Process(IList <MetricEntity> logs)
 {
     if (Config.MetricInfluxdbVer == "0.8")
     {
         InfluxdbReport report = new InfluxdbReport();
         report.WriteAsync(logs);
     }
     else
     {
         InfluxdbWriter report = new InfluxdbWriter();
         report.WriteAsync(logs);
     }
 }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <MetricEntity> lst = new List <MetricEntity>();

            for (int i = 0; i < 100; i++)
            {
                var tag = new Dictionary <string, string>();
                tag.Add("tag1", "aa");
                lst.Add(new MetricEntity {
                    Name = "test", Value = 11, Time = Utils.GetUnixTime(DateTime.Now)
                });
            }
            InfluxdbWriter w = new InfluxdbWriter();

            w.WriteAsync(lst);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the BatchSize on this instance to the specified value and returns this <see cref="InfluxdbWriter"/> instance.
 /// </summary>
 /// <param name="writer">The InfluxDB metric writer.</param>
 /// <param name="batchSize">The maximum number of records to write per flush. Set to zero to write all records in a single flush. Negative numbers are not allowed.</param>
 /// <returns>This <see cref="InfluxdbWriter"/> instance.</returns>
 public static InfluxdbWriter WithBatchSize(this InfluxdbWriter writer, Int32 batchSize)
 {
     writer.BatchSize = batchSize;
     return(writer);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the Writer on the InfluxDB reporter configuration and returns the same instance.
 /// </summary>
 /// <param name="config">The InfluxDB reporter configuration.</param>
 /// <param name="writer">The InfluxDB metric writer.</param>
 /// <param name="configFunc">A lambda expression that allows further configuration of the <see cref="InfluxdbWriter"/> using fluent syntax.</param>
 /// <returns>This <see cref="InfluxConfig"/> instance.</returns>
 public static InfluxConfig WithWriter(this InfluxConfig config, InfluxdbWriter writer, Action <InfluxdbWriter> configFunc = null)
 {
     configFunc?.Invoke(writer);
     config.Writer = writer;
     return(config);
 }