googleapis / googleapis/google-cloud-python

monitoring_dashboard: DashboardFilter adding new fields into proto.

未关闭
#17,951 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
api: monitoring priority: p3 type: feature request
主要语言
Python
星标
5.4k
派生
1.8k
平均合并
3 天 4 小时
30 天内合并 PR
122

描述

### Determine this is the right repository

- [x] I determined this is the correct repository in which to report this feature request.

### Summary of the feature request

DashboardFilter only exposes label_key, template_variable, string_value, and filter_type:
https://github.com/googleapis/google-cloud-python/blob/google-cloud-monitoring-dashboards-v2.22.0/packages/google-cloud-monitoring-dashboards/google/cloud/monitoring_dashboard_v1/types/dashboard_filter.py

However:

The REST API supports valueType (STRING / STRING_ARRAY) and stringArrayValue for value-only dashboard variables that accept multiple values — documented here: https://docs.cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards#DashboardFilter

This mismatch means the generated proto/client is behind the actual API surface, and there's no way to construct or parse a STRING_ARRAY-type dashboard filter/variable using the typed Python client — only via raw REST calls.

### Desired code experience

file: dashboard_filter.py
```python
class ValueType(proto.Enum):
r"""The type of the filter value
Values:
VALUE_TYPE_UNSPECIFIED (0):
Value type is unspecified
STRING (1):
String type
STRING_ARRAY (2):
String array type
"""

VALUE_TYPE_UNSPECIFIED = 0
STRING = 1
STRING_ARRAY = 2

value_type: ValueType = proto.Field(
proto.ENUM,
number=6,
enum=ValueType,
)
stringArrayValue: StringArray = proto.Field(
proto.MESSAGE,
number=7,
message=StringArray,
)
```

### Expected results

_e.g. `dashboardFilter.stringArrayValue` should return { values: [] }

### API client name and version

google-cloud-monitoring-dashboards v2.22.0

### Use case

This feature will allow users to retrieve stored values saved in Dashboard Settings -> Filters/Variables.

### Additional context

_No response_

贡献指南

打开贡献指南

调研方向

Start with packages/google-cloud-monitoring-dashboards/google/cloud/monitoring_dashboard_v1/types/dashboard_filter.py and compare DashboardFilter with the linked REST API documentation. Verify how the existing fields are defined and how generated types are tested; done means valueType and stringArrayValue can be constructed, serialized, parsed, and expose the expected STRING_ARRAY values.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
62/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。