51Degrees Pipeline for Python

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage Class Reference

Inheritance diagram for fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage:

[legend]

Collaboration diagram for fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage:

[legend]

Public Member Functions

 __init__ (self, interval=1200, requested_package_size=10, cookie=None, query_whitelist=[], header_blacklist=[], share_percentage=1, endpoint="https://devices-v4.51degrees.com/new.ashx", request_timeout=REQUEST_TIMEOUT)
 Constructor for ShareUsage element.
 __del__ (self)
 close (self)
 Wait for any usage data already being sent, then stop the threads that send it.
 get_constant_xml (self)
 get_flow_elements (self)
 get_evidence_key_filter (self)
 The share useage element comes with its own evidence key filter that uses the whitelists and blacklists to determine which evidence to share.
 share_send_usage (self)
 Internal method to send the share usage bundle to the 51Degrees servers.
 send_thread (self, endpoint, data)
 add_to_share_usage (self, data)
 Internal method which adds to the share usage bundle (generating XML) @type key: dict.
 process_internal (self, flow_data)
 Internal process method which uses the ShareUsageTracker to determine whether to add usage data to a batch and adds it if necessary.
 get_data_from_evidence (self, flow_data)
 Creates a ShareUsageData instance populated from the evidence within the flow data provided.

Public Member Functions inherited from fiftyone_pipeline_engines.engine.Engine

 __init__ (self, data_file=None)
 Constructor for an engine.
 set_cache (self, cache)
 Add a cache to an engine @type cashe: Cache.
 set_restricted_properties (self, properties_list)
 Add a subset of properties.
 in_cache (self, flowdata)
 A method to check if a flowdata's evidence is in the cache.
 refresh (self, identifier)
 process (self, flowdata)
 Engine's core process function.
 on_registration (self, pipeline)
 Called when an engine is registered with a pipeline and if there is a data file, a data file update service is attached to the parent pipeline.
 register_data_file (self, data_file)
 Register a data_file of the DataFile class with the engine @type data_file: DataFile.

Public Member Functions inherited from fiftyone_pipeline_core.flowelement.FlowElement

 __init__ (self)
 List of Pipelines the FlowElement has been added to.
 filter_evidence (self, flowdata)
 Filter FlowData evidence using the FlowElement's EvidenceKeyFilter.
 filter_evidence_key (self, key)
 Filter FlowData.evidence using the flowElement's EvidenceKeyFilter with the property key of evidence of interest.
 get_properties (self)
 Get the FlowElement.properties of a FlowElement.

Public Attributes

 query_whitelist = query_whitelist
 header_blacklist = header_blacklist
 interval = interval
 requested_package_size = requested_package_size
 cookie = cookie
 share_percentage = share_percentage
 endpoint = endpoint
 request_timeout = request_timeout
 tracker = ShareUsageTracker(interval = interval)
list share_data = []
 constant_xml = None
 thread_pool = ThreadPoolExecutor(thread_name_prefix='ShareUsage')
 send_thread

Public Attributes inherited from fiftyone_pipeline_engines.engine.Engine

 data_file = data_file
 cache = cache
 restricted_properties = properties_list

Public Attributes inherited from fiftyone_pipeline_core.flowelement.FlowElement

list pipelines = []
dict properties = {}
str datakey = ""
bool exclude_from_messages = False

Additional Inherited Members

Protected Member Functions inherited from fiftyone_pipeline_core.flowelement.FlowElement

 _log (self, level, message)

Constructor & Destructor Documentation

◆ __init__()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.__init__ ( self,
interval = 1200,
requested_package_size = 10,
cookie = None,
query_whitelist = [],
header_blacklist = [],
share_percentage = 1,
endpoint = "https://devices-v4.51degrees.com/new.ashx",
request_timeout = REQUEST_TIMEOUT )

Constructor for ShareUsage element.

@type interval: int

Parameters
intervalIf exactly the same evidence values are seen multiple times within this time limit (in seconds) then they will only be shared once. @type requested_package_size: int
requested_package_sizeThe usage element will group data into single requests before sending it. This setting controls the minimum number of entries before data is sent. If you are sharing large amounts of data, increasing this value is recommended in order to reduce the overhead of sending HTTP messages. For example, the 51Degrees cloud service uses a value of 2500. @type cookie: string
cookieIf a cookie is being used to identify user sessions, it can be specified here in order to reduce the sharing of duplicated data. @type query_whitelist: list
query_whitelistBy default query string and HTTP form parameters are not shared unless prefixed with '51D_'. If you need to share query string parameters, a list can be specified here. @type query_blacklist: list
query_blacklistBy default, all HTTP headers (except a few, such as Cookies) are shared. Individual headers can be excluded from sharing by adding them to this list. @type share_percentage : float
share_percentageapproximate proportion of requests to be shared. 1 = 100%, 0.5 = 50%, etc..

◆ __del__()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.__del__ ( self)

Member Function Documentation

◆ add_to_share_usage()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.add_to_share_usage ( self,
data )

Internal method which adds to the share usage bundle (generating XML) @type key: dict.

Parameters
keydata value store of current evidence in FlowData

◆ close()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.close ( self)

Wait for any usage data already being sent, then stop the threads that send it.

The pipeline calls this when it is closed.

Reimplemented from fiftyone_pipeline_engines.engine.Engine.

◆ get_constant_xml()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.get_constant_xml ( self)

◆ get_data_from_evidence()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.get_data_from_evidence ( self,
flow_data )

Creates a ShareUsageData instance populated from the evidence within the flow data provided.

Parameters
{FlowData}flowData the flow data containing the evidence to use
Returns
a new ShareUsageData instance, populated from the evidence provided

◆ get_evidence_key_filter()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.get_evidence_key_filter ( self)

The share useage element comes with its own evidence key filter that uses the whitelists and blacklists to determine which evidence to share.

Reimplemented from fiftyone_pipeline_core.flowelement.FlowElement.

◆ get_flow_elements()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.get_flow_elements ( self)

◆ process_internal()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.process_internal ( self,
flow_data )

Internal process method which uses the ShareUsageTracker to determine whether to add usage data to a batch and adds it if necessary.

@type flow_data: FlowData

Parameters
flow_dataFlowData to process

Reimplemented from fiftyone_pipeline_core.flowelement.FlowElement.

◆ send_thread()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.send_thread ( self,
endpoint,
data )

◆ share_send_usage()

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.share_send_usage ( self)

Internal method to send the share usage bundle to the 51Degrees servers.

Member Data Documentation

◆ constant_xml

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.constant_xml = None

◆ cookie

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.cookie = cookie

◆ endpoint

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.endpoint = endpoint

◆ header_blacklist

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.header_blacklist = header_blacklist

◆ interval

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.interval = interval

◆ query_whitelist

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.query_whitelist = query_whitelist

◆ request_timeout

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.request_timeout = request_timeout

◆ requested_package_size

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.requested_package_size = requested_package_size

◆ send_thread

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.send_thread

◆ share_data

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.share_data = []

◆ share_percentage

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.share_percentage = share_percentage

◆ thread_pool

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.thread_pool = ThreadPoolExecutor(thread_name_prefix='ShareUsage')

◆ tracker

fiftyone_pipeline_engines_fiftyone.share_usage.ShareUsage.tracker = ShareUsageTracker(interval = interval)