Skip to content

Commit

Permalink
Merge branch 'improvement/BB-597-implement-PRA-metrics' into tmp/octo…
Browse files Browse the repository at this point in the history
…pus/w/8.7/improvement/BB-597-implement-PRA-metrics
  • Loading branch information
bert-e committed Aug 19, 2024
2 parents aa8cdb2 + e63e09b commit a067bcd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions extensions/lifecycle/LifecycleMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ const lifecycleDuration = ZenkoMetrics.createHistogram({
buckets: [0.2, 1, 5, 30, 120, 600, 3600, 4 * 3600, 8 * 3600, 16 * 3600, 24 * 3600],
});

// For all practical purposes, this should be a counter; but we have no garantee that the clock is
// monotonic: so this is really a gauge...
const lifecycleLastTimestamp = ZenkoMetrics.createGauge({
name: 's3_lifecycle_last_timestamp_ms',
help: 'Timestamp of the lifecycle operation',
labelNames: [LIFECYCLE_LABEL_TYPE, LIFECYCLE_LABEL_LOCATION],
});

const lifecycleKafkaPublish = {
success: ZenkoMetrics.createCounter({
name: 's3_lifecycle_kafka_publish_success_total',
Expand Down Expand Up @@ -189,6 +197,11 @@ class LifecycleMetrics {
[LIFECYCLE_LABEL_TYPE]: type,
[LIFECYCLE_LABEL_LOCATION]: location,
}, durationMs / 1000);

lifecycleLastTimestamp.observe({
[LIFECYCLE_LABEL_TYPE]: type,
[LIFECYCLE_LABEL_LOCATION]: location,
}, new Date().getTime());
} catch (err) {
LifecycleMetrics.handleError(log, err, 'LifecycleMetrics.onLifecycleCompleted');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backbeat",
"version": "8.6.46",
"version": "8.6.47",
"description": "Asynchronous queue and job manager",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a067bcd

Please sign in to comment.