/// <summary> /// Formats the measurement name, tag keys, and field keys on the specified <see cref="InfluxRecord"/> /// with the defined tag and key formatters and returns the same record instance. /// </summary> /// <param name="record">The <see cref="InfluxRecord"/> to format the tag and field keys for.</param> /// <returns>The same <see cref="InfluxRecord"/> instance with the tag and field keys formatted.</returns> public virtual InfluxRecord FormatRecord(InfluxRecord record) { record.Name = FormatMetricName(null, record.Name, Unit.None, null) ?? record.Name; for (int i = 0; i < record.Tags.Count; i++) { InfluxTag tag = record.Tags[i]; String fmtKey = FormatTagKey(tag.Key); record.Tags[i] = new InfluxTag(fmtKey, tag.Value); } for (int i = 0; i < record.Fields.Count; i++) { InfluxField field = record.Fields[i]; String fmtKey = FormatFieldKey(field.Key); record.Fields[i] = new InfluxField(fmtKey, field.Value); } return(record); }
public void InfluxField_FormatsTo_LineProtocol(InfluxField field, String output) { field.ToLineProtocol().Should().Be(output); field.ToString().Should().Be(output); }
public FieldTestCase(InfluxField field, String output) { Field = field; Output = output; }