BloombergLP::balm::PublicationScheduler

This class defines a mechanism for scheduling the periodic publication of metrics. Each publication scheduler object is supplied the address of a MetricsManager and a bdlmt::TimerEventScheduler at construction. The metrics manager is used to publish metrics, while the timer-event scheduler provides the underlying scheduling mechanism. Metrics are scheduled for publication using the scheduleCategory and setDefaultSchedule methods. The scheduleCategory method schedules an individual category to be publisher periodically at the provided interval, whereas setDefaultSchedule schedules the periodic publication of any category not given an individual schedule. The publication scheduler will create a recurring timer for each unique time interval supplied, and will group together categories that share a common time interval into a single call to MetricsManager::publish. Note that it is left unspecified whether publication events that occur on a common multiple of different intervals will be grouped into a single invocation of MetricsManager::publish.

Synopsis

Declared in <balm_publicationscheduler.h>

class PublicationScheduler;

Member Functions

NameDescription
PublicationScheduler [constructor]Create a publication scheduler that will use the specified metricsManager to publish metrics, and the specified eventScheduler to supply timer events. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.
~PublicationScheduler [destructor]Destroy this publication scheduler and cancel any pending publications. Note that, if any metrics are currently being published, this operation will block until all of their publications have completed.
cancelAll Cancel all periodic publication of metrics. This operation (atomically) clears the default publication schedule and cancels the publication schedule of any category individually scheduled using the scheduleCategory method. Any scheduled publication is either canceled or completed before this method returns.
cancelCategorySchedule cancelCategorySchedule overloads
clearDefaultSchedule If the default publication schedule has been set (using setDefaultSchedule), cancel that periodic default publication, and return 0. This method has no effect and will return a non-zero value if a default publication schedule has not been set. Any scheduled publication is either canceled or completed before this method returns.
findCategorySchedule findCategorySchedule overloads
getCategorySchedule getCategorySchedule overloads
getDefaultSchedule Load into the specified result the default scheduled interval, (set using the setDefaultSchedule method), for periodically publishing metrics, if found, and return true, or (if not found) return false with no effect.
manager manager overloads
print Print a formatted string describing the current state of this PublicationScheduler object to the specified stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, suppress all indentation AND format the entire output on one line. If stream is not valid on entry, this operation has no effect. Note that this is provided primarily for debugging purposes.
scheduleCategory scheduleCategory overloads
setDefaultSchedule Set, to the specified interval, the default interval for metrics to be periodically published using the MetricsManager supplied at construction. This method schedules every metric category not given a individual schedule (using scheduleCategory), to be published periodically until that category is either given an individual schedule, or the default schedule is canceled (using either clearDefaultSchedule or cancelAllPublications). If a default publication has already been scheduled, change its schedule to interval; any previously scheduled publication is either canceled or completed (atomically) before rescheduling. If the default publication is rescheduled with the same interval as it is currently scheduled, this operation has no effect. The behavior is undefined unless bsls::TimeInterval(0, 0) < interval. Note that, to exclude a category from any publication, clients can disable the category using the MetricsManager object supplied at construction.
operator BloombergLP::bslmf::NestedTraitDeclaration<PublicationScheduler, UsesBslmaAllocator> Declare that this type uses a bslma allocator.

Friends

NameDescription
BloombergLP::balm::PublicationScheduler_Proctordefined in implementation