Workspace zu einem Telemetrieziel hinzufügen
POST/v1/organizations/telemetry_destinations/{destination_id}/workspaces/{workspace_id}
Fügt der Workspace-Liste eines Ziels einen Workspace hinzu.
Bei include werden die Spans des Workspaces ab sofort an das Ziel gesendet. Bei exclude wird das Senden beendet. Eine Liste enthält höchstens 1.000 Workspaces.
Das Hinzufügen eines Workspaces, der bereits auf der Liste steht, ändert nichts und gibt den vorhandenen Eintrag zurück. Ein archivierter Workspace, der noch nicht auf der Liste steht, kann nicht hinzugefügt werden. Ein Ziel, dessen workspaces.type den Wert all hat, besitzt keine Liste, daher gibt die API 400 zurück. Um zu ändern, welche Workspaces ein solches Ziel abdeckt, aktualisiere dessen workspaces.
Im OpenTelemetry-Exportleitfaden erfährst du mehr darüber, wie du die Workspaces eines Ziels auswählst.
Parameters
Returns
Workspace zu einem Telemetrieziel hinzufügen
package main
import (
"context"
"fmt"
"github.com/anthropics/anthropic-sdk-go"
"github.com/anthropics/anthropic-sdk-go/option"
)
func main() {
client := anthropic.NewClient(
option.WithAPIKey("my-anthropic-api-key"),
)
betaTelemetryDestinationWorkspace, err := client.Beta.Organization.TelemetryDestinations.Workspaces.Add(
context.TODO(),
"workspace_id",
anthropic.BetaOrganizationTelemetryDestinationWorkspaceAddParams{
DestinationID: "destination_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", betaTelemetryDestinationWorkspace.TelemetryDestinationID)
}Response 200
{
"created_at": "2019-12-27T18:11:19.117Z",
"telemetry_destination_id": "telemetry_destination_id",
"type": "telemetry_destination_workspace",
"workspace_id": "workspace_id"
}Returns Examples
Response 200
{
"created_at": "2019-12-27T18:11:19.117Z",
"telemetry_destination_id": "telemetry_destination_id",
"type": "telemetry_destination_workspace",
"workspace_id": "workspace_id"
}