Skip to content

Commit c2a8f19

Browse files
authored
Merge pull request #28323 from guardian/delete-more-unused-code
Delete more unused / non-working code
2 parents 13175da + b6b4230 commit c2a8f19

File tree

8 files changed

+2
-141
lines changed

8 files changed

+2
-141
lines changed

admin/app/AppLoader.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ trait AdminServices extends I18nComponents {
3939
lazy val emailService = wire[EmailService]
4040
lazy val redirects = wire[RedirectService]
4141
lazy val r2PagePressJob = wire[R2PagePressJob]
42-
lazy val analyticsSanityCheckJob = wire[AnalyticsSanityCheckJob]
4342
lazy val rebuildIndexJob = wire[RebuildIndexJob]
4443

4544
lazy val blockingOperations: BlockingOperations = wire[BlockingOperations]

admin/app/jobs/AnalyticsSanityCheckJob.scala

Lines changed: 0 additions & 61 deletions
This file was deleted.

admin/app/model/AdminLifecycle.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class AdminLifecycle(
2222
pekkoAsync: PekkoAsync,
2323
emailService: EmailService,
2424
r2PagePressJob: R2PagePressJob,
25-
analyticsSanityCheckJob: AnalyticsSanityCheckJob,
2625
rebuildIndexJob: RebuildIndexJob,
2726
)(implicit ec: ExecutionContext)
2827
extends LifecycleComponent
@@ -33,7 +32,6 @@ class AdminLifecycle(
3332
descheduleJobs()
3433
CloudWatch.shutdown()
3534
emailService.shutdown()
36-
// deleteTmpFiles()
3735
}
3836
}
3937

@@ -59,11 +57,6 @@ class AdminLifecycle(
5957
r2PagePressJob.run()
6058
}
6159

62-
// every 2, 17, 32, 47 minutes past the hour, on the 12th second past the minute (e.g 13:02:12, 13:17:12)
63-
jobs.schedule("AnalyticsSanityCheckJob", "12 2/15 * * * ?") {
64-
analyticsSanityCheckJob.run()
65-
}
66-
6760
jobs.scheduleEveryNMinutes("FrontPressJobHighFrequency", adminPressJobHighPushRateInMinutes) {
6861
if (FrontPressJobSwitch.isSwitchedOn) RefreshFrontsJob.runFrequency(pekkoAsync)(HighFrequency)
6962
Future.successful(())

archive/app/AppLoader.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import play.api.http.{HttpErrorHandler, HttpRequestHandler}
1414
import play.api.libs.ws.WSClient
1515
import play.api.mvc.EssentialFilter
1616
import play.api.routing.Router
17-
import services.{ArchiveMetrics, RedirectService}
17+
import services.RedirectService
1818
import router.Routes
1919

2020
class AppLoader extends FrontendApplicationLoader {
@@ -33,7 +33,6 @@ trait AppComponents extends FrontendComponents {
3333

3434
override lazy val lifecycleComponents = List(
3535
wire[CloudWatchMetricsLifecycle],
36-
wire[ArchiveMetrics],
3736
wire[SwitchboardLifecycle],
3837
wire[CachedHealthCheckLifeCycle],
3938
)

archive/app/controllers/ArchiveController.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import commercial.campaigns.ShortCampaignCodes
44
import common._
55
import model.Cached.{CacheableResult, WithoutRevalidationResult}
66
import play.api.mvc._
7-
import services.{GoogleBotMetric, RedirectService}
7+
import services.RedirectService
88
import java.net.URLDecoder
99
import javax.ws.rs.core.UriBuilder
1010

archive/app/services/ArchiveMetrics.scala

Lines changed: 0 additions & 36 deletions
This file was deleted.

common/app/common/metrics.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,6 @@ object SystemMetrics extends implicits.Numbers {
5050
get = () => bytesAsMb(ManagementFactory.getMemoryMXBean.getHeapMemoryUsage.getUsed),
5151
)
5252

53-
val MaxNonHeapMemoryMetric = GaugeMetric(
54-
name = "max-non-heap-memory",
55-
description = "Max non heap memory (MB)",
56-
get = () => bytesAsMb(ManagementFactory.getMemoryMXBean.getNonHeapMemoryUsage.getMax),
57-
)
58-
59-
val UsedNonHeapMemoryMetric = GaugeMetric(
60-
name = "used-non-heap-memory",
61-
description = "Used non heap memory (MB)",
62-
get = () => bytesAsMb(ManagementFactory.getMemoryMXBean.getNonHeapMemoryUsage.getUsed),
63-
)
64-
6553
val FreeDiskSpaceMetric = GaugeMetric(
6654
name = "free-disk-space",
6755
description = "Free disk space (MB)",

common/app/metrics/FrontendMetrics.scala

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,6 @@ final case class SimpleMetric(override val name: String, datapoint: SimpleDataPo
4242
override val isEmpty = false
4343
}
4444

45-
// MetricUploader is a class to allow basic putting of metrics. Why does it exist? Because if we provide
46-
// access to cloudwatch directly, then we start to measure everything, and never remove unused metrics.
47-
// Also, MetricUploader will upload in batches.
48-
final case class MetricUploader(namespace: String) {
49-
50-
private val datapoints: Box[List[SimpleMetric]] = Box(List.empty)
51-
52-
def put(metrics: Map[String, Double]): Unit = {
53-
val timedMetrics = metrics.map { case (key, value) =>
54-
SimpleMetric(name = key, SimpleDataPoint(value, DateTime.now))
55-
}
56-
datapoints.send(_ ++ timedMetrics)
57-
}
58-
59-
def upload(): Unit = {
60-
val points = datapoints.get()
61-
datapoints.alter(_.diff(points))
62-
CloudWatch.putMetrics(namespace, points, List.empty)
63-
}
64-
}
65-
6645
case class TimingDataPoint(value: Double, time: Option[DateTime] = None) extends DataPoint
6746

6847
final case class TimingMetric(override val name: String, description: String) extends FrontendMetric {

0 commit comments

Comments
 (0)