Unary · Usage
Gets the top environment classes by total runtime in the specified date range.
Endpoint
POST /api/gitpod.v1.UsageService/GetTopEnvironmentClasses
https://app.ona.com with that domain.
Request example
export ONA_HOST=https://app.ona.com
export ONA_API_KEY=<your-token>
curl --request POST \
--url "$ONA_HOST/api/gitpod.v1.UsageService/GetTopEnvironmentClasses" \
--header "Authorization: Bearer $ONA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"dateRange": {
"endTime": "2026-01-01T00:00:00Z",
"startTime": "2026-01-01T00:00:00Z"
}
}'
import gitpod.v1.usage_pb2 as usage_pb2
import google.protobuf.timestamp_pb2 as timestamp_pb2
from ona_sdk import create_client_from_env
ona = create_client_from_env()
request = usage_pb2.GetTopEnvironmentClassesRequest(
date_range=usage_pb2.DateRange(
start_time=timestamp_pb2.Timestamp(seconds=1767225600),
end_time=timestamp_pb2.Timestamp(seconds=1767225600),
),
)
response = ona.services.usage.get_top_environment_classes(request)
print(response)
import { create } from "@bufbuild/protobuf";
import { createClientFromEnv } from "@gitpod/sdk";
import { GetTopEnvironmentClassesRequestSchema } from "@gitpod/sdk/gitpod/v1/usage_pb";
import { timestampFromDate } from "@bufbuild/protobuf/wkt";
async function main() {
const ona = createClientFromEnv();
const request = create(GetTopEnvironmentClassesRequestSchema, {
dateRange: {
startTime: timestampFromDate(new Date("2026-01-01T00:00:00Z")),
endTime: timestampFromDate(new Date("2026-01-01T00:00:00Z")),
},
});
const response = await ona.services.usage.getTopEnvironmentClasses(request);
console.log(response);
}
main().catch(console.error);
package main
import (
"context"
"fmt"
"log"
"connectrpc.com/connect"
"github.com/gitpod-io/gitpod-sdk-go/sdk"
gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
)
func main() {
ona, err := sdk.NewFromEnv()
if err != nil {
log.Fatal(err)
}
request := connect.NewRequest(&gitpodpb.GetTopEnvironmentClassesRequest{
DateRange: &gitpodpb.DateRange{
StartTime: ×tamppb.Timestamp{Seconds: 1767225600},
EndTime: ×tamppb.Timestamp{Seconds: 1767225600},
},
})
response, err := ona.Services.Usage.GetTopEnvironmentClasses(context.Background(), request)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Msg)
}
{
"dateRange": {
"endTime": "2026-01-01T00:00:00Z",
"startTime": "2026-01-01T00:00:00Z"
}
}
Request
gitpod.v1.GetTopEnvironmentClassesRequest
| Field | Type | Required | Description |
|---|---|---|---|
pagination | PaginationRequest | No | Pagination options. |
dateRange | DateRange | Yes | Date range to query metrics within. Constraints: required=true. |
projectId | string | No | Optional project ID to filter metrics by. |
teamId | string | No | Optional team ID to scope results to members of a specific team. |
Response
gitpod.v1.GetTopEnvironmentClassesResponse
| Field | Type | Required | Description |
|---|---|---|---|
environmentClasses | array of EnvironmentClassRuntimeInfo | No | List of environment classes sorted by total runtime (descending). All environment classes belonging to local runners are grouped together. |
pagination | PaginationResponse | No |
Related types
DateRange
DateRange
DateRange specifies a time period for queries.
gitpod.v1.DateRange| Field | Type | Required | Description |
|---|---|---|---|
startTime | RFC 3339 timestamp | Yes | Start time of the date range (inclusive). Constraints: required=true. |
endTime | RFC 3339 timestamp | Yes | End time of the date range (exclusive). Constraints: required=true. |
EnvironmentClassRuntimeInfo
EnvironmentClassRuntimeInfo
gitpod.v1.GetTopEnvironmentClassesResponse.EnvironmentClassRuntimeInfo| Field | Type | Required | Description |
|---|---|---|---|
environmentClassId | string | No | Environment class ID. Not set for local runners. |
runnerKind | RunnerKind | No | Type of runner that created the environment class. |
runnerName | string | No | Name of the runner that created the environment class. |
environmentClassName | string | No | Environment class name if available. |
totalRuntimeSeconds | 64-bit integer string | No | Total runtime in seconds. |
PaginationRequest
PaginationRequest
gitpod.v1.PaginationRequest| Field | Type | Required | Description |
|---|---|---|---|
pageSize | integer | No | Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. Constraints: int32.gte=0, int32.lte=100. |
token | string | No | Token for the next set of results that was returned as next_token of a PaginationResponse |
PaginationResponse
PaginationResponse
gitpod.v1.PaginationResponse| Field | Type | Required | Description |
|---|---|---|---|
nextToken | string | No | Token passed for retrieving the next set of results. Empty if there are no more results |
RunnerKind
RunnerKind
RunnerKind represents the kind of a runner
| Value | Number | Description |
|---|---|---|
RUNNER_KIND_UNSPECIFIED | 0 | Default zero value. Do not set explicitly. |
RUNNER_KIND_LOCAL | 1 | Deprecated. Deprecated: Local runners are no longer supported. Use RUNNER_PROVIDER_AWS_EC2 or RUNNER_PROVIDER_GCP instead. |
RUNNER_KIND_REMOTE | 2 | The runner is a remote runner |
RUNNER_KIND_LOCAL_CONFIGURATION | 3 | The runner is a system-managed runner that holds shared configuration for local runners. Every organization automatically has one of these runners, and it cannot be deleted nor can new runners of this kind be created. Organization admins can update this runner to change the shared configuration, including: - SCM Integrations. All local runners will use these integrations. - DesiredPhase. Can be set to STOPPED to disable all local runners. This runner cannot be used to run environments. |