Skip to content

Commit

Permalink
atlas cloudwatch: Add some padding for high resolution polling (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
manolama authored Jan 28, 2025
1 parent 480e6cf commit aa13c5e
Showing 1 changed file with 28 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class CloudWatchPoller(
registry
.counter(hrmRequest.withTags("period", category.period.toString))
.increment()
start = now.minusSeconds(1)
start = now.minusSeconds(2 * category.period)
}
val request = MetricMetadata(category, definition, metric.dimensions.asScala.toList)
.toGetRequest(start, now)
Expand All @@ -430,22 +430,35 @@ class CloudWatchPoller(
)
}

response
.datapoints()
.asScala
.foreach { dp =>
val firehoseMetric = FirehoseMetric(
"",
metric.namespace(),
metric.metricName(),
dimensions.toList,
dp
)
if (category.period < 60) {
if (category.period < 60) {
response
.datapoints()
.asScala
.lastOption
.map { dp =>
val firehoseMetric = FirehoseMetric(
"",
metric.namespace(),
metric.metricName(),
dimensions.toList,
dp
)
val metaData = MetricMetadata(category, definition, toAWSDimensions(firehoseMetric))
registry.counter(polledPublishPath.withTag("path", "registry")).increment()
processor.sendToRegistry(metaData, firehoseMetric, nowMillis)
} else {
}
} else {
response
.datapoints()
.asScala
.foreach { dp =>
val firehoseMetric = FirehoseMetric(
"",
metric.namespace(),
metric.metricName(),
dimensions.toList,
dp
)
registry.counter(polledPublishPath.withTag("path", "cache")).increment()
processor.updateCache(firehoseMetric, category, nowMillis).onComplete {
case Success(_) =>
Expand All @@ -454,7 +467,7 @@ class CloudWatchPoller(
logger.error(s"Cache update failed: ${ex.getMessage}")
}
}
}
}
got.incrementAndGet()
promise.success(Done)
} catch {
Expand Down

0 comments on commit aa13c5e

Please sign in to comment.