internal static InfluxPoint ToInfluxPoint(this MeasurementPoint point) { var influxPoint = new InfluxPoint(point.Measurement) .AddTags(point.Tags) .AddFields(point.ValueTypeFields) .AddFields(point.StringFields); return(influxPoint); }
public async Task SendAsync(string measurement, Func <IFieldBuilder, IFieldBuilder> fieldBuilder, Func <ITagBuilder, ITagBuilder> tabBuilder, DateTime?timestamp = null) { if (fieldBuilder == null) { throw new ArgumentNullException(nameof(fieldBuilder)); } var tags = BuildTags(tabBuilder); var fields = fieldBuilder(new FieldBuilder()).ToDictionary(f => f.Key, f => f.Value); var point = new InfluxPoint(measurement, fields, tags, timestamp); await PublishAsync(point); }
public static string Serialize(InfluxPoint point) { var tags = point.Tags; var fields = point.Fields; var allTags = string.Join(",", TagsFormatter.Format(tags)); var allFields = string.Join(",", FieldFormatter.Format(fields)); var tagsPart = allTags.Length > 0 ? $",{allTags}" : allTags; var measurement = KeyFormatter.Format(point.Measurement); return($"{measurement}{tagsPart} {allFields} {FieldValueFormatter.FormatTimestamp(point.UtcTimestamp)}".Trim()); }
private void Write(InfluxPoint point) { _target.Append(point.Measurement); _target.Append(","); Write(point.Tags); _target.Append(" "); Write(point.Fields); if (point.TimeStamp != null) { _target.Append(" "); _target.Append(point.TimeStampResolution.NanosecondsFrom(point.TimeStamp)); } }
internal async Task PublishAsync(InfluxPoint point) { var metric = point.Format(); await _channel.WriteAsync(metric); }
internal void Publish(InfluxPoint point) { var metric = point.Format(); _channel.Write(metric); }