Observability - Go SDK

Observability method reference

The Go SDK and docs are currently in beta. Report issues on GitHub.

Overview

Observability endpoints

Available Operations

  • List - List observability destinations
  • Get - Get an observability destination

List

List the observability destinations configured for the authenticated entity’s default workspace. Use the workspace_id query parameter to scope the result to a different workspace. Only destinations with stable release status are surfaced — destinations of other types are excluded. Management key required.

Example Usage

1package main
2
3import(
4 "context"
5 "os"
6 openrouter "github.com/OpenRouterTeam/go-sdk"
7 "github.com/OpenRouterTeam/go-sdk/optionalnullable"
8 "log"
9)
10
11func main() {
12 ctx := context.Background()
13
14 s := openrouter.New(
15 openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
16 )
17
18 res, err := s.Observability.List(ctx, optionalnullable.From[int64](nil), nil, nil)
19 if err != nil {
20 log.Fatal(err)
21 }
22 if res != nil {
23 for {
24 // handle items
25
26 res, err = res.Next()
27
28 if err != nil {
29 // handle error
30 }
31
32 if res == nil {
33 break
34 }
35 }
36 }
37}

Parameters

ParameterTypeRequiredDescriptionExample
ctxcontext.Context✔️The context to use for the request.
offsetoptionalnullable.OptionalNullable[int64]Number of records to skip for pagination0
limit*int64Maximum number of records to return (max 100)50
workspaceID*stringOptional workspace ID to filter by. Defaults to the authenticated entity’s default workspace.550e8400-e29b-41d4-a716-446655440000
opts[]operations.OptionThe options for this request.

Response

*operations.ListObservabilityDestinationsResponse, error

Errors

Error TypeStatus CodeContent Type
sdkerrors.UnauthorizedResponseError401application/json
sdkerrors.InternalServerResponseError500application/json
sdkerrors.APIError4XX, 5XX*/*

Get

Fetch a single observability destination by its UUID. Defaults to the authenticated entity’s default workspace — use workspace_id to override. Management key required.

Example Usage

1package main
2
3import(
4 "context"
5 "os"
6 openrouter "github.com/OpenRouterTeam/go-sdk"
7 "log"
8 "github.com/OpenRouterTeam/go-sdk/models/components"
9)
10
11func main() {
12 ctx := context.Background()
13
14 s := openrouter.New(
15 openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
16 )
17
18 res, err := s.Observability.Get(ctx, "99999999-aaaa-bbbb-cccc-dddddddddddd", nil)
19 if err != nil {
20 log.Fatal(err)
21 }
22 if res != nil {
23 switch res.Data.Type {
24 case components.ObservabilityDestinationTypeArize:
25 // res.Data.ObservabilityArizeDestination is populated
26 case components.ObservabilityDestinationTypeBraintrust:
27 // res.Data.ObservabilityBraintrustDestination is populated
28 case components.ObservabilityDestinationTypeClickhouse:
29 // res.Data.ObservabilityClickhouseDestination is populated
30 case components.ObservabilityDestinationTypeDatadog:
31 // res.Data.ObservabilityDatadogDestination is populated
32 case components.ObservabilityDestinationTypeGrafana:
33 // res.Data.ObservabilityGrafanaDestination is populated
34 case components.ObservabilityDestinationTypeLangfuse:
35 // res.Data.ObservabilityLangfuseDestination is populated
36 case components.ObservabilityDestinationTypeLangsmith:
37 // res.Data.ObservabilityLangsmithDestination is populated
38 case components.ObservabilityDestinationTypeNewrelic:
39 // res.Data.ObservabilityNewrelicDestination is populated
40 case components.ObservabilityDestinationTypeOpik:
41 // res.Data.ObservabilityOpikDestination is populated
42 case components.ObservabilityDestinationTypeOtelCollector:
43 // res.Data.ObservabilityOtelCollectorDestination is populated
44 case components.ObservabilityDestinationTypePosthog:
45 // res.Data.ObservabilityPosthogDestination is populated
46 case components.ObservabilityDestinationTypeRamp:
47 // res.Data.ObservabilityRampDestination is populated
48 case components.ObservabilityDestinationTypeS3:
49 // res.Data.ObservabilityS3Destination is populated
50 case components.ObservabilityDestinationTypeSentry:
51 // res.Data.ObservabilitySentryDestination is populated
52 case components.ObservabilityDestinationTypeSnowflake:
53 // res.Data.ObservabilitySnowflakeDestination is populated
54 case components.ObservabilityDestinationTypeWeave:
55 // res.Data.ObservabilityWeaveDestination is populated
56 case components.ObservabilityDestinationTypeWebhook:
57 // res.Data.ObservabilityWebhookDestination is populated
58 default:
59 // Unknown type - use res.Data.GetUnknownRaw() for raw JSON
60 }
61
62 }
63}

Parameters

ParameterTypeRequiredDescriptionExample
ctxcontext.Context✔️The context to use for the request.
idstring✔️The destination ID (UUID).99999999-aaaa-bbbb-cccc-dddddddddddd
workspaceID*stringOptional workspace ID. Defaults to the authenticated entity’s default workspace.550e8400-e29b-41d4-a716-446655440000
opts[]operations.OptionThe options for this request.

Response

*components.GetObservabilityDestinationResponse, error

Errors

Error TypeStatus CodeContent Type
sdkerrors.UnauthorizedResponseError401application/json
sdkerrors.NotFoundResponseError404application/json
sdkerrors.InternalServerResponseError500application/json
sdkerrors.APIError4XX, 5XX*/*