Skip to content

Commit b390afb

Browse files
feat(api): add managed_metrics_enabled field to metrics configuration
1 parent 542d4d6 commit b390afb

File tree

11 files changed

+151
-11
lines changed

11 files changed

+151
-11
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 193
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-2110902e48daa64a96807838ec3cb8461618762cca4ed69116960195481b07df.yml
3-
openapi_spec_hash: 3fb674220196e951da8e3d45eba67ec7
4-
config_hash: 719d606666b99e520b83306733eee5d5
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-46b2bdeb8322ab3291dc87f9ac5d2e899a8ea34f79b2c2b1beadc551a1700fcf.yml
3+
openapi_spec_hash: 1a1032b0d0f6ce441d13430b58abb3a0
4+
config_hash: de54bcc58fea1260a6792f8fd013439b

src/gitpod/resources/prebuilds.py

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ def create_warm_pool(
418418
environment_class_id: str,
419419
project_id: str,
420420
desired_size: int | Omit = omit,
421+
max_size: Optional[int] | Omit = omit,
422+
min_size: Optional[int] | Omit = omit,
421423
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
422424
# The extra values given here take precedence over values defined on the client or passed to this method.
423425
extra_headers: Headers | None = None,
@@ -457,7 +459,14 @@ def create_warm_pool(
457459
project_id: project_id specifies the project this warm pool belongs to. The project must
458460
have prebuilds enabled.
459461
460-
desired_size: desired_size is the number of warm instances to maintain.
462+
desired_size: desired_size is the number of warm instances to maintain. Deprecated: Use
463+
min_size and max_size instead for dynamic scaling.
464+
465+
max_size: max_size is the maximum number of warm instances to maintain. The pool will
466+
never scale above this value. Must be >= min_size and <= 20.
467+
468+
min_size: min_size is the minimum number of warm instances to maintain. The pool will
469+
never scale below this value. Must be >= 1 and <= max_size.
461470
462471
extra_headers: Send extra headers
463472
@@ -474,6 +483,8 @@ def create_warm_pool(
474483
"environment_class_id": environment_class_id,
475484
"project_id": project_id,
476485
"desired_size": desired_size,
486+
"max_size": max_size,
487+
"min_size": min_size,
477488
},
478489
prebuild_create_warm_pool_params.PrebuildCreateWarmPoolParams,
479490
),
@@ -660,6 +671,8 @@ def update_warm_pool(
660671
*,
661672
warm_pool_id: str,
662673
desired_size: Optional[int] | Omit = omit,
674+
max_size: Optional[int] | Omit = omit,
675+
min_size: Optional[int] | Omit = omit,
663676
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
664677
# The extra values given here take precedence over values defined on the client or passed to this method.
665678
extra_headers: Headers | None = None,
@@ -684,7 +697,14 @@ def update_warm_pool(
684697
Args:
685698
warm_pool_id: warm_pool_id specifies the warm pool to update
686699
687-
desired_size: desired_size updates the number of warm instances to maintain.
700+
desired_size: desired_size updates the number of warm instances to maintain. Deprecated: Use
701+
min_size and max_size instead for dynamic scaling.
702+
703+
max_size: max_size updates the maximum number of warm instances to maintain. The pool will
704+
never scale above this value. Must be >= min_size and <= 20.
705+
706+
min_size: min_size updates the minimum number of warm instances to maintain. The pool will
707+
never scale below this value. Must be >= 1 and <= max_size.
688708
689709
extra_headers: Send extra headers
690710
@@ -700,6 +720,8 @@ def update_warm_pool(
700720
{
701721
"warm_pool_id": warm_pool_id,
702722
"desired_size": desired_size,
723+
"max_size": max_size,
724+
"min_size": min_size,
703725
},
704726
prebuild_update_warm_pool_params.PrebuildUpdateWarmPoolParams,
705727
),
@@ -1085,6 +1107,8 @@ async def create_warm_pool(
10851107
environment_class_id: str,
10861108
project_id: str,
10871109
desired_size: int | Omit = omit,
1110+
max_size: Optional[int] | Omit = omit,
1111+
min_size: Optional[int] | Omit = omit,
10881112
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
10891113
# The extra values given here take precedence over values defined on the client or passed to this method.
10901114
extra_headers: Headers | None = None,
@@ -1124,7 +1148,14 @@ async def create_warm_pool(
11241148
project_id: project_id specifies the project this warm pool belongs to. The project must
11251149
have prebuilds enabled.
11261150
1127-
desired_size: desired_size is the number of warm instances to maintain.
1151+
desired_size: desired_size is the number of warm instances to maintain. Deprecated: Use
1152+
min_size and max_size instead for dynamic scaling.
1153+
1154+
max_size: max_size is the maximum number of warm instances to maintain. The pool will
1155+
never scale above this value. Must be >= min_size and <= 20.
1156+
1157+
min_size: min_size is the minimum number of warm instances to maintain. The pool will
1158+
never scale below this value. Must be >= 1 and <= max_size.
11281159
11291160
extra_headers: Send extra headers
11301161
@@ -1141,6 +1172,8 @@ async def create_warm_pool(
11411172
"environment_class_id": environment_class_id,
11421173
"project_id": project_id,
11431174
"desired_size": desired_size,
1175+
"max_size": max_size,
1176+
"min_size": min_size,
11441177
},
11451178
prebuild_create_warm_pool_params.PrebuildCreateWarmPoolParams,
11461179
),
@@ -1327,6 +1360,8 @@ async def update_warm_pool(
13271360
*,
13281361
warm_pool_id: str,
13291362
desired_size: Optional[int] | Omit = omit,
1363+
max_size: Optional[int] | Omit = omit,
1364+
min_size: Optional[int] | Omit = omit,
13301365
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
13311366
# The extra values given here take precedence over values defined on the client or passed to this method.
13321367
extra_headers: Headers | None = None,
@@ -1351,7 +1386,14 @@ async def update_warm_pool(
13511386
Args:
13521387
warm_pool_id: warm_pool_id specifies the warm pool to update
13531388
1354-
desired_size: desired_size updates the number of warm instances to maintain.
1389+
desired_size: desired_size updates the number of warm instances to maintain. Deprecated: Use
1390+
min_size and max_size instead for dynamic scaling.
1391+
1392+
max_size: max_size updates the maximum number of warm instances to maintain. The pool will
1393+
never scale above this value. Must be >= min_size and <= 20.
1394+
1395+
min_size: min_size updates the minimum number of warm instances to maintain. The pool will
1396+
never scale below this value. Must be >= 1 and <= max_size.
13551397
13561398
extra_headers: Send extra headers
13571399
@@ -1367,6 +1409,8 @@ async def update_warm_pool(
13671409
{
13681410
"warm_pool_id": warm_pool_id,
13691411
"desired_size": desired_size,
1412+
"max_size": max_size,
1413+
"min_size": min_size,
13701414
},
13711415
prebuild_update_warm_pool_params.PrebuildUpdateWarmPoolParams,
13721416
),

src/gitpod/types/metrics_configuration.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Optional
44

5+
from pydantic import Field as FieldInfo
6+
57
from .._models import BaseModel
68

79
__all__ = ["MetricsConfiguration"]
@@ -11,6 +13,12 @@ class MetricsConfiguration(BaseModel):
1113
enabled: Optional[bool] = None
1214
"""enabled indicates whether the runner should collect metrics"""
1315

16+
managed_metrics_enabled: Optional[bool] = FieldInfo(alias="managedMetricsEnabled", default=None)
17+
"""
18+
When true, the runner pushes metrics to the management plane via
19+
ReportRunnerMetrics instead of directly to the remote_write endpoint.
20+
"""
21+
1422
password: Optional[str] = None
1523
"""password is the password to use for the metrics collector"""
1624

src/gitpod/types/metrics_configuration_param.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import TypedDict
5+
from typing_extensions import Annotated, TypedDict
6+
7+
from .._utils import PropertyInfo
68

79
__all__ = ["MetricsConfigurationParam"]
810

@@ -11,6 +13,12 @@ class MetricsConfigurationParam(TypedDict, total=False):
1113
enabled: bool
1214
"""enabled indicates whether the runner should collect metrics"""
1315

16+
managed_metrics_enabled: Annotated[bool, PropertyInfo(alias="managedMetricsEnabled")]
17+
"""
18+
When true, the runner pushes metrics to the management plane via
19+
ReportRunnerMetrics instead of directly to the remote_write endpoint.
20+
"""
21+
1422
password: str
1523
"""password is the password to use for the metrics collector"""
1624

src/gitpod/types/prebuild_create_warm_pool_params.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from typing import Optional
56
from typing_extensions import Required, Annotated, TypedDict
67

78
from .._utils import PropertyInfo
@@ -23,4 +24,19 @@ class PrebuildCreateWarmPoolParams(TypedDict, total=False):
2324
"""
2425

2526
desired_size: Annotated[int, PropertyInfo(alias="desiredSize")]
26-
"""desired_size is the number of warm instances to maintain."""
27+
"""
28+
desired_size is the number of warm instances to maintain. Deprecated: Use
29+
min_size and max_size instead for dynamic scaling.
30+
"""
31+
32+
max_size: Annotated[Optional[int], PropertyInfo(alias="maxSize")]
33+
"""
34+
max_size is the maximum number of warm instances to maintain. The pool will
35+
never scale above this value. Must be >= min_size and <= 20.
36+
"""
37+
38+
min_size: Annotated[Optional[int], PropertyInfo(alias="minSize")]
39+
"""
40+
min_size is the minimum number of warm instances to maintain. The pool will
41+
never scale below this value. Must be >= 1 and <= max_size.
42+
"""

src/gitpod/types/prebuild_update_warm_pool_params.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,19 @@ class PrebuildUpdateWarmPoolParams(TypedDict, total=False):
1515
"""warm_pool_id specifies the warm pool to update"""
1616

1717
desired_size: Annotated[Optional[int], PropertyInfo(alias="desiredSize")]
18-
"""desired_size updates the number of warm instances to maintain."""
18+
"""
19+
desired_size updates the number of warm instances to maintain. Deprecated: Use
20+
min_size and max_size instead for dynamic scaling.
21+
"""
22+
23+
max_size: Annotated[Optional[int], PropertyInfo(alias="maxSize")]
24+
"""
25+
max_size updates the maximum number of warm instances to maintain. The pool will
26+
never scale above this value. Must be >= min_size and <= 20.
27+
"""
28+
29+
min_size: Annotated[Optional[int], PropertyInfo(alias="minSize")]
30+
"""
31+
min_size updates the minimum number of warm instances to maintain. The pool will
32+
never scale below this value. Must be >= 1 and <= max_size.
33+
"""

src/gitpod/types/runner_update_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ class SpecConfigurationMetrics(TypedDict, total=False):
3333
enabled: Optional[bool]
3434
"""enabled indicates whether the runner should collect metrics"""
3535

36+
managed_metrics_enabled: Annotated[Optional[bool], PropertyInfo(alias="managedMetricsEnabled")]
37+
"""
38+
When true, the runner pushes metrics to the management plane via
39+
ReportRunnerMetrics instead of directly to the remote_write endpoint.
40+
"""
41+
3642
password: Optional[str]
3743
"""password is the password to use for the metrics collector"""
3844

src/gitpod/types/warm_pool_spec.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,23 @@ class WarmPoolSpec(BaseModel):
2020
"""
2121

2222
desired_size: Optional[int] = FieldInfo(alias="desiredSize", default=None)
23-
"""desired_size is the number of warm instances to maintain."""
23+
"""
24+
desired_size is the number of warm instances to maintain. Deprecated: Use
25+
min_size and max_size instead for dynamic scaling. Existing pools will be
26+
migrated to min_size=max_size=desired_size.
27+
"""
28+
29+
max_size: Optional[int] = FieldInfo(alias="maxSize", default=None)
30+
"""
31+
max_size is the maximum number of warm instances to maintain. The pool will
32+
never scale above this value. Must be >= min_size and <= 20.
33+
"""
34+
35+
min_size: Optional[int] = FieldInfo(alias="minSize", default=None)
36+
"""
37+
min_size is the minimum number of warm instances to maintain. The pool will
38+
never scale below this value. Must be >= 1 and <= max_size.
39+
"""
2440

2541
snapshot_id: Optional[str] = FieldInfo(alias="snapshotId", default=None)
2642
"""

src/gitpod/types/warm_pool_status.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,23 @@ class WarmPoolStatus(BaseModel):
2121
failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None)
2222
"""failure_message contains details about why the warm pool is degraded or failed"""
2323

24+
running_instances: Optional[int] = FieldInfo(alias="runningInstances", default=None)
25+
"""
26+
running_instances is the number of running warm instances in the pool, ready to
27+
be claimed for near-instant environment startup.
28+
"""
29+
2430
status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None)
2531
"""
2632
status_version is incremented each time the status is updated. Used for
2733
optimistic concurrency control.
2834
"""
35+
36+
stopped_instances: Optional[int] = FieldInfo(alias="stoppedInstances", default=None)
37+
"""
38+
stopped_instances is the number of pre-provisioned but stopped instances in the
39+
pool. When a running instance is claimed, stopped instances are used to backfill
40+
the running pool faster than provisioning from scratch. Stopped instances only
41+
incur storage costs, allowing a larger total pool at lower cost than keeping all
42+
instances running.
43+
"""

tests/api_resources/test_prebuilds.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ def test_method_create_warm_pool_with_all_params(self, client: Gitpod) -> None:
279279
environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
280280
project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047",
281281
desired_size=2,
282+
max_size=1,
283+
min_size=1,
282284
)
283285
assert_matches_type(PrebuildCreateWarmPoolResponse, prebuild, path=["response"])
284286

@@ -437,6 +439,8 @@ def test_method_update_warm_pool_with_all_params(self, client: Gitpod) -> None:
437439
prebuild = client.prebuilds.update_warm_pool(
438440
warm_pool_id="a1b2c3d4-5678-9abc-def0-1234567890ab",
439441
desired_size=5,
442+
max_size=1,
443+
min_size=1,
440444
)
441445
assert_matches_type(PrebuildUpdateWarmPoolResponse, prebuild, path=["response"])
442446

@@ -723,6 +727,8 @@ async def test_method_create_warm_pool_with_all_params(self, async_client: Async
723727
environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
724728
project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047",
725729
desired_size=2,
730+
max_size=1,
731+
min_size=1,
726732
)
727733
assert_matches_type(PrebuildCreateWarmPoolResponse, prebuild, path=["response"])
728734

@@ -881,6 +887,8 @@ async def test_method_update_warm_pool_with_all_params(self, async_client: Async
881887
prebuild = await async_client.prebuilds.update_warm_pool(
882888
warm_pool_id="a1b2c3d4-5678-9abc-def0-1234567890ab",
883889
desired_size=5,
890+
max_size=1,
891+
min_size=1,
884892
)
885893
assert_matches_type(PrebuildUpdateWarmPoolResponse, prebuild, path=["response"])
886894

0 commit comments

Comments
 (0)