Skip to content

Commit 38f3711

Browse files
feat: add monitoring_config to EntityType in aiplatform v1 entity_type.proto (#1077)
- [ ] Regenerate this pull request now. feat: add disable_monitoring to Feature in aiplatform v1 feature.proto feat: add monitoring_stats_anomalies to Feature in aiplatform v1 feature.proto feat: add staleness_days to SnapshotAnalysis in aiplatform v1 featurestore_monitoring.proto feat: add import_features_analysis to FeaturestoreMonitoringConfig in aiplatform v1 featurestore_monitoring.proto feat: add numerical_threshold_config to FeaturestoreMonitoringConfig in aiplatform v1 featurestore_monitoring.proto feat: add categorical_threshold_config to FeaturestoreMonitoringConfig in aiplatform v1 featurestore_monitoring.proto feat: add objective to MonitoringStatsSpec in aiplatform v1 featurestore_service.proto feat: add disable_monitoring to Feature in aiplatform v1beta1 feature.proto feat: add monitoring_stats_anomalies to Feature in aiplatform v1beta1 feature.proto feat: add staleness_days to SnapshotAnalysis in aiplatform v1beta1 featurestore_monitoring.proto feat: add import_features_analysis to FeaturestoreMonitoringConfig in aiplatform v1beta1 featurestore_monitoring.proto feat: add numerical_threshold_config to FeaturestoreMonitoringConfig in aiplatform v1beta1 featurestore_monitoring.proto feat: add categorical_threshold_config to FeaturestoreMonitoringConfig in aiplatform v1beta1 featurestore_monitoring.proto feat: add objective to MonitoringStatsSpec in aiplatform v1beta1 featurestore_service.proto PiperOrigin-RevId: 434018027 Source-Link: googleapis/googleapis@90f38d1 Source-Link: googleapis/googleapis-gen@f6adb41 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjZhZGI0MTAzMzBiZDUyZDdiNTM5ZDQzMjJlNjZjYzQ2MDNiYTM0YSJ9
1 parent 6995e54 commit 38f3711

File tree

15 files changed

+455
-18
lines changed

15 files changed

+455
-18
lines changed

google/cloud/aiplatform_v1/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
from .types.feature_selector import FeatureSelector
132132
from .types.feature_selector import IdMatcher
133133
from .types.featurestore import Featurestore
134+
from .types.featurestore_monitoring import FeaturestoreMonitoringConfig
134135
from .types.featurestore_online_service import FeatureValue
135136
from .types.featurestore_online_service import FeatureValueList
136137
from .types.featurestore_online_service import ReadFeatureValuesRequest
@@ -672,6 +673,7 @@
672673
"FeatureValueDestination",
673674
"FeatureValueList",
674675
"Featurestore",
676+
"FeaturestoreMonitoringConfig",
675677
"FeaturestoreOnlineServingServiceClient",
676678
"FeaturestoreServiceClient",
677679
"FilterSplit",

google/cloud/aiplatform_v1/services/featurestore_service/async_client.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from google.cloud.aiplatform_v1.types import feature as gca_feature
4242
from google.cloud.aiplatform_v1.types import featurestore
4343
from google.cloud.aiplatform_v1.types import featurestore as gca_featurestore
44+
from google.cloud.aiplatform_v1.types import featurestore_monitoring
4445
from google.cloud.aiplatform_v1.types import featurestore_service
4546
from google.cloud.aiplatform_v1.types import operation as gca_operation
4647
from google.protobuf import empty_pb2 # type: ignore
@@ -1202,7 +1203,12 @@ def sample_update_entity_type():
12021203
- ``description``
12031204
- ``labels``
12041205
- ``monitoring_config.snapshot_analysis.disabled``
1205-
- ``monitoring_config.snapshot_analysis.monitoring_interval``
1206+
- ``monitoring_config.snapshot_analysis.monitoring_interval_days``
1207+
- ``monitoring_config.snapshot_analysis.staleness_days``
1208+
- ``monitoring_config.import_features_analysis.state``
1209+
- ``monitoring_config.import_features_analysis.anomaly_detection_baseline``
1210+
- ``monitoring_config.numerical_threshold_config.value``
1211+
- ``monitoring_config.categorical_threshold_config.value``
12061212
12071213
This corresponds to the ``update_mask`` field
12081214
on the ``request`` instance; if ``request`` is provided, this
@@ -1912,8 +1918,7 @@ def sample_update_feature():
19121918
19131919
- ``description``
19141920
- ``labels``
1915-
- ``monitoring_config.snapshot_analysis.disabled``
1916-
- ``monitoring_config.snapshot_analysis.monitoring_interval``
1921+
- ``disable_monitoring``
19171922
19181923
This corresponds to the ``update_mask`` field
19191924
on the ``request`` instance; if ``request`` is provided, this

google/cloud/aiplatform_v1/services/featurestore_service/client.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from google.cloud.aiplatform_v1.types import feature as gca_feature
4545
from google.cloud.aiplatform_v1.types import featurestore
4646
from google.cloud.aiplatform_v1.types import featurestore as gca_featurestore
47+
from google.cloud.aiplatform_v1.types import featurestore_monitoring
4748
from google.cloud.aiplatform_v1.types import featurestore_service
4849
from google.cloud.aiplatform_v1.types import operation as gca_operation
4950
from google.protobuf import empty_pb2 # type: ignore
@@ -1435,7 +1436,12 @@ def sample_update_entity_type():
14351436
- ``description``
14361437
- ``labels``
14371438
- ``monitoring_config.snapshot_analysis.disabled``
1438-
- ``monitoring_config.snapshot_analysis.monitoring_interval``
1439+
- ``monitoring_config.snapshot_analysis.monitoring_interval_days``
1440+
- ``monitoring_config.snapshot_analysis.staleness_days``
1441+
- ``monitoring_config.import_features_analysis.state``
1442+
- ``monitoring_config.import_features_analysis.anomaly_detection_baseline``
1443+
- ``monitoring_config.numerical_threshold_config.value``
1444+
- ``monitoring_config.categorical_threshold_config.value``
14391445
14401446
This corresponds to the ``update_mask`` field
14411447
on the ``request`` instance; if ``request`` is provided, this
@@ -2145,8 +2151,7 @@ def sample_update_feature():
21452151
21462152
- ``description``
21472153
- ``labels``
2148-
- ``monitoring_config.snapshot_analysis.disabled``
2149-
- ``monitoring_config.snapshot_analysis.monitoring_interval``
2154+
- ``disable_monitoring``
21502155
21512156
This corresponds to the ``update_mask`` field
21522157
on the ``request`` instance; if ``request`` is provided, this

google/cloud/aiplatform_v1/types/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
IdMatcher,
111111
)
112112
from .featurestore import Featurestore
113+
from .featurestore_monitoring import FeaturestoreMonitoringConfig
113114
from .featurestore_online_service import (
114115
FeatureValue,
115116
FeatureValueList,
@@ -585,6 +586,7 @@
585586
"FeatureSelector",
586587
"IdMatcher",
587588
"Featurestore",
589+
"FeaturestoreMonitoringConfig",
588590
"FeatureValue",
589591
"FeatureValueList",
590592
"ReadFeatureValuesRequest",

google/cloud/aiplatform_v1/types/entity_type.py

+16
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#
1616
import proto # type: ignore
1717

18+
from google.cloud.aiplatform_v1.types import featurestore_monitoring
1819
from google.protobuf import timestamp_pb2 # type: ignore
1920

2021

@@ -65,6 +66,16 @@ class EntityType(proto.Message):
6566
Optional. Used to perform a consistent
6667
read-modify-write updates. If not set, a blind
6768
"overwrite" update happens.
69+
monitoring_config (google.cloud.aiplatform_v1.types.FeaturestoreMonitoringConfig):
70+
Optional. The default monitoring configuration for all
71+
Features with value type
72+
([Feature.ValueType][google.cloud.aiplatform.v1.Feature.ValueType])
73+
BOOL, STRING, DOUBLE or INT64 under this EntityType.
74+
75+
If this is populated with
76+
[FeaturestoreMonitoringConfig.monitoring_interval]
77+
specified, snapshot analysis monitoring is enabled.
78+
Otherwise, snapshot analysis monitoring is disabled.
6879
"""
6980

7081
name = proto.Field(proto.STRING, number=1,)
@@ -73,6 +84,11 @@ class EntityType(proto.Message):
7384
update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,)
7485
labels = proto.MapField(proto.STRING, proto.STRING, number=6,)
7586
etag = proto.Field(proto.STRING, number=7,)
87+
monitoring_config = proto.Field(
88+
proto.MESSAGE,
89+
number=8,
90+
message=featurestore_monitoring.FeaturestoreMonitoringConfig,
91+
)
7692

7793

7894
__all__ = tuple(sorted(__protobuf__.manifest))

google/cloud/aiplatform_v1/types/feature.py

+53
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#
1616
import proto # type: ignore
1717

18+
from google.cloud.aiplatform_v1.types import feature_monitoring_stats
1819
from google.protobuf import timestamp_pb2 # type: ignore
1920

2021

@@ -66,6 +67,18 @@ class Feature(proto.Message):
6667
Used to perform a consistent
6768
read-modify-write updates. If not set, a blind
6869
"overwrite" update happens.
70+
disable_monitoring (bool):
71+
Optional. If not set, use the monitoring_config defined for
72+
the EntityType this Feature belongs to. Only Features with
73+
type
74+
([Feature.ValueType][google.cloud.aiplatform.v1.Feature.ValueType])
75+
BOOL, STRING, DOUBLE or INT64 can enable monitoring.
76+
77+
If set to true, all types of data monitoring are disabled
78+
despite the config on EntityType.
79+
monitoring_stats_anomalies (Sequence[google.cloud.aiplatform_v1.types.Feature.MonitoringStatsAnomaly]):
80+
Output only. The list of historical stats and
81+
anomalies with specified objectives.
6982
"""
7083

7184
class ValueType(proto.Enum):
@@ -81,13 +94,53 @@ class ValueType(proto.Enum):
8194
STRING_ARRAY = 12
8295
BYTES = 13
8396

97+
class MonitoringStatsAnomaly(proto.Message):
98+
r"""A list of historical [Snapshot
99+
Analysis][FeaturestoreMonitoringConfig.SnapshotAnalysis] or [Import
100+
Feature Analysis]
101+
[FeaturestoreMonitoringConfig.ImportFeatureAnalysis] stats requested
102+
by user, sorted by
103+
[FeatureStatsAnomaly.start_time][google.cloud.aiplatform.v1.FeatureStatsAnomaly.start_time]
104+
descending.
105+
106+
Attributes:
107+
objective (google.cloud.aiplatform_v1.types.Feature.MonitoringStatsAnomaly.Objective):
108+
Output only. The objective for each stats.
109+
feature_stats_anomaly (google.cloud.aiplatform_v1.types.FeatureStatsAnomaly):
110+
Output only. The stats and anomalies
111+
generated at specific timestamp.
112+
"""
113+
114+
class Objective(proto.Enum):
115+
r"""If the objective in the request is both
116+
Import Feature Analysis and Snapshot Analysis, this objective
117+
could be one of them. Otherwise, this objective should be the
118+
same as the objective in the request.
119+
"""
120+
OBJECTIVE_UNSPECIFIED = 0
121+
IMPORT_FEATURE_ANALYSIS = 1
122+
SNAPSHOT_ANALYSIS = 2
123+
124+
objective = proto.Field(
125+
proto.ENUM, number=1, enum="Feature.MonitoringStatsAnomaly.Objective",
126+
)
127+
feature_stats_anomaly = proto.Field(
128+
proto.MESSAGE,
129+
number=2,
130+
message=feature_monitoring_stats.FeatureStatsAnomaly,
131+
)
132+
84133
name = proto.Field(proto.STRING, number=1,)
85134
description = proto.Field(proto.STRING, number=2,)
86135
value_type = proto.Field(proto.ENUM, number=3, enum=ValueType,)
87136
create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,)
88137
update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,)
89138
labels = proto.MapField(proto.STRING, proto.STRING, number=6,)
90139
etag = proto.Field(proto.STRING, number=7,)
140+
disable_monitoring = proto.Field(proto.BOOL, number=12,)
141+
monitoring_stats_anomalies = proto.RepeatedField(
142+
proto.MESSAGE, number=11, message=MonitoringStatsAnomaly,
143+
)
91144

92145

93146
__all__ = tuple(sorted(__protobuf__.manifest))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
import proto # type: ignore
17+
18+
19+
__protobuf__ = proto.module(
20+
package="google.cloud.aiplatform.v1", manifest={"FeaturestoreMonitoringConfig",},
21+
)
22+
23+
24+
class FeaturestoreMonitoringConfig(proto.Message):
25+
r"""Configuration of how features in Featurestore are monitored.
26+
27+
Attributes:
28+
snapshot_analysis (google.cloud.aiplatform_v1.types.FeaturestoreMonitoringConfig.SnapshotAnalysis):
29+
The config for Snapshot Analysis Based
30+
Feature Monitoring.
31+
import_features_analysis (google.cloud.aiplatform_v1.types.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis):
32+
The config for ImportFeatures Analysis Based
33+
Feature Monitoring.
34+
numerical_threshold_config (google.cloud.aiplatform_v1.types.FeaturestoreMonitoringConfig.ThresholdConfig):
35+
Threshold for numerical features of anomaly detection. This
36+
is shared by all objectives of Featurestore Monitoring for
37+
numerical features (i.e. Features with type
38+
([Feature.ValueType][google.cloud.aiplatform.v1.Feature.ValueType])
39+
DOUBLE or INT64).
40+
categorical_threshold_config (google.cloud.aiplatform_v1.types.FeaturestoreMonitoringConfig.ThresholdConfig):
41+
Threshold for categorical features of anomaly detection.
42+
This is shared by all types of Featurestore Monitoring for
43+
categorical features (i.e. Features with type
44+
([Feature.ValueType][google.cloud.aiplatform.v1.Feature.ValueType])
45+
BOOL or STRING).
46+
"""
47+
48+
class SnapshotAnalysis(proto.Message):
49+
r"""Configuration of the Featurestore's Snapshot Analysis Based
50+
Monitoring. This type of analysis generates statistics for each
51+
Feature based on a snapshot of the latest feature value of each
52+
entities every monitoring_interval.
53+
54+
Attributes:
55+
disabled (bool):
56+
The monitoring schedule for snapshot analysis. For
57+
EntityType-level config: unset / disabled = true indicates
58+
disabled by default for Features under it; otherwise by
59+
default enable snapshot analysis monitoring with
60+
monitoring_interval for Features under it. Feature-level
61+
config: disabled = true indicates disabled regardless of the
62+
EntityType-level config; unset monitoring_interval indicates
63+
going with EntityType-level config; otherwise run snapshot
64+
analysis monitoring with monitoring_interval regardless of
65+
the EntityType-level config. Explicitly Disable the snapshot
66+
analysis based monitoring.
67+
monitoring_interval_days (int):
68+
Configuration of the snapshot analysis based monitoring
69+
pipeline running interval. The value indicates number of
70+
days. If both
71+
[FeaturestoreMonitoringConfig.SnapshotAnalysis.monitoring_interval_days][google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.SnapshotAnalysis.monitoring_interval_days]
72+
and
73+
[FeaturestoreMonitoringConfig.SnapshotAnalysis.monitoring_interval][]
74+
are set when creating/updating EntityTypes/Features,
75+
[FeaturestoreMonitoringConfig.SnapshotAnalysis.monitoring_interval_days][google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.SnapshotAnalysis.monitoring_interval_days]
76+
will be used.
77+
staleness_days (int):
78+
Customized export features time window for
79+
snapshot analysis. Unit is one day. Default
80+
value is 3 weeks. Minimum value is 1 day.
81+
Maximum value is 4000 days.
82+
"""
83+
84+
disabled = proto.Field(proto.BOOL, number=1,)
85+
monitoring_interval_days = proto.Field(proto.INT32, number=3,)
86+
staleness_days = proto.Field(proto.INT32, number=4,)
87+
88+
class ImportFeaturesAnalysis(proto.Message):
89+
r"""Configuration of the Featurestore's ImportFeature Analysis Based
90+
Monitoring. This type of analysis generates statistics for values of
91+
each Feature imported by every [ImportFeatureValues][] operation.
92+
93+
Attributes:
94+
state (google.cloud.aiplatform_v1.types.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis.State):
95+
Whether to enable / disable / inherite
96+
default hebavior for import features analysis.
97+
anomaly_detection_baseline (google.cloud.aiplatform_v1.types.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis.Baseline):
98+
The baseline used to do anomaly detection for
99+
the statistics generated by import features
100+
analysis.
101+
"""
102+
103+
class State(proto.Enum):
104+
r"""The state defines whether to enable ImportFeature analysis."""
105+
STATE_UNSPECIFIED = 0
106+
DEFAULT = 1
107+
ENABLED = 2
108+
DISABLED = 3
109+
110+
class Baseline(proto.Enum):
111+
r"""Defines the baseline to do anomaly detection for feature values
112+
imported by each [ImportFeatureValues][] operation.
113+
"""
114+
BASELINE_UNSPECIFIED = 0
115+
LATEST_STATS = 1
116+
MOST_RECENT_SNAPSHOT_STATS = 2
117+
PREVIOUS_IMPORT_FEATURES_STATS = 3
118+
119+
state = proto.Field(
120+
proto.ENUM,
121+
number=1,
122+
enum="FeaturestoreMonitoringConfig.ImportFeaturesAnalysis.State",
123+
)
124+
anomaly_detection_baseline = proto.Field(
125+
proto.ENUM,
126+
number=2,
127+
enum="FeaturestoreMonitoringConfig.ImportFeaturesAnalysis.Baseline",
128+
)
129+
130+
class ThresholdConfig(proto.Message):
131+
r"""The config for Featurestore Monitoring threshold.
132+
133+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
134+
135+
Attributes:
136+
value (float):
137+
Specify a threshold value that can trigger
138+
the alert. 1. For categorical feature, the
139+
distribution distance is calculated by
140+
L-inifinity norm.
141+
2. For numerical feature, the distribution
142+
distance is calculated by Jensen–Shannon
143+
divergence. Each feature must have a non-zero
144+
threshold if they need to be monitored.
145+
Otherwise no alert will be triggered for that
146+
feature.
147+
148+
This field is a member of `oneof`_ ``threshold``.
149+
"""
150+
151+
value = proto.Field(proto.DOUBLE, number=1, oneof="threshold",)
152+
153+
snapshot_analysis = proto.Field(proto.MESSAGE, number=1, message=SnapshotAnalysis,)
154+
import_features_analysis = proto.Field(
155+
proto.MESSAGE, number=2, message=ImportFeaturesAnalysis,
156+
)
157+
numerical_threshold_config = proto.Field(
158+
proto.MESSAGE, number=3, message=ThresholdConfig,
159+
)
160+
categorical_threshold_config = proto.Field(
161+
proto.MESSAGE, number=4, message=ThresholdConfig,
162+
)
163+
164+
165+
__all__ = tuple(sorted(__protobuf__.manifest))

0 commit comments

Comments
 (0)