Skip to content

Commit

Permalink
Atlas Cloud Watch: Adjust the firehose receiver to only publish value…
Browse files Browse the repository at this point in the history
…s that are (#422)

equal to or greater than the configured offset interval. This avoids reporting stale
data unknowingly and handling timeouts similar to the polling version. This means
the offsets must be tuned per AWS namespace (and sometimes metric).
Also incorporate the debugger.
  • Loading branch information
manolama authored Mar 20, 2023
1 parent 7c8f6e1 commit f781e21
Show file tree
Hide file tree
Showing 8 changed files with 471 additions and 145 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ class LocalCloudWatchMetricsProcessor(
registry: Registry,
rules: CloudWatchRules,
tagger: Tagger,
publishRouter: PublishRouter
publishRouter: PublishRouter,
debugger: CloudWatchDebugger
)(override implicit val system: ActorSystem)
extends CloudWatchMetricsProcessor(config, registry, rules, tagger, publishRouter) {
extends CloudWatchMetricsProcessor(config, registry, rules, tagger, publishRouter, debugger) {

// writeTS, expSec, data
private val cache = new ConcurrentHashMap[Long, (Long, Long, Array[Byte])]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ class RedisClusterCloudWatchMetricsProcessor(
jedis: JedisCluster,
leaderStatus: LeaderStatus,
rules: CloudWatchRules,
publishRouter: PublishRouter
publishRouter: PublishRouter,
debugger: CloudWatchDebugger
)(override implicit val system: ActorSystem)
extends CloudWatchMetricsProcessor(config, registry, rules, tagger, publishRouter) {
extends CloudWatchMetricsProcessor(config, registry, rules, tagger, publishRouter, debugger) {

private implicit val executionContext = system.dispatchers.lookup("redis-io-dispatcher")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ package com.netflix.atlas.spring
import akka.actor.ActorSystem
import com.netflix.atlas.akka.AkkaHttpClient
import com.netflix.atlas.akka.DefaultAkkaHttpClient
import com.netflix.atlas.cloudwatch.CloudWatchDebugger
import com.netflix.atlas.cloudwatch.CloudWatchMetricsProcessor
import com.netflix.atlas.cloudwatch.CloudWatchRules
import com.netflix.atlas.cloudwatch.NetflixTagger
import com.netflix.atlas.cloudwatch.PublishRouter
import com.netflix.atlas.cloudwatch.RedisClusterCloudWatchMetricsProcessor
import com.netflix.atlas.cloudwatch.NetflixTagger
import com.netflix.atlas.cloudwatch.Tagger
import com.netflix.iep.leader.api.LeaderStatus
import com.netflix.spectator.api.Registry
Expand All @@ -45,6 +46,10 @@ import java.util.Optional
@Configuration
class CloudWatchConfiguration extends StrictLogging {

// REPLACE With the dyn config jar include
@Bean
def getConfig: Config = ConfigFactory.load()

@Bean
def cloudWatchRules(config: Config): CloudWatchRules = new CloudWatchRules(config)

Expand Down Expand Up @@ -74,6 +79,7 @@ class CloudWatchConfiguration extends StrictLogging {
leaderStatus: LeaderStatus,
rules: CloudWatchRules,
publishRouter: PublishRouter,
debugger: CloudWatchDebugger,
system: ActorSystem
): CloudWatchMetricsProcessor = {
val r = registry.orElseGet(() => globalRegistry())
Expand All @@ -84,7 +90,8 @@ class CloudWatchConfiguration extends StrictLogging {
jedis,
leaderStatus,
rules,
publishRouter
publishRouter,
debugger
)(system)
}

Expand Down Expand Up @@ -126,4 +133,13 @@ class CloudWatchConfiguration extends StrictLogging {
poolConfig
)
}

@Bean
def debugger(
config: Config,
registry: Optional[Registry]
): CloudWatchDebugger = {
val r = registry.orElseGet(() => globalRegistry())
new CloudWatchDebugger(config, r)
}
}
1 change: 1 addition & 0 deletions atlas-cloudwatch/src/test/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ atlas {
testMode = false
categories = ${?atlas.cloudwatch.categories} [
"ut1",
"ut5",
"ut-asg",
"ut-timeout",
"ut-offset",
Expand Down
17 changes: 17 additions & 0 deletions atlas-cloudwatch/src/test/resources/test-rules.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ atlas {
]
}

ut5 = {
namespace = "AWS/UT1"
period = 5m

dimensions = [
"MyTag"
]

metrics = [
{
name = "5Min"
alias = "aws.utm.5min"
conversion = "sum,rate"
}
]
}

ut-asg = {
namespace = "AWS/UT1"
period = 1m
Expand Down
Loading

0 comments on commit f781e21

Please sign in to comment.