Skip to content

Commit f43231d

Browse files
feat: [google-cloud-monitoring] Added CloudRun, GkeNamespace, GkeWorkload, GkeService, and BasicService service types (#12581)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: Added CloudRun, GkeNamespace, GkeWorkload, GkeService, and BasicService service types docs: Updated comments accordingly END_COMMIT_OVERRIDE PiperOrigin-RevId: 625351698 Source-Link: googleapis/googleapis@79687e2 Source-Link: googleapis/googleapis-gen@942d807 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1vbml0b3JpbmcvLk93bEJvdC55YW1sIiwiaCI6Ijk0MmQ4MDc3ODY1YjNmNjA4NDk1NjJmMjYyMTk3OTAzNjI3OThmZTgifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 69cfd79 commit f43231d

4 files changed

Lines changed: 246 additions & 12 deletions

File tree

packages/google-cloud-monitoring/google/cloud/monitoring/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.20.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-monitoring/google/cloud/monitoring_v3/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.20.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-monitoring/google/cloud/monitoring_v3/types/service.py

Lines changed: 243 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Service(proto.Message):
5353
5454
Attributes:
5555
name (str):
56-
Resource name for this Service. The format is:
56+
Identifier. Resource name for this Service. The format is:
5757
5858
::
5959
@@ -89,6 +89,28 @@ class Service(proto.Message):
8989
here <https://istio.io/latest/docs/reference/config/metrics/>`__
9090
9191
This field is a member of `oneof`_ ``identifier``.
92+
cloud_run (google.cloud.monitoring_v3.types.Service.CloudRun):
93+
Type used for Cloud Run services.
94+
95+
This field is a member of `oneof`_ ``identifier``.
96+
gke_namespace (google.cloud.monitoring_v3.types.Service.GkeNamespace):
97+
Type used for GKE Namespaces.
98+
99+
This field is a member of `oneof`_ ``identifier``.
100+
gke_workload (google.cloud.monitoring_v3.types.Service.GkeWorkload):
101+
Type used for GKE Workloads.
102+
103+
This field is a member of `oneof`_ ``identifier``.
104+
gke_service (google.cloud.monitoring_v3.types.Service.GkeService):
105+
Type used for GKE Services (the Kubernetes
106+
concept of a service).
107+
108+
This field is a member of `oneof`_ ``identifier``.
109+
basic_service (google.cloud.monitoring_v3.types.Service.BasicService):
110+
Message that contains the service type and service labels of
111+
this service if it is a basic service. Documentation and
112+
examples
113+
`here <https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli>`__.
92114
telemetry (google.cloud.monitoring_v3.types.Service.Telemetry):
93115
Configuration for how to query telemetry on a
94116
Service.
@@ -106,8 +128,9 @@ class Service(proto.Message):
106128
"""
107129

108130
class Custom(proto.Message):
109-
r"""Custom view of service telemetry. Currently a place-holder
110-
pending final design.
131+
r"""Use a custom service to designate a service that you want to
132+
monitor when none of the other service types (like App Engine,
133+
Cloud Run, or a GKE type) matches your intended service.
111134
112135
"""
113136

@@ -119,8 +142,8 @@ class AppEngine(proto.Message):
119142
module_id (str):
120143
The ID of the App Engine module underlying this service.
121144
Corresponds to the ``module_id`` resource label in the
122-
``gae_app`` monitored resource:
123-
https://cloud.google.com/monitoring/api/resources#tag_gae_app
145+
```gae_app`` monitored
146+
resource <https://cloud.google.com/monitoring/api/resources#tag_gae_app>`__.
124147
"""
125148

126149
module_id: str = proto.Field(
@@ -136,8 +159,8 @@ class CloudEndpoints(proto.Message):
136159
service (str):
137160
The name of the Cloud Endpoints service underlying this
138161
service. Corresponds to the ``service`` resource label in
139-
the ``api`` monitored resource:
140-
https://cloud.google.com/monitoring/api/resources#tag_api
162+
the ```api`` monitored
163+
resource <https://cloud.google.com/monitoring/api/resources#tag_api>`__.
141164
"""
142165

143166
service: str = proto.Field(
@@ -256,6 +279,188 @@ class IstioCanonicalService(proto.Message):
256279
number=4,
257280
)
258281

282+
class CloudRun(proto.Message):
283+
r"""Cloud Run service. Learn more at
284+
https://cloud.google.com/run.
285+
286+
Attributes:
287+
service_name (str):
288+
The name of the Cloud Run service. Corresponds to the
289+
``service_name`` resource label in the
290+
```cloud_run_revision`` monitored
291+
resource <https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision>`__.
292+
location (str):
293+
The location the service is run. Corresponds to the
294+
``location`` resource label in the ```cloud_run_revision``
295+
monitored
296+
resource <https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision>`__.
297+
"""
298+
299+
service_name: str = proto.Field(
300+
proto.STRING,
301+
number=1,
302+
)
303+
location: str = proto.Field(
304+
proto.STRING,
305+
number=2,
306+
)
307+
308+
class GkeNamespace(proto.Message):
309+
r"""GKE Namespace. The field names correspond to the resource metadata
310+
labels on monitored resources that fall under a namespace (for
311+
example, ``k8s_container`` or ``k8s_pod``).
312+
313+
Attributes:
314+
project_id (str):
315+
Output only. The project this resource lives in. For legacy
316+
services migrated from the ``Custom`` type, this may be a
317+
distinct project from the one parenting the service itself.
318+
location (str):
319+
The location of the parent cluster. This may
320+
be a zone or region.
321+
cluster_name (str):
322+
The name of the parent cluster.
323+
namespace_name (str):
324+
The name of this namespace.
325+
"""
326+
327+
project_id: str = proto.Field(
328+
proto.STRING,
329+
number=1,
330+
)
331+
location: str = proto.Field(
332+
proto.STRING,
333+
number=2,
334+
)
335+
cluster_name: str = proto.Field(
336+
proto.STRING,
337+
number=3,
338+
)
339+
namespace_name: str = proto.Field(
340+
proto.STRING,
341+
number=4,
342+
)
343+
344+
class GkeWorkload(proto.Message):
345+
r"""A GKE Workload (Deployment, StatefulSet, etc). The field names
346+
correspond to the metadata labels on monitored resources that fall
347+
under a workload (for example, ``k8s_container`` or ``k8s_pod``).
348+
349+
Attributes:
350+
project_id (str):
351+
Output only. The project this resource lives in. For legacy
352+
services migrated from the ``Custom`` type, this may be a
353+
distinct project from the one parenting the service itself.
354+
location (str):
355+
The location of the parent cluster. This may
356+
be a zone or region.
357+
cluster_name (str):
358+
The name of the parent cluster.
359+
namespace_name (str):
360+
The name of the parent namespace.
361+
top_level_controller_type (str):
362+
The type of this workload (for example,
363+
"Deployment" or "DaemonSet")
364+
top_level_controller_name (str):
365+
The name of this workload.
366+
"""
367+
368+
project_id: str = proto.Field(
369+
proto.STRING,
370+
number=1,
371+
)
372+
location: str = proto.Field(
373+
proto.STRING,
374+
number=2,
375+
)
376+
cluster_name: str = proto.Field(
377+
proto.STRING,
378+
number=3,
379+
)
380+
namespace_name: str = proto.Field(
381+
proto.STRING,
382+
number=4,
383+
)
384+
top_level_controller_type: str = proto.Field(
385+
proto.STRING,
386+
number=5,
387+
)
388+
top_level_controller_name: str = proto.Field(
389+
proto.STRING,
390+
number=6,
391+
)
392+
393+
class GkeService(proto.Message):
394+
r"""GKE Service. The "service" here represents a `Kubernetes service
395+
object <https://kubernetes.io/docs/concepts/services-networking/service>`__.
396+
The field names correspond to the resource labels on
397+
```k8s_service`` monitored
398+
resources <https://cloud.google.com/monitoring/api/resources#tag_k8s_service>`__.
399+
400+
Attributes:
401+
project_id (str):
402+
Output only. The project this resource lives in. For legacy
403+
services migrated from the ``Custom`` type, this may be a
404+
distinct project from the one parenting the service itself.
405+
location (str):
406+
The location of the parent cluster. This may
407+
be a zone or region.
408+
cluster_name (str):
409+
The name of the parent cluster.
410+
namespace_name (str):
411+
The name of the parent namespace.
412+
service_name (str):
413+
The name of this service.
414+
"""
415+
416+
project_id: str = proto.Field(
417+
proto.STRING,
418+
number=1,
419+
)
420+
location: str = proto.Field(
421+
proto.STRING,
422+
number=2,
423+
)
424+
cluster_name: str = proto.Field(
425+
proto.STRING,
426+
number=3,
427+
)
428+
namespace_name: str = proto.Field(
429+
proto.STRING,
430+
number=4,
431+
)
432+
service_name: str = proto.Field(
433+
proto.STRING,
434+
number=5,
435+
)
436+
437+
class BasicService(proto.Message):
438+
r"""A well-known service type, defined by its service type and service
439+
labels. Documentation and examples
440+
`here <https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli>`__.
441+
442+
Attributes:
443+
service_type (str):
444+
The type of service that this basic service defines, e.g.
445+
APP_ENGINE service type. Documentation and valid values
446+
`here <https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli>`__.
447+
service_labels (MutableMapping[str, str]):
448+
Labels that specify the resource that emits the monitoring
449+
data which is used for SLO reporting of this ``Service``.
450+
Documentation and valid values for given service types
451+
`here <https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli>`__.
452+
"""
453+
454+
service_type: str = proto.Field(
455+
proto.STRING,
456+
number=1,
457+
)
458+
service_labels: MutableMapping[str, str] = proto.MapField(
459+
proto.STRING,
460+
proto.STRING,
461+
number=2,
462+
)
463+
259464
class Telemetry(proto.Message):
260465
r"""Configuration for how to query telemetry on a Service.
261466
@@ -315,6 +520,35 @@ class Telemetry(proto.Message):
315520
oneof="identifier",
316521
message=IstioCanonicalService,
317522
)
523+
cloud_run: CloudRun = proto.Field(
524+
proto.MESSAGE,
525+
number=12,
526+
oneof="identifier",
527+
message=CloudRun,
528+
)
529+
gke_namespace: GkeNamespace = proto.Field(
530+
proto.MESSAGE,
531+
number=15,
532+
oneof="identifier",
533+
message=GkeNamespace,
534+
)
535+
gke_workload: GkeWorkload = proto.Field(
536+
proto.MESSAGE,
537+
number=16,
538+
oneof="identifier",
539+
message=GkeWorkload,
540+
)
541+
gke_service: GkeService = proto.Field(
542+
proto.MESSAGE,
543+
number=17,
544+
oneof="identifier",
545+
message=GkeService,
546+
)
547+
basic_service: BasicService = proto.Field(
548+
proto.MESSAGE,
549+
number=19,
550+
message=BasicService,
551+
)
318552
telemetry: Telemetry = proto.Field(
319553
proto.MESSAGE,
320554
number=13,
@@ -346,8 +580,8 @@ class ServiceLevelObjective(proto.Message):
346580
347581
Attributes:
348582
name (str):
349-
Resource name for this ``ServiceLevelObjective``. The format
350-
is:
583+
Identifier. Resource name for this
584+
``ServiceLevelObjective``. The format is:
351585
352586
::
353587

packages/google-cloud-monitoring/samples/generated_samples/snippet_metadata_google.monitoring.v3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-monitoring",
11-
"version": "2.20.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)