|
| 1 | +// Copyright 2024 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +syntax = "proto3"; |
| 16 | + |
| 17 | +package google.cloud.aiplatform.v1beta1; |
| 18 | + |
| 19 | +import "google/api/field_behavior.proto"; |
| 20 | +import "google/api/resource.proto"; |
| 21 | +import "google/protobuf/struct.proto"; |
| 22 | +import "google/protobuf/timestamp.proto"; |
| 23 | +import "google/type/interval.proto"; |
| 24 | + |
| 25 | +option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1"; |
| 26 | +option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb"; |
| 27 | +option java_multiple_files = true; |
| 28 | +option java_outer_classname = "FeatureMonitorProto"; |
| 29 | +option java_package = "com.google.cloud.aiplatform.v1beta1"; |
| 30 | +option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1"; |
| 31 | +option ruby_package = "Google::Cloud::AIPlatform::V1beta1"; |
| 32 | + |
| 33 | +// Vertex AI Feature Monitor. |
| 34 | +message FeatureMonitor { |
| 35 | + option (google.api.resource) = { |
| 36 | + type: "aiplatform.googleapis.com/FeatureMonitor" |
| 37 | + pattern: "projects/{project}/locations/{location}/featureGroups/{feature_group}/featureMonitors/{feature_monitor}" |
| 38 | + plural: "featureMonitors" |
| 39 | + singular: "featureMonitor" |
| 40 | + }; |
| 41 | + |
| 42 | + // Identifier. Name of the FeatureMonitor. Format: |
| 43 | + // `projects/{project}/locations/{location}/featureGroups/{featureGroup}/featureMonitors/{featureMonitor}` |
| 44 | + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; |
| 45 | + |
| 46 | + // Output only. Timestamp when this FeatureMonitor was created. |
| 47 | + google.protobuf.Timestamp create_time = 2 |
| 48 | + [(google.api.field_behavior) = OUTPUT_ONLY]; |
| 49 | + |
| 50 | + // Output only. Timestamp when this FeatureMonitor was last updated. |
| 51 | + google.protobuf.Timestamp update_time = 3 |
| 52 | + [(google.api.field_behavior) = OUTPUT_ONLY]; |
| 53 | + |
| 54 | + // Optional. Used to perform consistent read-modify-write updates. If not set, |
| 55 | + // a blind "overwrite" update happens. |
| 56 | + string etag = 4 [(google.api.field_behavior) = OPTIONAL]; |
| 57 | + |
| 58 | + // Optional. The labels with user-defined metadata to organize your |
| 59 | + // FeatureMonitor. |
| 60 | + // |
| 61 | + // Label keys and values can be no longer than 64 characters |
| 62 | + // (Unicode codepoints), can only contain lowercase letters, numeric |
| 63 | + // characters, underscores and dashes. International characters are allowed. |
| 64 | + // |
| 65 | + // See https://goo.gl/xmQnxf for more information on and examples of labels. |
| 66 | + // No more than 64 user labels can be associated with one |
| 67 | + // FeatureMonitor(System labels are excluded)." System reserved label keys |
| 68 | + // are prefixed with "aiplatform.googleapis.com/" and are immutable. |
| 69 | + map<string, string> labels = 5 [(google.api.field_behavior) = OPTIONAL]; |
| 70 | + |
| 71 | + // Optional. Description of the FeatureMonitor. |
| 72 | + string description = 6 [(google.api.field_behavior) = OPTIONAL]; |
| 73 | + |
| 74 | + // Required. Schedule config for the FeatureMonitor. |
| 75 | + ScheduleConfig schedule_config = 7 [(google.api.field_behavior) = REQUIRED]; |
| 76 | + |
| 77 | + // Required. Feature selection config for the FeatureMonitor. |
| 78 | + FeatureSelectionConfig feature_selection_config = 8 |
| 79 | + [(google.api.field_behavior) = REQUIRED]; |
| 80 | +} |
| 81 | + |
| 82 | +// Schedule configuration for the FeatureMonitor. |
| 83 | +message ScheduleConfig { |
| 84 | + // Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled |
| 85 | + // runs. To explicitly set a timezone to the cron tab, apply a prefix in |
| 86 | + // the cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}". |
| 87 | + // The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone |
| 88 | + // database. For example, "CRON_TZ=America/New_York 1 * * * *", or |
| 89 | + // "TZ=America/New_York 1 * * * *". |
| 90 | + string cron = 1; |
| 91 | +} |
| 92 | + |
| 93 | +// Feature selection configuration for the FeatureMonitor. |
| 94 | +message FeatureSelectionConfig { |
| 95 | + // Feature configuration. |
| 96 | + message FeatureConfig { |
| 97 | + // Required. The ID of the feature resource. Final component of the |
| 98 | + // Feature's resource name. |
| 99 | + string feature_id = 1 [(google.api.field_behavior) = REQUIRED]; |
| 100 | + |
| 101 | + // Optional. Drift threshold. If calculated difference with baseline data |
| 102 | + // larger than threshold, it will be considered as the feature has drift. If |
| 103 | + // not present, the threshold will be default to 0.3. |
| 104 | + double drift_threshold = 2 [(google.api.field_behavior) = OPTIONAL]; |
| 105 | + } |
| 106 | + |
| 107 | + // Optional. A list of features to be monitored and each feature's drift |
| 108 | + // threshold. |
| 109 | + repeated FeatureConfig feature_configs = 1 |
| 110 | + [(google.api.field_behavior) = OPTIONAL]; |
| 111 | +} |
| 112 | + |
| 113 | +// Stats and Anomaly generated by FeatureMonitorJobs. Anomaly only includes |
| 114 | +// Drift. |
| 115 | +message FeatureStatsAndAnomaly { |
| 116 | + // Feature Id. |
| 117 | + string feature_id = 1; |
| 118 | + |
| 119 | + // Feature stats. e.g. histogram buckets. |
| 120 | + // In the format of tensorflow.metadata.v0.DatasetFeatureStatistics. |
| 121 | + google.protobuf.Value feature_stats = 2; |
| 122 | + |
| 123 | + // Deviation from the current stats to baseline stats. |
| 124 | + // 1. For categorical feature, the distribution distance is calculated by |
| 125 | + // L-inifinity norm. |
| 126 | + // 2. For numerical feature, the distribution distance is calculated by |
| 127 | + // Jensen–Shannon divergence. |
| 128 | + double distribution_deviation = 3; |
| 129 | + |
| 130 | + // This is the threshold used when detecting drifts, which is set in |
| 131 | + // FeatureMonitor.FeatureSelectionConfig.FeatureConfig.drift_threshold |
| 132 | + double drift_detection_threshold = 4; |
| 133 | + |
| 134 | + // If set to true, indicates current stats is detected as and comparing |
| 135 | + // with baseline stats. |
| 136 | + bool drift_detected = 5; |
| 137 | + |
| 138 | + // The timestamp we take snapshot for feature values to generate stats. |
| 139 | + google.protobuf.Timestamp stats_time = 6; |
| 140 | + |
| 141 | + // The ID of the FeatureMonitorJob that generated this FeatureStatsAndAnomaly. |
| 142 | + int64 feature_monitor_job_id = 7; |
| 143 | + |
| 144 | + // The ID of the FeatureMonitor that this FeatureStatsAndAnomaly generated |
| 145 | + // according to. |
| 146 | + string feature_monitor_id = 8; |
| 147 | +} |
| 148 | + |
| 149 | +// Defines how to select FeatureStatsAndAnomaly to be populated in response. |
| 150 | +// If set, retrieves FeatureStatsAndAnomaly generated by FeatureMonitors based |
| 151 | +// on this spec. |
| 152 | +message FeatureStatsAndAnomalySpec { |
| 153 | + // Optional. If set, returns the most recent count of stats. Valid value is |
| 154 | + // [0, 100]. If stats_time_range is set, return most recent count of stats |
| 155 | + // within the stats_time_range. |
| 156 | + optional int32 latest_stats_count = 1 |
| 157 | + [(google.api.field_behavior) = OPTIONAL]; |
| 158 | + |
| 159 | + // Optional. If set, return all stats generated between [start_time, |
| 160 | + // end_time). If latest_stats_count is set, return the most recent count of |
| 161 | + // stats within the stats_time_range. |
| 162 | + google.type.Interval stats_time_range = 2 |
| 163 | + [(google.api.field_behavior) = OPTIONAL]; |
| 164 | +} |
0 commit comments