This is an automated email from the ASF dual-hosted git repository.
bobbai00 pushed a commit to branch release/v1.1.0-incubating
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/release/v1.1.0-incubating by
this push:
new 7a17946c0d feat(agent-service, 1.1): align log-level env var with
other services (#4613)
7a17946c0d is described below
commit 7a17946c0ddb046f720b5c316f18153b92627c8a
Author: Jiadong Bai <[email protected]>
AuthorDate: Fri May 1 13:59:40 2026 -0700
feat(agent-service, 1.1): align log-level env var with other services
(#4613)
### What changes were proposed in this PR?
Backport of #4575 to `release/v1.1.0-incubating`.
### Any related issues, documentation, discussions?
See the original PR for full context:
https://github.com/apache/texera/pull/4575
### How was this PR tested?
Cherry-pick applied cleanly; same testing as the original PR.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.7)
Co-authored-by: Xinyuan Lin <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
---
agent-service/.env.example | 6 ++++++
agent-service/src/config/env.ts | 7 +++++--
agent-service/src/logger.ts | 2 +-
agent-service/src/server.test.ts | 4 ++--
agent-service/src/server.ts | 15 +++++++++------
5 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/agent-service/.env.example b/agent-service/.env.example
index de5753e7e6..605f157ca0 100644
--- a/agent-service/.env.example
+++ b/agent-service/.env.example
@@ -2,6 +2,12 @@
PORT=3001
API_PREFIX=/api
+# ERROR | WARN | INFO | DEBUG
+TEXERA_SERVICE_LOG_LEVEL=INFO
+
+# Human-readable dev logs via pino-pretty.
+LOG_PRETTY=true
+
# LLM_API_KEY authenticates this service to the gateway — NOT the
# upstream provider key (OpenAI / Anthropic / etc.), which is
# configured inside the gateway. "dummy" works when the gateway
diff --git a/agent-service/src/config/env.ts b/agent-service/src/config/env.ts
index b1e9ffc827..16a25b9be7 100644
--- a/agent-service/src/config/env.ts
+++ b/agent-service/src/config/env.ts
@@ -23,8 +23,11 @@ const EnvSchema = z.object({
PORT: z.coerce.number().default(3001),
API_PREFIX: z.string().default("/api"),
LLM_API_KEY: z.string().default("dummy"),
- LOG_LEVEL: z.enum(["fatal", "error", "warn", "info", "debug", "trace",
"silent"]).default("info"),
- LOG_PRETTY: z.coerce.boolean().default(true),
+ TEXERA_SERVICE_LOG_LEVEL: z
+ .enum(["ERROR", "WARN", "INFO", "DEBUG"])
+ .transform(v => v.toLowerCase() as "error" | "warn" | "info" | "debug")
+ .default("INFO"),
+ LOG_PRETTY: z.coerce.boolean().default(false),
TEXERA_DASHBOARD_SERVICE_ENDPOINT:
z.string().url().default("http://localhost:8080"),
LLM_ENDPOINT: z.string().url().default("http://localhost:9096"),
diff --git a/agent-service/src/logger.ts b/agent-service/src/logger.ts
index 9d06c10e59..5f1537370f 100644
--- a/agent-service/src/logger.ts
+++ b/agent-service/src/logger.ts
@@ -21,7 +21,7 @@ import pino, { type Logger } from "pino";
import { env } from "./config/env";
const rootLogger: Logger = pino({
- level: env.LOG_LEVEL,
+ level: env.TEXERA_SERVICE_LOG_LEVEL,
base: undefined,
...(env.LOG_PRETTY
? {
diff --git a/agent-service/src/server.test.ts b/agent-service/src/server.test.ts
index d31352c681..0f618e599c 100644
--- a/agent-service/src/server.test.ts
+++ b/agent-service/src/server.test.ts
@@ -64,9 +64,9 @@ beforeEach(() => {
_resetAgentStoreForTests();
});
-describe("GET /health", () => {
+describe(`GET ${API}/healthcheck`, () => {
test("returns 200 with status ok", async () => {
- const res = await getJson("/health");
+ const res = await getJson(`${API}/healthcheck`);
expect(res.status).toBe(200);
const body = await readJson<{ status: string; timestamp: string }>(res);
expect(body.status).toBe("ok");
diff --git a/agent-service/src/server.ts b/agent-service/src/server.ts
index d515931cc1..a31f9ede11 100644
--- a/agent-service/src/server.ts
+++ b/agent-service/src/server.ts
@@ -477,11 +477,14 @@ function broadcastToAgent(agentId: string, message:
WsOutgoingMessage): void {
export function buildApp() {
return new Elysia()
.use(cors())
- .get("/health", () => ({
- status: "ok",
- timestamp: new Date().toISOString(),
- }))
- .group(env.API_PREFIX, app => app.use(agentsRouter))
+ .group(env.API_PREFIX, app =>
+ app
+ .get("/healthcheck", () => ({
+ status: "ok",
+ timestamp: new Date().toISOString(),
+ }))
+ .use(agentsRouter)
+ )
.ws(`${env.API_PREFIX}/agents/:id/react`, {
open(ws) {
const agentId = (ws.data as any).params?.id;
@@ -584,7 +587,7 @@ export function buildApp() {
},
})
.onError(({ error, set }) => {
- // Catch-all for non-router routes such as /health and the websocket
route.
+ // Catch-all for non-router routes such as /api/healthcheck and the
websocket route.
log.error({ err: error }, "request error");
set.status = 500;
return { error: error instanceof Error ? error.message : String(error) };