Repository navigation
Go: add more frameworks - #16915
Go: add more frameworks#16915
Conversation
Signed-off-by: Jin Hai <[email protected]>
📝 WalkthroughWalkthroughThe PR adds EE server lifecycle hooks, EE router extension points, OpenTelemetry and Jaeger configuration, and an ChangesEE and observability scaffolding
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
conf/service_conf.yaml (1)
54-59: 🚀 Performance & Scalability | 🔵 TrivialAvoid full stdout tracing in production defaults.
sample_ratio: 1.0together withstdout: truecan emit every span to application logs and materially increase log volume and runtime overhead. Confirm this file is development-only; otherwise use safer defaults and enable verbose tracing explicitly.🤖 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 `@conf/service_conf.yaml` around lines 54 - 59, Update the otel defaults in the service configuration so production deployments do not emit every span to stdout: reduce or disable sample_ratio and set stdout to false unless this file is confirmed to be development-only. Preserve verbose tracing as an explicit opt-in configuration.
🤖 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 `@cmd/ragflow_server.go`:
- Around line 371-375: Ensure the startup failure path around server.StartServer
explicitly invokes server.ShutdownServer before os.Exit(1), or propagate the
error to a caller that performs deferred cleanup. Preserve shutdown handling for
successful startup and ensure EE cleanup occurs on every exit path.
In `@docker/docker-compose-base.yml`:
- Around line 276-283: Update the Jaeger service configuration to use Jaeger v2
YAML configuration instead of the COLLECTOR_OTLP_ENABLED environment toggle:
mount the repository’s Jaeger config file into the container, pass it via the
image command’s --config option, and ensure the config defines the OTLP gRPC and
HTTP receivers exposed by the existing ports.
In `@docker/service_conf.yaml.template`:
- Line 69: Update the OTLP configuration’s secure setting in
service_conf.yaml.template to read from an environment variable mapped to
OtelConfig.Secure instead of hard-coding false. Preserve the existing
configuration structure and ensure deployments can enable TLS through that
variable.
In `@internal/common/number.go`:
- Around line 178-180: Update AlmostEqual64 to use a strict math.Abs(a-b) <
epsilon comparison, matching the repository’s existing epsilon semantics. Add or
update tests to verify values exactly 1e-9 apart are not considered equal while
values below the threshold remain equal.
---
Nitpick comments:
In `@conf/service_conf.yaml`:
- Around line 54-59: Update the otel defaults in the service configuration so
production deployments do not emit every span to stdout: reduce or disable
sample_ratio and set stdout to false unless this file is confirmed to be
development-only. Preserve verbose tracing as an explicit opt-in configuration.
🪄 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: eb4fbd10-b693-4bda-9205-c929a9b02fec
📒 Files selected for processing (12)
cmd/ragflow_server.goconf/service_conf.yamldocker/.envdocker/docker-compose-base.ymldocker/service_conf.yaml.templateinternal/admin/router.gointernal/admin/router_ee.gointernal/common/number.gointernal/router/router.gointernal/router/router_ee.gointernal/server/config.gointernal/server/server_ee.go
| if err = server.StartServer(); err != nil { | ||
| common.Error("Failed to start EE server", err) | ||
| os.Exit(1) | ||
| } | ||
| defer server.ShutdownServer() |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the relevant file and nearby startup/shutdown code.
git ls-files cmd/ragflow_server.go
echo '--- outline ---'
ast-grep outline cmd/ragflow_server.go --view expanded || true
echo '--- line count ---'
wc -l cmd/ragflow_server.go
echo '--- target slice ---'
sed -n '330,430p' cmd/ragflow_server.goRepository: infiniflow/ragflow
Length of output: 4016
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the server lifecycle methods referenced from main.
rg -n "func .*StartServer|func .*ShutdownServer|StartServer\(|ShutdownServer\(" cmd . -g '!**/vendor/**' -g '!**/node_modules/**'Repository: infiniflow/ragflow
Length of output: 541
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n "func .*StartServer|func .*ShutdownServer|StartServer\(|ShutdownServer\(" cmd . -g '!**/vendor/**' -g '!**/node_modules/**'Repository: infiniflow/ragflow
Length of output: 541
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '211,430p' cmd/ragflow_server.goRepository: infiniflow/ragflow
Length of output: 5714
Run EE shutdown before any os.Exit path. defer server.ShutdownServer() is skipped by the later os.Exit(1) branches, so a mode startup failure can bypass EE cleanup and discard shutdown errors. Return the error to the caller or call ShutdownServer() explicitly before exiting.
🤖 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 `@cmd/ragflow_server.go` around lines 371 - 375, Ensure the startup failure
path around server.StartServer explicitly invokes server.ShutdownServer before
os.Exit(1), or propagate the error to a caller that performs deferred cleanup.
Preserve shutdown handling for successful startup and ensure EE cleanup occurs
on every exit path.
| image: jaegertracing/jaeger:${JAEGER_VERSION:-2.19.0} | ||
| ports: | ||
| - ${JAEGER_OTLP_GRPC_PORT:-4317}:4317 | ||
| - ${JAEGER_OTLP_HTTP_PORT:-4318}:4318 | ||
| - ${JAEGER_UI_PORT:-16686}:16686 | ||
| env_file: .env | ||
| environment: | ||
| - COLLECTOR_OTLP_ENABLED=true |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the relevant compose section and any Jaeger-related config references.
sed -n '250,310p' docker/docker-compose-base.yml
printf '\n--- search for Jaeger config references ---\n'
rg -n --hidden -S 'JAEGER_VERSION|COLLECTOR_OTLP_ENABLED|--config|jaegertracing/jaeger|jaeger:' docker .github . || trueRepository: infiniflow/ragflow
Length of output: 5846
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import urllib.request, ssl
urls = [
"https://www.jaegertracing.io/docs/2.19/deployment/configuration/",
"https://www.jaegertracing.io/docs/2.19/",
]
ctx = ssl.create_default_context()
for url in urls:
print(f"=== {url} ===")
try:
with urllib.request.urlopen(url, context=ctx, timeout=20) as r:
data = r.read().decode("utf-8", "replace")
# Print only the first few matching snippets for relevant terms.
for term in ["COLLECTOR_OTLP_ENABLED", "--config", "OTLP", "environment variables", "command line"]:
idx = data.find(term)
if idx != -1:
start = max(0, idx - 250)
end = min(len(data), idx + 700)
print(data[start:end].replace("\n", " "))
print("\n---")
except Exception as e:
print(f"ERROR: {e}")
PYRepository: infiniflow/ragflow
Length of output: 559
🌐 Web query:
Jaeger 2.19 COLLECTOR_OTLP_ENABLED config environment variable --config deployment configuration
💡 Result:
In Jaeger v2 (including version 2.19.0), the environment variable COLLECTOR_OTLP_ENABLED is no longer used [1][2]. Jaeger v2 significantly changes configuration management compared to v1, moving away from relying on specific environment variables for feature toggles [3][4]. Key points regarding Jaeger v2 configuration: 1. Unified Configuration: Jaeger v2 must be configured using a YAML configuration file [3][5]. You provide this file to the Jaeger binary or container using the --config command line argument [5]. 2. OTLP Receivers: The OTLP receiver is managed within the YAML configuration file under the receivers section, following the OpenTelemetry Collector configuration format [3][4]. Unlike v1, where an environment variable was required to toggle the feature, the OTLP receiver is configured directly within the pipeline definitions in your YAML file [4]. 3. Environment Variable Usage: While Jaeger v2 does not use legacy environment variables like COLLECTOR_OTLP_ENABLED, it does allow you to reference environment variables within your YAML configuration file using the ${env:VAR_NAME:-default} syntax [3]. This is useful for injecting dynamic values (such as hostnames or ports) into your configuration [3][6]. 4. Command Line Overrides: You can also override specific configuration values directly via the command line using the --set flag, which is particularly useful for the all-in-one distribution [3][6]. Example: --set=receivers.otlp.protocols.grpc.endpoint=0.0.0.0:4317 [3][6].
Citations:
- 1: eastreams/loong@6ecd653
- 2: Remove reference to COLLECTOR_OTLP_ENABLED env var for Jaeger quarkusio/quarkus#42542
- 3: https://www.jaegertracing.io/docs/2.19/deployment/configuration/
- 4: https://github.com/jaegertracing/documentation/blob/main/content/docs/v2/2.13/deployment/configuration.md
- 5: https://www.jaegertracing.io/docs/2.dev/deployment/
- 6: https://github.com/jaegertracing/documentation/blob/main/content/docs/v2/2.14/deployment/configuration.md
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the relevant file and inspect nearby context.
python3 - <<'PY'
from pathlib import Path
p = Path('docker/docker-compose-base.yml')
for i, line in enumerate(p.read_text().splitlines(), 1):
if 260 <= i <= 290:
print(f"{i:4}: {line}")
PY
printf '\n--- Jaeger-related files in repo ---\n'
git ls-files | rg '(^|/)jaeger|docker-compose-base\.yml|compose.*yml$'Repository: infiniflow/ragflow
Length of output: 1211
🏁 Script executed:
#!/bin/bash
set -euo pipefail
for f in docker/docker-compose.yml docker/docker-compose-macos.yml docker/docker-compose-CN-oc9.yml agent/sandbox/docker-compose.yml; do
echo "=== $f ==="
if [ -f "$f" ]; then
rg -n -A6 -B4 'jaegertracing/jaeger|COLLECTOR_OTLP_ENABLED|--config|jaeger:' "$f" || true
else
echo "missing"
fi
echo
doneRepository: infiniflow/ragflow
Length of output: 316
Configure Jaeger v2 with a YAML config. COLLECTOR_OTLP_ENABLED=true is a v1-style toggle and won’t configure OTLP in jaegertracing/jaeger:2.19.0; mount a config file and pass --config so the OTLP receivers are defined.
🤖 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 `@docker/docker-compose-base.yml` around lines 276 - 283, Update the Jaeger
service configuration to use Jaeger v2 YAML configuration instead of the
COLLECTOR_OTLP_ENABLED environment toggle: mount the repository’s Jaeger config
file into the container, pass it via the image command’s --config option, and
ensure the config defines the OTLP gRPC and HTTP receivers exposed by the
existing ports.
| otel: | ||
| host: ${OTEL_HOST:-0.0.0.0} | ||
| port: ${OTEL_PORT:-4318} | ||
| secure: false |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Make OTLP transport security configurable.
Hard-coding secure: false prevents Docker deployments from enabling TLS, even though OtelConfig.Secure is exposed. Map this value to an environment variable so production collectors can require secure transport.
Proposed fix
- secure: false
+ secure: ${OTEL_SECURE:-false}📝 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.
| secure: false | |
| secure: ${OTEL_SECURE:-false} |
🤖 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 `@docker/service_conf.yaml.template` at line 69, Update the OTLP
configuration’s secure setting in service_conf.yaml.template to read from an
environment variable mapped to OtelConfig.Secure instead of hard-coding false.
Preserve the existing configuration structure and ensure deployments can enable
TLS through that variable.
| func AlmostEqual64(a, b float64) bool { | ||
| const epsilon = 1e-9 | ||
| return math.Abs(a-b) <= epsilon |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Match the repository’s strict epsilon semantics.
internal/agent/tool/retrieval_nlp_test.go:35-37 treats values as equal only when math.Abs(a-b) < 1e-9; this implementation uses <=, changing the result for values exactly 1e-9 apart. Use < epsilon unless the inclusive boundary is intentional, and add a boundary test.
🤖 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/common/number.go` around lines 178 - 180, Update AlmostEqual64 to
use a strict math.Abs(a-b) < epsilon comparison, matching the repository’s
existing epsilon semantics. Add or update tests to verify values exactly 1e-9
apart are not considered equal while values below the threshold remain equal.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16915 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary