Package org.apache.sling.distribution.journal.bookkeeper

# Class SubscriberMetrics

java.lang.Object
org.apache.sling.distribution.journal.bookkeeper.SubscriberMetrics

public class SubscriberMetrics extends Object
Metrics for DistributionSubscriber most metrics will have two parameters: TAG_SUB_NAME and TAG_EDITABLE

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`SUB_COMPONENT`

## Constructor Summary

Constructors
Constructor
Description
`SubscriberMetrics(org.apache.sling.commons.metrics.MetricsService metricsService, String subAgentName, String pubAgentName, boolean editable)`

## Method Summary

Modifier and Type
Method
Description
`void`
`currentImportDuration(Supplier<Long> importDurationCallback)`
`void`
`currentRetries(Supplier<Integer> retriesCallback)`
`org.apache.sling.commons.metrics.Counter`
`getBlockingImportErrors()`
`Supplier<Long>`
`getCurrentImportDurationCallback()`
For testing
`org.apache.sling.commons.metrics.Meter`
`getFailedPackageImports()`
Meter of failures to import packages.
`org.apache.sling.commons.metrics.Timer`
`getImportedPackageDuration()`
Timer capturing the duration in ms of successful packages import operations.
`org.apache.sling.commons.metrics.Histogram`
`getImportedPackageSize()`
Histogram of the imported content package size in Byte.
`org.apache.sling.commons.metrics.Timer`
`getImportPostProcessDuration()`
`org.apache.sling.commons.metrics.Counter`
`getImportPostProcessRequest()`
`org.apache.sling.commons.metrics.Counter`
`getImportPostProcessSuccess()`
`org.apache.sling.commons.metrics.Timer`
`getImportPreProcessDuration()`
`org.apache.sling.commons.metrics.Counter`
`getImportPreProcessRequest()`
`org.apache.sling.commons.metrics.Counter`
`getImportPreProcessSuccess()`
`org.apache.sling.commons.metrics.Timer`
`getInvalidationProcessDuration()`
`org.apache.sling.commons.metrics.Counter`
`getInvalidationProcessRequest()`
`org.apache.sling.commons.metrics.Counter`
`getInvalidationProcessSuccess()`
`org.apache.sling.commons.metrics.Counter`
`getItemsBufferSize()`
Counter of the package buffer size on the subscriber.
`org.apache.sling.commons.metrics.Timer`
`getPackageDistributedDuration()`
Timer capturing the duration in ms of distributing a distribution package.
`org.apache.sling.commons.metrics.Timer`
`getPackageJournalDistributionDuration()`
Timer capturing the duration in ms that a package spent in the distribution journal.
`org.apache.sling.commons.metrics.Counter`
`getPackageStatusCounter(String pubAgentName, org.apache.sling.distribution.journal.messages.PackageStatusMessage.Status status)`
Counter for all the different package status.
`org.apache.sling.commons.metrics.Counter`
`getPermanentImportErrors()`
`org.apache.sling.commons.metrics.Timer`
`getProcessQueueItemDuration()`
Timer capturing the duration in ms of processing a queue item.
`org.apache.sling.commons.metrics.Timer`
`getRemovedFailedPackageDuration()`
Timer capturing the duration in ms of packages successfully removed automatically from a subscriber supporting error queue.
`org.apache.sling.commons.metrics.Timer`
`getRemovedPackageDuration()`
Timer capturing the duration in ms of packages successfully removed from an editable subscriber.
`org.apache.sling.commons.metrics.Timer`
`getSendStoredStatusDuration()`
Timer capturing the duration in ms of sending a stored package status.
`org.apache.sling.commons.metrics.Counter`
`getTransientImportErrors()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### SUB_COMPONENT

public static final String SUB_COMPONENT

See Also:
  - Constant Field Values

## Constructor Details

### SubscriberMetrics

public SubscriberMetrics(org.apache.sling.commons.metrics.MetricsService metricsService, String subAgentName, String pubAgentName, boolean editable)

## Method Details

### getImportedPackageSize

public org.apache.sling.commons.metrics.Histogram getImportedPackageSize()
Histogram of the imported content package size in Byte.

Returns:
  a Sling Metrics histogram

### getItemsBufferSize

public org.apache.sling.commons.metrics.Counter getItemsBufferSize()
Counter of the package buffer size on the subscriber.

Returns:
  a Sling Metrics counter

### getImportedPackageDuration

public org.apache.sling.commons.metrics.Timer getImportedPackageDuration()
Timer capturing the duration in ms of successful packages import operations.

Returns:
  a Sling Metrics timer

### getRemovedPackageDuration

public org.apache.sling.commons.metrics.Timer getRemovedPackageDuration()
Timer capturing the duration in ms of packages successfully removed from an editable subscriber.

Returns:
  a Sling Metrics timer

### getRemovedFailedPackageDuration

public org.apache.sling.commons.metrics.Timer getRemovedFailedPackageDuration()
Timer capturing the duration in ms of packages successfully removed automatically from a subscriber supporting error queue.

Returns:
  a Sling Metrics timer

### getFailedPackageImports

public org.apache.sling.commons.metrics.Meter getFailedPackageImports()
Meter of failures to import packages.

Returns:
  a Sling Metrics meter

### getSendStoredStatusDuration

public org.apache.sling.commons.metrics.Timer getSendStoredStatusDuration()
Timer capturing the duration in ms of sending a stored package status.

Returns:
  a Sling Metric timer

### getProcessQueueItemDuration

public org.apache.sling.commons.metrics.Timer getProcessQueueItemDuration()
Timer capturing the duration in ms of processing a queue item.

Returns:
  a Sling Metric timer

### getPackageDistributedDuration

public org.apache.sling.commons.metrics.Timer getPackageDistributedDuration()
Timer capturing the duration in ms of distributing a distribution package. The timer starts when the package is enqueued and stops when the package is successfully imported.

Returns:
  a Sling Metric timer

### getPackageJournalDistributionDuration

public org.apache.sling.commons.metrics.Timer getPackageJournalDistributionDuration()
Timer capturing the duration in ms that a package spent in the distribution journal. The timer starts when the package is enqueued and stops when the package is consumed.

Returns:
  a Sling Metrics timer

### getPackageStatusCounter

public org.apache.sling.commons.metrics.Counter getPackageStatusCounter(String pubAgentName, org.apache.sling.distribution.journal.messages.PackageStatusMessage.Status status)
Counter for all the different package status.

Parameters:
  `pubAgentName` - name of publish agent
  `status` - after package import
Returns:
  a Sling Metric counter

### getImportPreProcessDuration

public org.apache.sling.commons.metrics.Timer getImportPreProcessDuration()

### getImportPreProcessSuccess

public org.apache.sling.commons.metrics.Counter getImportPreProcessSuccess()

### getImportPreProcessRequest

public org.apache.sling.commons.metrics.Counter getImportPreProcessRequest()

### getImportPostProcessDuration

public org.apache.sling.commons.metrics.Timer getImportPostProcessDuration()

### getImportPostProcessSuccess

public org.apache.sling.commons.metrics.Counter getImportPostProcessSuccess()

### getImportPostProcessRequest

public org.apache.sling.commons.metrics.Counter getImportPostProcessRequest()

### getInvalidationProcessDuration

public org.apache.sling.commons.metrics.Timer getInvalidationProcessDuration()

### getInvalidationProcessSuccess

public org.apache.sling.commons.metrics.Counter getInvalidationProcessSuccess()

### getInvalidationProcessRequest

public org.apache.sling.commons.metrics.Counter getInvalidationProcessRequest()

### getTransientImportErrors

public org.apache.sling.commons.metrics.Counter getTransientImportErrors()

### getPermanentImportErrors

public org.apache.sling.commons.metrics.Counter getPermanentImportErrors()

### getBlockingImportErrors

public org.apache.sling.commons.metrics.Counter getBlockingImportErrors()

### currentRetries

public void currentRetries(Supplier<Integer> retriesCallback)

### currentImportDuration

public void currentImportDuration(Supplier<Long> importDurationCallback)

### getCurrentImportDurationCallback

public Supplier<Long> getCurrentImportDurationCallback()
For testing

Returns:
  callback