From a86686499da478cecbf65286efda1f6ab54ea7cf Mon Sep 17 00:00:00 2001 From: Kavita Narang Date: Thu, 23 Jul 2026 12:33:08 -0700 Subject: [PATCH 1/5] test(deploy): add SGLang JSON logging coverage Signed-off-by: Kavita Narang --- .github/workflows/post-merge-ci.yml | 2 +- .github/workflows/pr.yaml | 2 +- tests/deploy/test_deploy.py | 38 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/post-merge-ci.yml b/.github/workflows/post-merge-ci.yml index cd6bf4f83215..14d74bd7b004 100644 --- a/.github/workflows/post-merge-ci.yml +++ b/.github/workflows/post-merge-ci.yml @@ -876,7 +876,7 @@ jobs: uses: ./.github/workflows/shared-deploy-test.yml with: framework: sglang - profiles: '["agg", "agg_router"]' + profiles: '["agg", "agg_logging", "agg_router"]' image_suffix: sglang-runtime namespace: ${{ needs.deploy-operator.outputs.namespace }} vcluster_name: ${{ needs.deploy-operator.outputs.vcluster_name }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index ea49fac258ed..8721aa261fac 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1086,7 +1086,7 @@ jobs: uses: ./.github/workflows/shared-deploy-test.yml with: framework: sglang - profiles: '["agg", "agg_router"]' + profiles: '["agg", "agg_logging", "agg_router"]' image_suffix: sglang-runtime namespace: ${{ needs.deploy-operator.outputs.namespace }} vcluster_name: ${{ needs.deploy-operator.outputs.vcluster_name }} diff --git a/tests/deploy/test_deploy.py b/tests/deploy/test_deploy.py index 29961d055f4c..1714b932ebd2 100644 --- a/tests/deploy/test_deploy.py +++ b/tests/deploy/test_deploy.py @@ -8,6 +8,7 @@ to chat completion requests correctly. """ +import json import logging import os import subprocess @@ -48,6 +49,24 @@ # This matches the validation threshold from the original shell-based deployment tests. MIN_RESPONSE_CONTENT_LENGTH = 100 GAIE_MODEL_NAME = "Qwen/Qwen3-0.6B" +JSON_LOG_REQUIRED_FIELDS = frozenset({"time", "level", "target", "message"}) + + +def find_structured_json_log(log_lines: Any) -> Dict[str, Any] | None: + """Return the first Dynamo JSONL record with the documented core fields.""" + if isinstance(log_lines, str): + log_lines = log_lines.splitlines() + + for line in log_lines: + try: + record = json.loads(line) + except (json.JSONDecodeError, TypeError): + continue + + if isinstance(record, dict) and JSON_LOG_REQUIRED_FIELDS.issubset(record): + return record + + return None def validate_chat_response( @@ -168,6 +187,12 @@ async def test_deployment( f"{framework}/{profile}" ) + if profile == "agg_logging": + logging_config = deployment_spec.get_logging_config() + assert logging_config[ + "jsonl_enabled" + ], "The agg_logging deployment profile must enable DYN_LOGGING_JSONL" + logger.info( f"Starting deployment test for {deployment_target.test_id} " f"(source: {deployment_target.source}, model: {model}, namespace: {namespace})" @@ -236,6 +261,19 @@ async def test_deployment( min_content_length=MIN_RESPONSE_CONTENT_LENGTH, ) + if profile == "agg_logging": + frontend_logs = frontend_pod.logs(container="main") + json_log_record = find_structured_json_log(frontend_logs) + assert json_log_record is not None, ( + "The agg_logging deployment served inference but the frontend " + "did not emit a structured Dynamo JSONL record" + ) + logger.info( + "Validated structured JSON logging: target=%s message=%s", + json_log_record["target"], + json_log_record["message"], + ) + logger.info( f"Deployment test PASSED for {deployment_target.test_id} " f"(source: {deployment_target.source}, model: {model}, namespace: {namespace})" From be5e9f1c14835356bff977f376fef66f8bb64217 Mon Sep 17 00:00:00 2001 From: Kavita Narang Date: Thu, 23 Jul 2026 14:36:02 -0700 Subject: [PATCH 2/5] ci: move SGLang JSON logging coverage post-merge Signed-off-by: Kavita Narang --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 8721aa261fac..ea49fac258ed 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1086,7 +1086,7 @@ jobs: uses: ./.github/workflows/shared-deploy-test.yml with: framework: sglang - profiles: '["agg", "agg_logging", "agg_router"]' + profiles: '["agg", "agg_router"]' image_suffix: sglang-runtime namespace: ${{ needs.deploy-operator.outputs.namespace }} vcluster_name: ${{ needs.deploy-operator.outputs.vcluster_name }} From 84b377396f2a9370f86d521d1844ee5d11d08208 Mon Sep 17 00:00:00 2001 From: Kavita Narang Date: Tue, 28 Jul 2026 13:03:20 -0700 Subject: [PATCH 3/5] test(deploy): address logging review feedback Signed-off-by: Kavita Narang --- .../backends/sglang/deploy/agg_logging.yaml | 4 +- .../sglang/deploy/v1beta1/agg_logging.yaml | 2 +- tests/deploy/test_deploy.py | 62 +++++++++++++------ 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/examples/backends/sglang/deploy/agg_logging.yaml b/examples/backends/sglang/deploy/agg_logging.yaml index 161b25291fb4..c1894da1695e 100644 --- a/examples/backends/sglang/deploy/agg_logging.yaml +++ b/examples/backends/sglang/deploy/agg_logging.yaml @@ -4,7 +4,7 @@ apiVersion: nvidia.com/v1alpha1 kind: DynamoGraphDeployment metadata: - name: sglang-agg + name: sglang-agg-logging spec: envs: - name: DYN_LOGGING_JSONL @@ -41,4 +41,4 @@ spec: - --tp - "1" - --trust-remote-code - - --skip-tokenizer-init \ No newline at end of file + - --skip-tokenizer-init diff --git a/examples/backends/sglang/deploy/v1beta1/agg_logging.yaml b/examples/backends/sglang/deploy/v1beta1/agg_logging.yaml index 44ba27835532..7d3c9c9a9e24 100644 --- a/examples/backends/sglang/deploy/v1beta1/agg_logging.yaml +++ b/examples/backends/sglang/deploy/v1beta1/agg_logging.yaml @@ -4,7 +4,7 @@ apiVersion: nvidia.com/v1beta1 kind: DynamoGraphDeployment metadata: - name: sglang-agg + name: sglang-agg-logging spec: components: - name: Frontend diff --git a/tests/deploy/test_deploy.py b/tests/deploy/test_deploy.py index 1714b932ebd2..a1aa62cce85d 100644 --- a/tests/deploy/test_deploy.py +++ b/tests/deploy/test_deploy.py @@ -52,11 +52,15 @@ JSON_LOG_REQUIRED_FIELDS = frozenset({"time", "level", "target", "message"}) -def find_structured_json_log(log_lines: Any) -> Dict[str, Any] | None: - """Return the first Dynamo JSONL record with the documented core fields.""" +def normalize_log_lines(log_lines: Any) -> list[str]: + """Return pod logs as a reusable list of lines.""" if isinstance(log_lines, str): - log_lines = log_lines.splitlines() + return log_lines.splitlines() + return list(log_lines) + +def find_structured_json_log(log_lines: list[str]) -> Dict[str, Any] | None: + """Return the first Dynamo JSONL record with the documented core fields.""" for line in log_lines: try: record = json.loads(line) @@ -69,6 +73,31 @@ def find_structured_json_log(log_lines: Any) -> Dict[str, Any] | None: return None +def validate_agg_logging_configuration(deployment_spec: DeploymentSpec) -> None: + """Verify that the logging profile enables structured JSONL output.""" + logging_config = deployment_spec.get_logging_config() + if not logging_config["jsonl_enabled"]: + pytest.fail("The agg_logging deployment profile must enable DYN_LOGGING_JSONL") + + +def validate_agg_logging_output(frontend_pod: Any, baseline_line_count: int) -> None: + """Verify that inference emitted a new structured frontend log record.""" + frontend_log_lines = normalize_log_lines(frontend_pod.logs(container="main")) + new_log_lines = frontend_log_lines[baseline_line_count:] + json_log_record = find_structured_json_log(new_log_lines) + if json_log_record is None: + pytest.fail( + "The agg_logging deployment served inference but the frontend " + "did not emit a new structured Dynamo JSONL record" + ) + + logger.info( + "Validated structured JSON logging: target=%s message=%s", + json_log_record["target"], + json_log_record["message"], + ) + + def validate_chat_response( response: requests.Response, expected_model: str, @@ -163,6 +192,7 @@ async def test_deployment( # Extract identifying information from the target framework = deployment_target.framework profile = deployment_target.profile + validate_agg_logging = profile == "agg_logging" # NIXL_ERR_BACKEND: vCluster CI nodes lack RDMA/UCX for inter-pod KV # transfer. Prefill workers crash in NixlWrapper.create_backend. @@ -187,11 +217,8 @@ async def test_deployment( f"{framework}/{profile}" ) - if profile == "agg_logging": - logging_config = deployment_spec.get_logging_config() - assert logging_config[ - "jsonl_enabled" - ], "The agg_logging deployment profile must enable DYN_LOGGING_JSONL" + if validate_agg_logging: + validate_agg_logging_configuration(deployment_spec) logger.info( f"Starting deployment test for {deployment_target.test_id} " @@ -250,6 +277,11 @@ async def test_deployment( "temperature": DEFAULT_TEMPERATURE, "stream": False, } + frontend_log_baseline = ( + len(normalize_log_lines(frontend_pod.logs(container="main"))) + if validate_agg_logging + else 0 + ) response = send_request( url, payload, timeout=float(DEFAULT_REQUEST_TIMEOUT), method="POST" ) @@ -261,18 +293,8 @@ async def test_deployment( min_content_length=MIN_RESPONSE_CONTENT_LENGTH, ) - if profile == "agg_logging": - frontend_logs = frontend_pod.logs(container="main") - json_log_record = find_structured_json_log(frontend_logs) - assert json_log_record is not None, ( - "The agg_logging deployment served inference but the frontend " - "did not emit a structured Dynamo JSONL record" - ) - logger.info( - "Validated structured JSON logging: target=%s message=%s", - json_log_record["target"], - json_log_record["message"], - ) + if validate_agg_logging: + validate_agg_logging_output(frontend_pod, frontend_log_baseline) logger.info( f"Deployment test PASSED for {deployment_target.test_id} " From c7b7e27cd70d086a66d3f89c994498f19bddb523 Mon Sep 17 00:00:00 2001 From: Kavita Narang Date: Mon, 3 Aug 2026 12:38:43 -0700 Subject: [PATCH 4/5] ci: add logging profile to nightly deploy Signed-off-by: Kavita Narang --- .github/workflows/nightly-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml index eb7c2ce90f36..ee9f2e827b60 100644 --- a/.github/workflows/nightly-ci.yml +++ b/.github/workflows/nightly-ci.yml @@ -611,7 +611,7 @@ jobs: with: framework: vllm profiles: '["agg"]' - image_suffix: ${{ format('{0}-nightly', needs.vllm-build.outputs.target_tag_plain) }} + image_tag: ${{ format('{0}-nightly', needs.vllm-build.outputs.target_tag_plain) }} namespace: ${{ needs.deploy-operator.outputs.namespace }} vcluster_name: ${{ needs.deploy-operator.outputs.vcluster_name }} operator_tag: ${{ needs.deploy-operator.outputs.operator_tag }} @@ -624,8 +624,8 @@ jobs: uses: ./.github/workflows/shared-deploy-test.yml with: framework: sglang - profiles: '["agg"]' - image_suffix: ${{ format('{0}-nightly', needs.sglang-build.outputs.target_tag_plain) }} + profiles: '["agg", "agg_logging"]' + image_tag: ${{ format('{0}-nightly', needs.sglang-build.outputs.target_tag_plain) }} namespace: ${{ needs.deploy-operator.outputs.namespace }} vcluster_name: ${{ needs.deploy-operator.outputs.vcluster_name }} operator_tag: ${{ needs.deploy-operator.outputs.operator_tag }} @@ -639,7 +639,7 @@ jobs: with: framework: trtllm profiles: '["agg"]' - image_suffix: ${{ format('{0}-nightly', needs.trtllm-build.outputs.target_tag_plain) }} + image_tag: ${{ format('{0}-nightly', needs.trtllm-build.outputs.target_tag_plain) }} namespace: ${{ needs.deploy-operator.outputs.namespace }} vcluster_name: ${{ needs.deploy-operator.outputs.vcluster_name }} operator_tag: ${{ needs.deploy-operator.outputs.operator_tag }} From c711b147845ec2275dfa781410f6d2d657999746 Mon Sep 17 00:00:00 2001 From: Kavita Narang Date: Mon, 24 Aug 2026 16:02:43 -0700 Subject: [PATCH 5/5] test(deploy): use v1beta1 logging coverage Signed-off-by: Kavita Narang --- tests/deploy/dgd_utils.py | 16 +++++++--------- tests/deploy/test_dgd_utils.py | 32 -------------------------------- 2 files changed, 7 insertions(+), 41 deletions(-) diff --git a/tests/deploy/dgd_utils.py b/tests/deploy/dgd_utils.py index 2cd5ad7c7205..c7c1f6fbe350 100644 --- a/tests/deploy/dgd_utils.py +++ b/tests/deploy/dgd_utils.py @@ -546,24 +546,22 @@ def set_logging(self, enable_jsonl: bool = True, log_level: str = "debug"): enable_jsonl: Enable JSON line logging (sets DYN_LOGGING_JSONL=true) log_level: Set log level (sets DYN_LOG to specified level) """ - spec = self._deployment_spec["spec"] - env_key = "env" if self._schema == SCHEMA_V1BETA1 else "envs" - envs = spec.setdefault(env_key, []) + spec = self._deployment_spec + if "envs" not in spec["spec"]: + spec["spec"]["envs"] = [] # Remove any existing logging env vars to avoid duplicates - envs = [ + spec["spec"]["envs"] = [ env - for env in envs + for env in spec["spec"]["envs"] if env.get("name") not in ["DYN_LOGGING_JSONL", "DYN_LOG"] ] if enable_jsonl: - envs.append({"name": "DYN_LOGGING_JSONL", "value": "true"}) + spec["spec"]["envs"].append({"name": "DYN_LOGGING_JSONL", "value": "true"}) if log_level: - envs.append({"name": "DYN_LOG", "value": log_level}) - - spec[env_key] = envs + spec["spec"]["envs"].append({"name": "DYN_LOG", "value": log_level}) def get_logging_config(self) -> dict: """Get current logging configuration diff --git a/tests/deploy/test_dgd_utils.py b/tests/deploy/test_dgd_utils.py index 74176756025e..ef1d0179df27 100644 --- a/tests/deploy/test_dgd_utils.py +++ b/tests/deploy/test_dgd_utils.py @@ -11,38 +11,6 @@ pytestmark = [pytest.mark.unit, pytest.mark.pre_merge, pytest.mark.gpu_0] -@pytest.mark.parametrize( - ("api_version", "spec_body", "env_key"), - [ - ("nvidia.com/v1alpha1", {"services": {}}, "envs"), - ("nvidia.com/v1beta1", {"components": []}, "env"), - ], -) -def test_logging_config_uses_schema_specific_global_env( - tmp_path, api_version: str, spec_body: dict, env_key: str -) -> None: - """Set and read logging variables using the active DGD schema.""" - manifest = { - "apiVersion": api_version, - "kind": "DynamoGraphDeployment", - "metadata": {"name": "logging-test"}, - "spec": spec_body, - } - manifest_path = tmp_path / "deploy.yaml" - manifest_path.write_text(yaml.safe_dump(manifest)) - - deployment_spec = DeploymentSpec(str(manifest_path)) - deployment_spec.set_logging(enable_jsonl=True, log_level="debug") - - assert deployment_spec.get_logging_config() == { - "jsonl_enabled": True, - "log_level": "debug", - } - assert env_key in deployment_spec._deployment_spec["spec"] - unexpected_key = "env" if env_key == "envs" else "envs" - assert unexpected_key not in deployment_spec._deployment_spec["spec"] - - def test_logging_config_reads_existing_v1beta1_env(tmp_path) -> None: """Recognize JSONL logging already declared in a v1beta1 manifest.""" manifest = {