Skip to content

Commit

Permalink
feat(metric): model trigger chart record api
Browse files Browse the repository at this point in the history
  • Loading branch information
joremysh committed Oct 28, 2024
1 parent a3fd95f commit 53eb402
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
42 changes: 42 additions & 0 deletions core/mgmt/v1beta/metric.proto
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,41 @@ message ListPipelineTriggerChartRecordsRequest {
optional string filter = 2 [(google.api.field_behavior) = OPTIONAL];
}

// ListModelTriggerChartRecordsRequest represents a request to list model
// trigger metrics, aggregated by model ID and time frame.
message ListModelTriggerChartRecordsRequest {
// The ID of the namespace that requested the model triggers.
string requester_id = 3 [(google.api.field_behavior) = REQUIRED];
// Aggregation window. The value is a positive duration string, i.e. a
// sequence of decimal numbers, each with optional fraction and a unit
// suffix, such as "300ms", "1.5h" or "2h45m".
// The minimum (and default) window is 1h.
optional string aggregation_window = 4;
// Beginning of the time range from which the records will be fetched.
// The default value is the beginning of the current day, in UTC.
optional google.protobuf.Timestamp start = 5;
// End of the time range from which the records will be fetched.
// The default value is the current timestamp.
optional google.protobuf.Timestamp stop = 6;
}

// ListPipelineTriggerChartRecordsResponse contains a list of pipeline trigger
// chart records.
message ListPipelineTriggerChartRecordsResponse {
// A list of pipeline trigger records.
repeated PipelineTriggerChartRecord pipeline_trigger_chart_records = 1;
}

// ListModelTriggerChartRecordsResponse contains a list of model trigger
// chart records.
message ListModelTriggerChartRecordsResponse {
// Model trigger counts. Until we allow filtering or grouping by fields
// like model ID, this list will contain only one element with the
// timeline of trigger counts for a given requester, regardless the model
// ID, trigger mode, final status or other fields.
repeated ModelTriggerChartRecord model_trigger_chart_records = 1;
}

// PipelineTriggerChartRecord contains pipeline trigger metrics, aggregated by
// pipeline ID and time frame.
message PipelineTriggerChartRecord {
Expand Down Expand Up @@ -305,3 +333,17 @@ message ListPipelineTriggerRecordsResponse {
// Total number of pipeline triggers.
int32 total_size = 3;
}

// ModelTriggerChartRecord represents a timeline of model triggers. It
// contains a collection of (timestamp, count) pairs that represent the total
// model triggers in a given time bucket.
message ModelTriggerChartRecord {
// This field will be present present when the information is grouped by model.
optional string model_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Time buckets.
repeated google.protobuf.Timestamp time_buckets = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// Aggregated trigger count in each time bucket.
repeated int32 trigger_counts = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
// The ID of the namespace that requested the model triggers.
string requester_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}
10 changes: 10 additions & 0 deletions core/mgmt/v1beta/mgmt_public_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,16 @@ service MgmtPublicService {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Metric"};
}

// List model trigger time charts
//
// Returns a timeline of model trigger counts for a given requester. The
// response will contain one set of records (datapoints), representing the
// amount of triggers in a time bucket.
rpc ListModelTriggerChartRecords(ListModelTriggerChartRecordsRequest) returns (ListModelTriggerChartRecordsResponse) {
option (google.api.http) = {get: "/v1beta/metrics/vdp/model/model-runs:query-charts"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Metric"};
}

// List Instill Credit consumption time charts
//
// Returns a timeline of Instill Credit consumption for a given owner. The
Expand Down

0 comments on commit 53eb402

Please sign in to comment.