Skip to content

Commit fc5a868

Browse files
Manual pagination query endpoints for jobs, logs and traces (#206)
* Regenerate proto * Add sort direction param to job query * Manual pagination query endpoints for jobs, logs and traces * Fix linter issues
1 parent 1afae8b commit fc5a868

22 files changed

Lines changed: 1192 additions & 339 deletions

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.6.0] - 2026-05-20
11+
12+
### Added
13+
14+
- `workflows`: Added cursor and limit query options plus `QueryPage`, `QueryLogsPage`, and `QuerySpansPage` for manual pagination of job, log, and span queries.
15+
- `workflows`: Added `job.WithTaskStates(...)` to filter job queries by task state.
16+
- `workflows`: Added string and JSON representations for job and task states.
17+
18+
### Changed
19+
20+
- `workflows`: Changed job, log, and span queries to support cursor-based pagination while keeping existing sequence APIs auto-paginated.
21+
- `workflows`: Moved telemetry query options to the `workflows/v1/job` package so job and telemetry queries share `job.WithLimit`, `job.WithCursor`, and `job.WithSortDirection`.
22+
1023
## [0.5.0] - 2026-05-11
1124

1225
### Added
@@ -90,7 +103,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
90103
- Added support for Tilebox Observability, including logging and tracing helpers.
91104
- Added examples for using the library.
92105

93-
[Unreleased]: https://github.com/tilebox/tilebox-go/compare/v0.5.0...HEAD
106+
[Unreleased]: https://github.com/tilebox/tilebox-go/compare/v0.6.0...HEAD
107+
[0.6.0]: https://github.com/tilebox/tilebox-go/compare/v0.5.0...v0.6.0
94108
[0.5.0]: https://github.com/tilebox/tilebox-go/compare/v0.4.0...v0.5.0
95109
[0.4.0]: https://github.com/tilebox/tilebox-go/compare/v0.3.2...v0.4.0
96110
[0.3.2]: https://github.com/tilebox/tilebox-go/compare/v0.3.1...v0.3.2

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,41 @@ func main() {
162162
}
163163
```
164164

165+
### Querying Job Telemetry
166+
167+
After a job has been executed, we can query runner logs associated with it.
168+
169+
```go
170+
package main
171+
172+
import (
173+
"context"
174+
"log/slog"
175+
176+
"github.com/google/uuid"
177+
"github.com/tilebox/tilebox-go/workflows/v1"
178+
"github.com/tilebox/tilebox-go/workflows/v1/job"
179+
)
180+
181+
func main() {
182+
ctx := context.Background()
183+
client := workflows.NewClient()
184+
jobID := uuid.MustParse("019e070c-63ba-1c7e-5f1d-65be3e22d52a")
185+
186+
for logRecord, err := range client.Jobs.QueryLogs(ctx, jobID,
187+
job.WithLimit(100),
188+
job.WithSortDirection(job.Ascending),
189+
) {
190+
if err != nil {
191+
slog.ErrorContext(ctx, "failed to query job logs", slog.Any("error", err))
192+
return
193+
}
194+
195+
slog.InfoContext(ctx, "job log", slog.String("body", logRecord.Body))
196+
}
197+
}
198+
```
199+
165200
## License
166201

167202
Distributed under the MIT License (`The MIT License`).

examples/workflows/observability/query/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/google/uuid"
1010
"github.com/tilebox/tilebox-go/workflows/v1"
11+
"github.com/tilebox/tilebox-go/workflows/v1/job"
1112
)
1213

1314
func main() {
@@ -18,7 +19,7 @@ func main() {
1819

1920
fmt.Println("Log messages:") //nolint:forbidigo // This example intentionally prints query results to stdout.
2021
fmt.Printf("%-8s %-30s %s\n", "LEVEL", "TIME", "BODY") //nolint:forbidigo // This example intentionally prints query results to stdout.
21-
for logRecord, err := range client.Jobs.QueryLogs(ctx, jobID, workflows.WithSortDirection(workflows.Ascending)) {
22+
for logRecord, err := range client.Jobs.QueryLogs(ctx, jobID, job.WithSortDirection(job.Ascending)) {
2223
if err != nil {
2324
slog.ErrorContext(ctx, "failed to query job logs", slog.Any("error", err))
2425
return

protogen/datasets/v1/collections_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protogen/datasets/v1/data_access_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protogen/datasets/v1/data_ingestion_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protogen/datasets/v1/datasets_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protogen/tilebox/v1/query.pb.go

Lines changed: 67 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protogen/workflows/v1/automation_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protogen/workflows/v1/diagram_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)