duct¶
duct.aggregators¶
duct.interfaces¶
duct.objects¶
-
class
duct.objects.Event(state, service, description, metric, ttl, tags=None, hostname=None, aggregation=None, evtime=None, attributes=None, type='metric')[source]¶ Bases:
objectDuct Event object
All sources pass these to the queue, which form a proxy object to create protobuf Event objects
Parameters: - state – Some sort of string < 255 chars describing the state
- service – The service name for this event
- description – A description for the event, ie. “My house is on fire!”
- metric – int or float metric for this event
- ttl – TTL (time-to-live) for this event
- tags – List of tag strings
- hostname – Hostname for the event (defaults to system fqdn)
- aggregation – Aggregation function
- attributes – A dictionary of key/value attributes for this event
- evtime – Event timestamp override
-
class
duct.objects.Output(config, duct)[source]¶ Bases:
objectOutput parent class
Outputs can inherit this object which provides a construct for a working output
Parameters: - config – Dictionary config for this queue (usually read from the yaml configuration)
- duct – A DuctService object for interacting with the queue manager
-
class
duct.objects.Source(config, queueBack, duct)[source]¶ Bases:
objectSource parent class
Sources can inherit this object which provides a number of utility methods.
Parameters: - config – Dictionary config for this queue (usually read from the yaml configuration)
- queueBack – A callback method to recieve a list of Event objects
- duct – A DuctService object for interacting with the queue manager
-
createEvent(state, description, metric, prefix=None, hostname=None, aggregation=None, evtime=None)[source]¶ Creates an Event object from the Source configuration
duct.service¶
duct.utils¶
-
class
duct.utils.BodyReceiver(finished)[source]¶ Bases:
twisted.internet.protocol.ProtocolSimple buffering consumer for body objects
-
class
duct.utils.PersistentCache(location='/var/lib/duct/cache')[source]¶ Bases:
objectA very basic dictionary cache abstraction. Not to be used for large amounts of data or high concurrency
-
class
duct.utils.ProcessProtocol(deferred, timeout)[source]¶ Bases:
twisted.internet.protocol.ProcessProtocolProcessProtocol which supports timeouts
-
class
duct.utils.StringProducer(body)[source]¶ Bases:
objectString producer for writing to HTTP requests
-
exception
duct.utils.Timeout[source]¶ Bases:
exceptions.ExceptionRaised to notify that an operation exceeded its timeout.
-
duct.utils.fork(executable, args=(), env={}, path=None, timeout=3600)[source]¶ Provides a deferred wrapper function with a timeout function
Parameters: - executable (str.) – Executable
- args (tupple.) – Tupple of arguments
- env (dict.) – Environment dictionary
- timeout (int.) – Kill the child process if timeout is exceeded