docs: update examples for centralized SDK docs#262
Conversation
89cb31f to
51c5014
Compare
51c5014 to
20fe35b
Compare
Greptile SummaryThis PR updates five documentation example files to align with a centralized SDK docs system, adding a new Confidence Score: 5/5Safe 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 examples/docs_account_and_basins/main.go — new pagination anchors omit the error check present in the original anchor.
|
| 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 token → accessToken, 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 token → accessToken; no functional changes. |
| examples/docs_configuration/main.go | Renames token → accessToken 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]
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
20fe35b to
a70df30
Compare
No description provided.