GetAgentTraceTimeSeries
client.Usage.GetAgentTraceTimeSeries(ctx, body) (*UsageGetAgentTraceTimeSeriesResponse, error)
POST/gitpod.v1.UsageService/GetAgentTraceTimeSeries
Gets agent trace data as a time series.
Use this method to:
- Chart agent sessions and line changes over time
- Select hourly, daily, weekly, or monthly buckets
- Scope agent trace insights to a project, user, or team
Example
dateRange:
startTime: "2024-01-01T00:00:00Z"
endTime: "2024-02-01T00:00:00Z"
resolution: RESOLUTION_WEEKLY
projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"GetAgentTraceTimeSeries
package main
import (
"context"
"fmt"
"time"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
"github.com/gitpod-io/gitpod-sdk-go/shared"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.Usage.GetAgentTraceTimeSeries(context.TODO(), gitpod.UsageGetAgentTraceTimeSeriesParams{
DateRange: gitpod.F(shared.DateRangeParam{
EndTime: gitpod.F(time.Now()),
StartTime: gitpod.F(time.Now()),
}),
ProjectID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
Resolution: gitpod.F(gitpod.ResolutionWeekly),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.TimeSeries)
}
{
"timeSeries": [
{
"byModel": [
{
"linesAdded": "linesAdded",
"linesRemoved": "linesRemoved",
"model": "SUPPORTED_MODEL_UNSPECIFIED",
"sessions": "sessions"
}
],
"startTime": "2019-12-27T18:11:19.117Z",
"totalLinesAdded": "totalLinesAdded",
"totalLinesRemoved": "totalLinesRemoved",
"totalSessions": "totalSessions"
}
]
}Returns Examples
{
"timeSeries": [
{
"byModel": [
{
"linesAdded": "linesAdded",
"linesRemoved": "linesRemoved",
"model": "SUPPORTED_MODEL_UNSPECIFIED",
"sessions": "sessions"
}
],
"startTime": "2019-12-27T18:11:19.117Z",
"totalLinesAdded": "totalLinesAdded",
"totalLinesRemoved": "totalLinesRemoved",
"totalSessions": "totalSessions"
}
]
}