Skip to content

docs: document streaming EXPLAIN ANALYZE HTTP API - #2730

Open
discord9 wants to merge 1 commit into
GreptimeTeam:mainfrom
discord9:docs/streaming-explain-analyze-2719
Open

docs: document streaming EXPLAIN ANALYZE HTTP API#2730
discord9 wants to merge 1 commit into
GreptimeTeam:mainfrom
discord9:docs/streaming-explain-analyze-2719

Conversation

@discord9

Copy link
Copy Markdown
Contributor

What changed

Document the POST /v1/sql/analyze/stream (SSE) endpoint contract added in v1.2 (upstream GreptimeDB #8380): request parameters, EXPLAIN ANALYZE VERBOSE statement restrictions, the metrics/final/canceled/error SSE events and payload fields, snapshot semantics (complete best-effort snapshot with adaptive coalescing), client-disconnect cancellation, and the no resume/reconnect lifecycle.

Closes #2719.

Scope

  • Documentation versions: Nightly, 1.2
  • Languages: English, Chinese

Verification

  • Contract verified against GreptimeDB v1.2 source (src/servers/src/http/handler.rs SSE event generation; endpoint registration in src/servers/src/http.rs; config default http.experimental_enable_explain_analyze_stream = true, snapshot_interval_ms default 5000 clamped to [1000, 60000]).
  • EN/ZH and Nightly/v1.2 copies are line-aligned.
  • markdownlint config in repo disables all rules; manual structural checks passed. Docusaurus build not run (no node runtime available).

Checklist

  • I verified the content against the applicable GreptimeDB version.
  • I updated the relevant documentation versions and languages, or explained why not.
  • I checked changed links and anchors.
  • I updated navigation when the document structure changed.

Add the POST /v1/sql/analyze/stream (SSE) endpoint contract to the HTTP
endpoint reference: request parameters, EXPLAIN ANALYZE VERBOSE statement
restrictions, the metrics/final/canceled/error SSE events and payload
fields, snapshot semantics (complete best-effort snapshot, adaptive
coalescing), client-disconnect behavior, and the no resume/reconnect
lifecycle. Synchronized to EN/ZH Nightly and v1.2.

Signed-off-by: discord9 <discord9@163.com>
```bash
curl -N -X POST 'http://127.0.0.1:4000/v1/sql/analyze/stream' \
-H 'Accept: text/event-stream' \
-F 'sql=EXPLAIN ANALYZE VERBOSE SELECT * FROM monitor'

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.

The example uses curl -F, which sends multipart/form-data, but this handler extracts Axum Form<SqlQuery>, which accepts application/x-www-form-urlencoded. Because the unsupported media type is ignored and no query-string sql is supplied, this command reaches sql parameter is required instead of opening an SSE stream. Please use --data-urlencode 'sql=EXPLAIN ANALYZE VERBOSE SELECT * FROM monitor' and update all four copies so the documented example works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document the streaming EXPLAIN ANALYZE HTTP API

2 participants