Skip to content

pmastalerz/influx-line-protocol

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status PyPI version License

influx-line-protocol

Implementation of influxdata line protocol format in python

Installation

$ pip install influx_line_protocol

Usage

from influx_line_protocol import Metric

metric = Metric("weather")
metric.with_timestamp(1465839830100400200)
metric.add_tag('location', 'Cracow')
metric.add_value('temperature', '29')

print metric
"""
  Will print:
  weather,location=Cracow temperature=29 1465839830100400200
"""

Multiple metrics example

from influx_line_protocol import Metric, MetricCollection

collection = MetricCollection()
metric = Metric("weather")
metric.with_timestamp(1465839830100400200)
metric.add_tag('location', 'Cracow')
metric.add_value('temperature', '29')
collection.append(metric)

metric = Metric("weather")
metric.with_timestamp(1465839830100400200)
metric.add_tag('location', 'Nowy Sacz')
metric.add_value('temperature', '31')
collection.append(metric)

print collection
"""
  Will print
  weather,location="Cracow" temperature=29 1465839830100400200
  weather,location="Nowy Sacz" temperature=29 1465839830100400200
"""

License

See LICENSE file.

About

Implementation of influxdata line protocol format in python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%