Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atlas cloudwatch: Cache the last timestamp of a high res poll. #621

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ class CloudWatchPoller(
private[cloudwatch] val awsRequestLimit =
config.getInt("atlas.cloudwatch.account.polling.requestLimit")

private[cloudwatch] val highResTimeCache = new ConcurrentHashMap[Long, Long]()

{
// Scheduling Pollers Based on Offset
offsetMap.foreach {
Expand Down Expand Up @@ -420,17 +422,7 @@ class CloudWatchPoller(

if (response.datapoints().isEmpty) {
debugger.debugPolled(metric, IncomingMatch.DroppedEmpty, nowMillis, category)
} else {
debugger.debugPolled(
metric,
IncomingMatch.Accepted,
nowMillis,
category,
response.datapoints()
)
}

if (category.period < 60) {
} else if (category.period < 60) {
response
.datapoints()
.asScala
Expand All @@ -443,11 +435,41 @@ class CloudWatchPoller(
dimensions.toList,
dp
)
val metaData = MetricMetadata(category, definition, toAWSDimensions(firehoseMetric))
registry.counter(polledPublishPath.withTag("path", "registry")).increment()
processor.sendToRegistry(metaData, firehoseMetric, nowMillis)

val prev = highResTimeCache.getOrDefault(firehoseMetric.xxHash, 0)
if (dp.timestamp().toEpochMilli > prev) {
highResTimeCache.put(firehoseMetric.xxHash, dp.timestamp().toEpochMilli)
debugger.debugPolled(
metric,
IncomingMatch.Accepted,
nowMillis,
category,
response.datapoints()
)

val metaData =
MetricMetadata(category, definition, toAWSDimensions(firehoseMetric))
registry.counter(polledPublishPath.withTag("path", "registry")).increment()
processor.sendToRegistry(metaData, firehoseMetric, nowMillis)
} else {
debugger.debugPolled(
metric,
IncomingMatch.DroppedEmpty,
nowMillis,
category,
response.datapoints()
)
}
}
} else {
debugger.debugPolled(
metric,
IncomingMatch.Accepted,
nowMillis,
category,
response.datapoints()
)

response
.datapoints()
.asScala
Expand Down