- class cobald.monitor.format_line.LineProtocolFormatter(tags: Optional[Union[Dict[str, Any], Set[str]]] = None, resolution: Optional[float] = None)
Formatter that emits data as InfluxDB Line Protocol
tags – record data to use as tags
resolution – resolution of timestamps in seconds
tagsact as a whitelist for record keys if they are an iterable. When a dictionary is supplied, its values act as default values if the key is not in a record.
resolutionallows summarising data by downsampling the timestamps to the given resolution, e.g. for a
10you can expect timestamps 10, 20, 30, … If
Nonethe timestamp is omitted from the Line Protocol and Telegraf will take care on setting the current timestamp.
- format(record: LogRecord) str
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
- cobald.monitor.format_line.escape_field(field: T) T
- cobald.monitor.format_line.line_protocol(name, tags: Optional[dict] = None, fields: Optional[dict] = None, timestamp: Optional[float] = None) str
Format a report as per InfluxDB line protocol
name – name of the report
tags – tags identifying the specific report
fields – measurements of the report
timestamp – when the measurement was taken, in seconds since the epoch