Skip to content

Commit

Permalink
correcting for shared akka actor name
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyKilmory committed Nov 4, 2024
1 parent fa16342 commit 796269c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import java.util.Date
import scala.collection.JavaConverters._
import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.duration.{DurationInt, FiniteDuration}
import scala.util.Random

trait Metric[A] {
def recordOne(value: A, dimensions: List[Dimension] = Nil): Unit
Expand Down Expand Up @@ -45,7 +46,9 @@ abstract class CloudWatchMetrics(

private val client: AmazonCloudWatch = config.withAWSCredentials(AmazonCloudWatchClientBuilder.standard()).build()

private[CloudWatchMetrics] val metricsActor = actorSystem.actorOf(MetricsActor.props(namespace, client), "metricsactor")
private val random = new Random()

private[CloudWatchMetrics] val metricsActor = actorSystem.actorOf(MetricsActor.props(namespace, client), s"metricsactor-${random.alphanumeric.take(8).mkString}")

applicationLifecycle.addStopHook(() => (metricsActor ? MetricsActor.Shutdown)(Timeout(5.seconds)))

Expand Down

0 comments on commit 796269c

Please sign in to comment.