Data Classes

Rejected data objects

class rejected.data.Measurement[source]

Common Measurement Object that provides common methods for collecting and exposes measurement data that is submitted in rejected.process.Process and rejected.consumer.Consumer for submission to statsd or influxdb.

Attributes
counters Counters that are affected by decr and incr
durations List of duration values (float or int)
tags Tag key/value pairs for use with InfluxDB
values Numeric values such as integers, gauges, and such.

New in version 3.13.0.

add_duration(key, value)[source]

Add a duration for the specified key

Parameters:
  • key (str) – The value name
  • value (float) – The value

New in version 3.19.0.

decr(key, value=1)[source]

Decrement a counter.

Parameters:
  • key (str) – The key to decrement
  • value (int) – The value to decrement by
incr(key, value=1)[source]

Increment a counter.

Parameters:
  • key (str) – The key to increment
  • value (int) – The value to increment by
set_tag(key, value)[source]

Set a tag. This is only used for InfluxDB measurements.

Parameters:
  • key (str) – The tag name
  • value (str or bool or int) – The tag value
set_value(key, value)[source]

Set a value.

Parameters:
  • key (str) – The value name
  • value (int or float) – The value
track_duration(key)[source]

Context manager that sets a value with the duration of time that it takes to execute whatever it is wrapping.

Parameters:key (str) – The timing name
class rejected.data.Message(connection, channel, method, properties, body)[source]

Class for containing all the attributes about a message object creating a flatter, move convenient way to access the data while supporting the legacy methods that were previously in place in rejected < 2.0

Attributes
body The AMQP message body
connection The name of the connection that the message was received on.
channel The channel that the message was was received on.
consumer_tag The consumer tag registered with RabbitMQ that identifies which consumer registered to receive this message.
delivery_tag The delivery tag that represents the deliver of this message with RabbitMQ.
exchange The exchange the message was published to
method The pika.spec.Basic.Deliver or pika.spec.Basic.Return object that represents how the message was received by rejected.
properties The BasicProperties object that represents the message’s AMQP properties.
redelivered A flag that indicates the message was previously delivered by RabbitMQ.
routing_key The routing key that was used to deliver the message.
class rejected.data.Properties(properties=None, **kwargs)[source]

A class that represents all of the field attributes of AMQP’s Basic.Properties.

Attributes
app_id Creating application id
content_type MIME content type
content_encoding MIME content encoding
correlation_id Application correlation identifier
delivery_mode Non-persistent (1) or persistent (2)
expiration Message expiration specification
headers Message header field table
message_id Application message identifier
priority Message priority, 0 to 9
reply_to Address to reply to
timestamp Message timestamp
type Message type name
user_id Creating user id