Package org.apache.sling.distribution.journal.shared

## Class DistributionMetricsService

- java.lang.Object
- - org.apache.sling.distribution.journal.shared.DistributionMetricsService

    public class DistributionMetricsService
    extends Object

### Nested Class Summary

Nested Classes
`class` `DistributionMetricsService.GaugeService<T>`

### Field Summary

Fields
`static String` `BASE_COMPONENT`
`static String` `PUB_COMPONENT`
`static String` `SUB_COMPONENT`

### Constructor Summary

Constructors
`DistributionMetricsService()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `activate​(org.osgi.framework.BundleContext context)`
`<T> DistributionMetricsService.GaugeService<T>` `createGauge​(String name, String description, Supplier<T> supplier)`
`org.apache.sling.commons.metrics.Meter` `getAcceptedRequests()` Meter of requests returning an `DistributionRequestState.ACCEPTED` state.
`org.apache.sling.commons.metrics.Timer` `getBuildPackageDuration()` Timer capturing the duration in ms of building a content package
`org.apache.sling.commons.metrics.Timer` `getCleanupPackageDuration()` Timer of the Package Cleanup Task execution duration.
`org.apache.sling.commons.metrics.Counter` `getCleanupPackageRemovedCount()` Counter of package removed during the Package Cleanup Task.
`org.apache.sling.commons.metrics.Meter` `getDroppedRequests()` Meter of requests returning an `DistributionRequestState.DROPPED` state.
`org.apache.sling.commons.metrics.Timer` `getEnqueuePackageDuration()` Timer capturing the duration in ms of adding a package to the queue
`org.apache.sling.commons.metrics.Histogram` `getExportedPackageSize()` Histogram of the exported content package size in Bytes.
`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` `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.Counter` `getJournalErrorCodeCount​(String errorCode)` Counter of journal error codes.
`org.apache.sling.commons.metrics.Timer` `getPackageDistributedDuration()` Timer capturing the duration in ms of distributing a distribution package.
`org.apache.sling.commons.metrics.Counter` `getPackageStatusCounter​(String 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.Counter` `getQueueAccessErrorCount()` Counter of queue access errors.
`org.apache.sling.commons.metrics.Counter` `getQueueCacheFetchCount()` Counter of fetch operations to feed the queue cache.
`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()`
`static void` `timed​(org.apache.sling.commons.metrics.Timer metric, Runnable code)` Runs provided code updating provided metric with its execution time.
`static <T> T` `timed​(org.apache.sling.commons.metrics.Timer metric, Callable<T> code)` Runs provided code updating provided metric with its execution time.

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

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

### Field Detail

#### BASE_COMPONENT

    public static final String BASE_COMPONENT

See Also:
  Constant Field Values

#### PUB_COMPONENT

    public static final String PUB_COMPONENT

See Also:
  Constant Field Values

#### SUB_COMPONENT

    public static final String SUB_COMPONENT

See Also:
  Constant Field Values

### Constructor Detail

#### DistributionMetricsService

    public DistributionMetricsService()

### Method Detail

#### activate

    public void activate​(org.osgi.framework.BundleContext context)

#### timed

    public static void timed​(org.apache.sling.commons.metrics.Timer metric,
                             Runnable code)
                      throws Exception

Runs provided code updating provided metric with its execution time. The method guarantees that the metric is updated even if the code throws an exception

Parameters:
  `metric` - metric to update
  `code` - code to clock
Throws:
  `Exception` - actually it doesn't

#### timed

    public static <T> T timed​(org.apache.sling.commons.metrics.Timer metric,
                              Callable<T> code)
                       throws Exception

Runs provided code updating provided metric with its execution time. The method guarantees that the metric is updated even if the code throws an exception

Parameters:
  `metric` - metric to update
  `code` - code to clock
Returns:
  a value returned but `code.call()` invocation
Throws:
  `Exception` - if underlying code throws

#### getCleanupPackageRemovedCount

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

Counter of package removed during the Package Cleanup Task. The count is the sum of all packages removed since the service started.

Returns:
  a Sling Metrics timer

#### getCleanupPackageDuration

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

Timer of the Package Cleanup Task execution duration.

Returns:
  a Sling Metrics timer

#### getImportedPackageSize

    public org.apache.sling.commons.metrics.Histogram getImportedPackageSize()

Histogram of the imported content package size in Byte.

Returns:
  a Sling Metrics histogram

#### getExportedPackageSize

    public org.apache.sling.commons.metrics.Histogram getExportedPackageSize()

Histogram of the exported content package size in Bytes.

Returns:
  a Sling Metrics histogram

#### getAcceptedRequests

    public org.apache.sling.commons.metrics.Meter getAcceptedRequests()

Meter of requests returning an `DistributionRequestState.ACCEPTED` state.

Returns:
  a Sling Metrics meter

#### getDroppedRequests

    public org.apache.sling.commons.metrics.Meter getDroppedRequests()

Meter of requests returning an `DistributionRequestState.DROPPED` state.

Returns:
  a Sling Metrics meter

#### 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

#### getBuildPackageDuration

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

Timer capturing the duration in ms of building a content package

Returns:
  a Sling Metric timer

#### getEnqueuePackageDuration

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

Timer capturing the duration in ms of adding a package to the queue

Returns:
  a Sling Metric timer

#### getQueueCacheFetchCount

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

Counter of fetch operations to feed the queue cache.

Returns:
  a Sling Metric counter

#### getQueueAccessErrorCount

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

Counter of queue access errors.

Returns:
  a Sling Metric counter

#### getJournalErrorCodeCount

    public org.apache.sling.commons.metrics.Counter getJournalErrorCodeCount​(String errorCode)

Counter of journal error codes.

Returns:
  a Sling Metric counter

#### getPackageStatusCounter

    public org.apache.sling.commons.metrics.Counter getPackageStatusCounter​(String status)

Counter for all the different package status.

Returns:
  a Sling Metric counter

#### createGauge

    public <T> DistributionMetricsService.GaugeService<T> createGauge​(String name,
                                                                      String description,
                                                                      Supplier<T> supplier)

#### 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()