Qudi
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
influx_data_logger.InfluxLogger Class Reference

Log instrument values to InfluxDB. More...

Inheritance diagram for influx_data_logger.InfluxLogger:
Inheritance graph
[legend]
Collaboration diagram for influx_data_logger.InfluxLogger:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, kwargs)
 
def on_activate (self)
 Activate module.
 
def on_deactivate (self)
 Deactivate module.
 
def connect_db (self)
 Connect to Influx database.
 
def get_log_channels (self)
 Get number of logging channels. More...
 
def set_log_channels (self, channelspec)
 Set number of logging channels. More...
 
def log_to_channel (self, channel, values)
 Log values to a specific channel. More...
 
def format_data (self, channel_name, values, tags)
 Format data according to InfluxDB JSON API. More...
 
- Public Member Functions inherited from core.module.BaseMixin
def __init__ (self, manager, name, config=None, callbacks=None, kwargs)
 Initialise Base class object and set up its state machine. More...
 
def log (self)
 Returns a logger object.
 
def is_module_threaded (self)
 Returns whether the module shall be started in a thread.
 
def on_activate (self)
 Method called when module is activated. More...
 
def on_deactivate (self)
 Method called when module is deactivated. More...
 
def getStatusVariables (self)
 Return a dict of variable names and their content representing the module state for saving. More...
 
def setStatusVariables (self, variableDict)
 Give a module a dict of variable names and their content representing the module state. More...
 
def getConfiguration (self)
 Return the configration dictionary for this module. More...
 
def get_connector (self, connector_name)
 Return module connected to the given named connector. More...
 
- Public Member Functions inherited from core.module.ModuleMeta
def __new__ (cls, name, bases, attrs)
 Collect declared Connectors, ConfigOptions and StatusVars into dictionaries. More...
 

Public Attributes

 log_channels
 
 conn
 
- Public Attributes inherited from core.module.BaseMixin
 module_state
 
 connectors
 

Static Public Attributes

 user = ConfigOption('user', missing='error')
 
 pw = ConfigOption('password', missing='error')
 
 dbname = ConfigOption('dbname', missing='error')
 
 host = ConfigOption('host', missing='error')
 
 port = ConfigOption('port', 8086)
 
 series = ConfigOption('dataseries', missing='error')
 
 field = ConfigOption('field', missing='error')
 
 cr = ConfigOption('criterion', missing='error')
 

Detailed Description

Log instrument values to InfluxDB.

Example config for copy-paste:

influx_data_logger: module 'influx_data_logger.InfluxLogger' user 'client_user' password 'client_password' dbname 'db_name' host 'localhost' port 8086 dataseries 'data_series_name' field 'field_name' criterion 'criterion_name'

Member Function Documentation

◆ format_data()

def influx_data_logger.InfluxLogger.format_data (   self,
  channel_name,
  values,
  tags 
)

Format data according to InfluxDB JSON API.

Parameters
channel_namestr: channel name
valueslist: data
tagslist(str): list of tags

◆ get_log_channels()

def influx_data_logger.InfluxLogger.get_log_channels (   self)

Get number of logging channels.

Returns
int: number of channels

◆ log_to_channel()

def influx_data_logger.InfluxLogger.log_to_channel (   self,
  channel,
  values 
)

Log values to a specific channel.

Parameters
channelstr: channel name
valueslist: data to be logged

◆ set_log_channels()

def influx_data_logger.InfluxLogger.set_log_channels (   self,
  channelspec 
)

Set number of logging channels.

Parameters
channelspecdict: name, spec

The documentation for this class was generated from the following file: