Skip to content

COBS-1351: Add Insights spans query support - #1156

Merged
kishlay-singh-DO merged 2 commits into
digitalocean:mainfrom
adityasingh-beep:adityasingh/COBS-1351-add-Insights-spans-query-support
Oct 12, 2026
Merged

kishlay-singh-DO merged 2 commits into
digitalocean:mainfrom
adityasingh-beep:adityasingh/COBS-1351-add-Insights-spans-query-support

Conversation

@adityasingh-beep

@adityasingh-beep adityasingh-beep commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a godo client for the public Insights spans search endpoint, matching the OpenAPI spec merged in digitalocean/openapi#1259.

  • New method InsightsService.SearchSpans(ctx, region, *SpansSearchRequest) → POST /v2/insights/query/{region}/spans/search
  • Request/response types mirroring the spec (camelCase tags): SpansSearchRequest, SpansTimeRange/SpansTimeBound, SpansFilterExpression, SpansFilterField, SpansOrderBy, SpansPaginationRequest, SpansSearchResponse, SpanRecord, SpansPaginationResponse
  • Full type-discriminated filter grammar: condition / and / or / not / text_search, with operators eq/neq/gt/gte/lt/lte/in/exists and resource/attributes field scopes
  • SpansFilterValue encodes the API's typed-wrapper value form ({"type":"string","value":...}) and also accepts the bare scalar/array form on decode
  • InsightsSpans* constants for the filter node types, operators, scopes, sort directions, and value types
  • SearchSpans check added to examples/insights/smoke/main.go

Testing

  • gofmt -s, go build ./..., go vet ./..., go test -race ./... all pass
  • New unit tests: TestInsights_SearchSpans, TestSpansFilterValueMarshal, TestSpansFilterValueUnmarshal, TestInsights_SearchSpansEscapesRegion, TestInsights_SearchSpansError
  • Validated live against staging (s2r1): a full filter sweep (equality + content checks, numeric comparisons, in, exists, attribute/resource scopes, boolean trees, text_search, ordering) and the 7-day error case, via both the godo client and raw curl

Add a godo client for the public Insights spans search endpoint
(POST /v2/insights/query/{region}/spans/search): SearchSpans plus the
request/response types, filter grammar (condition/and/or/not/text_search),
and a SpansFilterValue that encodes the API's typed-wrapper value form.
Includes unit tests and a smoke-test check.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kishlay-singh-DO
kishlay-singh-DO merged commit 15136f9 into digitalocean:main Oct 12, 2026
8 checks passed
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