Skip to content

Go: update server config - #17027

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
JinHai-CN:fix558
Jul 17, 2026
Merged

JinHai-CN merged 2 commits into
infiniflow:mainfrom
JinHai-CN:fix558

Conversation

@JinHai-CN

Copy link
Copy Markdown
Member

Summary

RAGFlow(admin)> list services;
+--------+--------------+----+---------------------+------+---------------+-----------+
| enable | host         | id | name                | port | service_type  | status    |
+--------+--------------+----+---------------------+------+---------------+-----------+
|        | localhost    | 0  | redis               | 6379 | cache         | alive     |
|        | localhost    | 1  | minio               | 9000 | file_store    | alive     |
|        | localhost    | 2  | elasticsearch       | 1200 | retrieval     | alive     |
|        | localhost    | 3  | mysql               | 3306 | meta_data     | alive     |
| false  | localhost    | 4  | jaeger              | 4318 | tracing       | unknown   |
|        | localhost    | 5  | clickhouse          | 9900 | olap          | unknown   |
|        | localhost    | 6  | nats                | 4222 | message_queue | CONNECTED |
|        | 192.168.1.68 | 7  | ragflow-server-9384 | 9384 | api_server    | alive     |
+--------+--------------+----+---------------------+------+---------------+-----------+

@JinHai-CN JinHai-CN added the ci Continue Integration label Jul 17, 2026
@JinHai-CN
JinHai-CN marked this pull request as ready for review July 17, 2026 05:00
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds ingestor message-queue configuration, uses it during server startup, classifies Redis as a cache service, updates NATS status handling, and adds an OpenTelemetry enable flag with disabled default configuration.

Changes

Ingestor and service status updates

Layer / File(s) Summary
Configuration and service registration
internal/server/config.go, conf/service_conf.yaml
Adds ingestor and OpenTelemetry configuration fields, registers ingestor service metadata, classifies Redis as cache, and disables OpenTelemetry output and enablement in the service configuration.
Ingestor message-queue startup
cmd/ragflow_server.go
Initializes the message-queue engine using config.Ingestor.MQType.
Administrative service status handling
internal/admin/service.go
Adds cache details through Redis checks, uses direct NATS health checks for message queues, and reports "unknown" when ClickHouse is not initialized.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: ☯️ refactor

Suggested reviewers: yuzhichang, xugangqiang

Poem

I’m a rabbit with queues in my burrow tonight,
NATS hops forward, configured just right.
Redis wears cache ears, ClickHouse says “unknown,”
Otel rests quietly beneath the moon.
Thump-thump! The services now follow the tune.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and matches the main change set: Go server configuration updates.
Description check ✅ Passed The PR description includes the required Summary section and relevant context via the service listing example.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JinHai-CN
JinHai-CN marked this pull request as draft July 17, 2026 05:00
@JinHai-CN
JinHai-CN marked this pull request as ready for review July 17, 2026 05:00

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/server/config.go (1)

434-442: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Delete the correct configuration key.

The key read from configDict on line 435 is "mq_type", but the code attempts to delete "message_queue_type" on line 442. This leaves the original "mq_type" key in the dictionary.

🐛 Proposed fix
 			configDict["extra"] = map[string]interface{}{
 				"message_queue_type": mqType,
 			}
-			delete(configDict, "message_queue_type")
+			delete(configDict, "mq_type")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/server/config.go` around lines 434 - 442, In the “ingestor”
configuration branch, update the delete call to remove the same “mq_type” key
read by getString, while preserving its use as extra.message_queue_type.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/admin/service.go`:
- Around line 1027-1030: Update the "message_queue" case to replace the direct
assertions for configDict["host"] and configDict["port"] with comma-ok type
assertions, defaulting host and port to their zero values when keys are missing
or types differ, then pass those safe values to checkNatsAlive.

---

Outside diff comments:
In `@internal/server/config.go`:
- Around line 434-442: In the “ingestor” configuration branch, update the delete
call to remove the same “mq_type” key read by getString, while preserving its
use as extra.message_queue_type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e638065d-bcc4-4e64-a772-06704b70072f

📥 Commits

Reviewing files that changed from the base of the PR and between 6779607 and 2be7881.

📒 Files selected for processing (4)
  • cmd/ragflow_server.go
  • conf/service_conf.yaml
  • internal/admin/service.go
  • internal/server/config.go

Comment thread internal/admin/service.go
Comment on lines 1027 to +1030
case "message_queue":
switch name {
case "redis":
return s.getRedisInfo(name)
case "nats":
host := configDict["host"].(string)
port := configDict["port"].(int)
return s.checkNatsAlive(name, host, port)
default:
return map[string]interface{}{
"service_name": name,
"status": "unknown",
"message": "Service type not supported",
}, nil
}
host := configDict["host"].(string)
port := configDict["port"].(int)
return s.checkNatsAlive(name, host, port)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Prevent panic from unsafe type assertions.

Direct type assertions on configDict will cause a runtime panic if the "host" or "port" keys are missing from the configuration (evaluating to nil), or if they are parsed as different types (e.g., if a missing port defaults to the string "-" during config init).

Since checkNatsAlive no longer actively uses these arguments internally, safely extract them using the comma-ok idiom to fall back to zero values and avoid crashing the request handler.

🔒️ Proposed fix
 	case "message_queue":
-		host := configDict["host"].(string)
-		port := configDict["port"].(int)
+		host, _ := configDict["host"].(string)
+		port, _ := configDict["port"].(int)
 		return s.checkNatsAlive(name, host, port)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
case "message_queue":
switch name {
case "redis":
return s.getRedisInfo(name)
case "nats":
host := configDict["host"].(string)
port := configDict["port"].(int)
return s.checkNatsAlive(name, host, port)
default:
return map[string]interface{}{
"service_name": name,
"status": "unknown",
"message": "Service type not supported",
}, nil
}
host := configDict["host"].(string)
port := configDict["port"].(int)
return s.checkNatsAlive(name, host, port)
case "message_queue":
host, _ := configDict["host"].(string)
port, _ := configDict["port"].(int)
return s.checkNatsAlive(name, host, port)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/admin/service.go` around lines 1027 - 1030, Update the
"message_queue" case to replace the direct assertions for configDict["host"] and
configDict["port"] with comma-ok type assertions, defaulting host and port to
their zero values when keys are missing or types differ, then pass those safe
values to checkNatsAlive.

@JinHai-CN
JinHai-CN merged commit cf71c71 into infiniflow:main Jul 17, 2026
3 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant