Skip to content

docs: update examples for centralized SDK docs#262

Merged
quettabit merged 1 commit intomainfrom
qb/docs-consis
Apr 8, 2026
Merged

docs: update examples for centralized SDK docs#262
quettabit merged 1 commit intomainfrom
qb/docs-consis

Conversation

@quettabit
Copy link
Copy Markdown
Member

No description provided.

@quettabit quettabit changed the title [WIP] docs: update examples for centralized SDK docs Apr 8, 2026
@quettabit quettabit marked this pull request as ready for review April 8, 2026 20:29
@quettabit quettabit requested a review from a team as a code owner April 8, 2026 20:29
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 8, 2026

Greptile Summary

This PR updates five documentation example files to align with a centralized SDK docs system, adding a new examples/docs_metrics file covering account, basin, and stream metrics, renaming tokenaccessToken for clarity, adjusting the timeout from 30 s to 10 s, and expanding pagination anchors with filtering and deleted-stream examples.

Confidence Score: 5/5

Safe to merge — all changes are documentation examples with no production logic impact.

All SDK type references, metric set/interval combinations, and field names are correct. The only finding is a P2 style inconsistency (missing iter.Err() in two new anchor blocks) that does not affect runtime behavior.

examples/docs_account_and_basins/main.go — new pagination anchors omit the error check present in the original anchor.

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
examples/docs_metrics/main.go New file demonstrating account, basin, and stream metrics API; uses correct interval values for each metric set and valid SDK types throughout.
examples/docs_account_and_basins/main.go Renames tokenaccessToken, adds two new pagination anchors (pagination-filtering, pagination-deleted); new anchors omit iter.Err() checks present in the original pagination anchor.
examples/docs_overview/main.go Switches from s2.NewFromEnvironment to explicit s2.New(os.Getenv(...)) to show token wiring clearly; blank token if env var is unset is tolerable for this overview snippet.
examples/docs_streams/main.go Minor rename of tokenaccessToken; no functional changes.
examples/docs_configuration/main.go Renames tokenaccessToken and adjusts RequestTimeout from 30 s to 10 s; no logic changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[docs_overview] -->|s2.New| C[Client]
    B[docs_configuration] -->|s2.New + options| C
    D[docs_metrics] -->|s2.NewFromEnvironment| C
    C --> E[client.Basin]
    C --> F[client.Basins]
    C --> G[client.AccessTokens]
    C --> H[client.Metrics]
    E --> I[basin.Streams / basin.Stream]
    I --> J[Append / Read / AppendSession / ReadSession]
    I --> K[Streams.Iter - pagination / filtering / deleted]
    H --> L[Metrics.Account]
    H --> M[Metrics.Basin]
    H --> N[Metrics.Stream]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: examples/docs_account_and_basins/main.go
Line: 118-124

Comment:
**Missing `iter.Err()` check in new pagination anchors**

The `pagination-filtering` and `pagination-deleted` anchors don't call `iter.Err()` after the loop, while the existing `pagination` anchor does. Readers who follow only these snippets will silently miss iteration errors. Consider adding the check for consistency:

```suggestion
		// ANCHOR: pagination-filtering
		// List streams with a prefix filter
		iter = basin.Streams.Iter(ctx, &s2.ListStreamsArgs{Prefix: "events/"})
		for iter.Next() {
			fmt.Println(iter.Value().Name)
		}
		if err := iter.Err(); err != nil {
			log.Fatal(err)
		}
		// ANCHOR_END: pagination-filtering
```

The same applies to the `pagination-deleted` block (lines 126–133).

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "initial commit" | Re-trigger Greptile

@quettabit quettabit merged commit bc4c2bb into main Apr 8, 2026
9 checks passed
@quettabit quettabit deleted the qb/docs-consis branch April 8, 2026 20:58
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.

2 participants