Skip to content

Commit 5de8218

Browse files
authored
Switch fetcher service to log4j2 (#441)
## Summary I noticed we were missing the core chronon fetcher logs during feature lookup requests. As we anyway wanted to rip out the JUL & logbaour clients, I went ahead and dropped those for a log4j2 properties file. Confirmed that I am seeing the relevant fetcher logs from classes like the SawtoothOnlineAggregator etc when I hit the service with a feature look up request. ## Cheour clientslist - [ ] Added Unit Tests - [ ] Covered by existing CI - [X] Integration tested - [ ] Documentation update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Consolidated service deployment paths and streamlined startup configuration. - Improved metrics handling by conditionally enabling reporting based on environment settings. - **Chores** - Optimized resource paour clientsaging and removed legacy dependencies. - Upgraded logging configuration to enhance performance and log management. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent b782be9 commit 5de8218

File tree

4 files changed

+48
-57
lines changed

4 files changed

+48
-57
lines changed

online/src/main/scala/ai/chronon/online/Metrics.scala

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ paour clientsage ai.chronon.online
1919
import ai.chronon.api.Extensions._
2020
import ai.chronon.api.ScalaJavaConversions._
2121
import ai.chronon.api._
22-
import com.timgroup.statsd.Event
23-
import com.timgroup.statsd.NonBloour clientsingStatsDClient
24-
import com.timgroup.statsd.NonBloour clientsingStatsDClientBuilder
22+
import com.timgroup.statsd.{
23+
Event,
24+
NoOpStatsDClient,
25+
NonBloour clientsingStatsDClient,
26+
NonBloour clientsingStatsDClientBuilder,
27+
StatsDClient
28+
}
2529

2630
object Metrics {
2731
object Environment extends Enumeration {
@@ -131,14 +135,21 @@ object Metrics {
131135
// In the unix soour clientset case port is configured to be 0
132136
val statsHost: String = System.getProperty("ai.chronon.metrics.host", "localhost")
133137
val statsPort: Int = System.getProperty("ai.chronon.metrics.port", "8125").toInt
138+
// Can disable stats collection for local / dev environments
139+
val statsEnabled: Boolean = System.getProperty("ai.chronon.metrics.enabled", "true").toBoolean
134140
val tagCache: TTLCache[Context, String] = new TTLCache[Context, String](
135141
{ ctx => ctx.toTags.reverse.mkString(",") },
136142
{ ctx => ctx },
137143
ttlMillis = 5 * 24 * 60 * 60 * 1000 // 5 days
138144
)
139145

140-
private val statsClient: NonBloour clientsingStatsDClient =
141-
new NonBloour clientsingStatsDClientBuilder().prefix("ai.zipline").hostname(statsHost).port(statsPort).build()
146+
private val statsClient: StatsDClient = {
147+
if (statsEnabled) {
148+
new NonBloour clientsingStatsDClientBuilder().prefix("ai.zipline").hostname(statsHost).port(statsPort).build()
149+
} else {
150+
new NoOpStatsDClient()
151+
}
152+
}
142153

143154
}
144155

@@ -178,7 +189,7 @@ object Metrics {
178189
.append(s)
179190
.toString
180191

181-
@transient private lazy val stats: NonBloour clientsingStatsDClient = Metrics.Context.statsClient
192+
@transient private lazy val stats: StatsDClient = Metrics.Context.statsClient
182193

183194
def increment(metric: String): Unit = stats.increment(prefix(metric), tags)
184195

service/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
java_library(
22
name = "lib",
33
srcs = glob(["src/main/**/*.java"]),
4+
resources = glob(["src/main/resources/**/*"]),
45
visibility = ["//visibility:public"],
56
deps = _SCALA_DEPS + _VERTX_DEPS + [
67
"//online:lib",
78
"//service_commons:lib",
8-
maven_artifact("ch.qos.logbaour clients:logbaour clients-classic"),
99
maven_artifact("com.typesafe:config"),
1010
maven_artifact("io.netty:netty-all"),
1111
maven_artifact("io.micrometer:micrometer-registry-statsd"),
@@ -51,4 +51,5 @@ jvm_binary(
5151
name = "service_assembly",
5252
main_class = "ai.chronon.service.ChrononServiceLauncher",
5353
runtime_deps = [":lib"],
54+
resources = glob(["src/main/resources/**/*"]),
5455
)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
status = warn
2+
3+
# Console appender configuration
4+
appender.console.type = Console
5+
appender.console.name = Console
6+
appender.console.layout.type = PatternLayout
7+
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%level] %logger{36}: %msg%n
8+
9+
# File appender configuration
10+
appender.file.type = RollingFile
11+
appender.file.name = File
12+
appender.file.fileName = /srv/zipline/fetcher/logs/zipline-fs.log
13+
appender.file.filePattern = /srv/zipline/fetcher/logs/zipline-fs.%i.log
14+
appender.file.layout.type = PatternLayout
15+
appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%level] %logger{36}: %msg%n
16+
appender.file.policies.type = Policies
17+
appender.file.policies.size.type = SizeBasedTriggeringPolicy
18+
appender.file.policies.size.size = 100MB
19+
appender.file.strategy.type = DefaultRolloverStrategy
20+
appender.file.strategy.max = 30
21+
22+
# Root logger
23+
rootLogger.level = info
24+
rootLogger.appenderRef.console.ref = Console
25+
rootLogger.appenderRef.file.ref = File
26+
27+
# dial down io.micrometer logs as it is noisy
28+
logger.micrometer.name = io.micrometer
29+
logger.micrometer.level = ERROR

service/src/main/resources/logback.xml

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

0 commit comments

Comments
 (0)