Metrics API
For a brief overview of GraphQL itself, please consult our introduction.
Average Metric Value
Metrics are associated with models; therefore, we utilize the model node to query for the average metric value.
AveragePerformanceQuery(
$dataset: ModelDatasetInput,
$performanceMetric: PerformanceMetric!,
$predictionValueClass: String,
$timeZone: String!,
$id: ID!) {
node(id: $id) {
... on Model {
averagePerformanceMetric(
performanceMetric: $performanceMetric
positiveClass: $predictionValueClass
timeZone: $timeZone
dataset: $dataset
)
}
}
}
Variables
{
"dataset": {
"startTime": "2024-06-25T06:00:00.000Z", #target start time
"endTime": "2024-07-26T05:59:59.999Z", #target end time
"externalModelVersionIds": [],
"externalBatchIds": [],
"environmentName": "production",
"filters": []
},
"performanceMetric": "TargetMetric",
"predictionValueClass": "positiveClassValue",
"timeZone": "time/zone", #The timezone of the request, used to determine the localized offset from UTC.
"id": "model_id"
}
query AveragePerformanceQuery(
$dataset: ModelDatasetInput,
$customMetricConfig: String,
$timeZone: String!,
$id: ID!) {
node(id: $id) {
__typename
... on Model {
averagePerformanceMetric(
performanceMetric: udf
timeZone: $timeZone
dataset: $dataset
customMetricConfig: $customMetricConfig
)
}
}
}
Variables
{
"dataset": {
"startTime": "2024-06-25T06:00:00.000Z", #target start time
"endTime": "2024-07-26T05:59:59.999Z", #target end time
"externalModelVersionIds": [],
"externalBatchIds": [],
"environmentName": "production",
"filters": []
},
"customMetricConfig": "select count(*) from model", #udf in SQL syntax
"timeZone": "time/zone", #The timezone of the request, used to determine the localized offset from UTC.
"id": "model_id"
}
Metric Over Time
To analyze metric values over time or plot reconstruction, use the following query
query AveragePerformanceQuery(
$performanceMetric: PerformanceMetric!
$positiveClass:String!
$startTime: DateTime!
$endTime: DateTime!
$timeZone: String!,
$id: ID!
$environmentName: ModelEnvironmentName!
$timeSeriesDataGranularity:DataGranularity!
) {
node(id: $id) {
__typename
... on Model {
performanceMetricOverTime(
performanceMetric: $performanceMetric
timeZone: $timeZone,
startTime: $startTime,
endTime: $endTime,
externalModelVersionIds: [],
externalBatchIds: [],
environmentName: $environmentName,
timeSeriesDataGranularity: $timeSeriesDataGranularity
filters: []
positiveClass: $positiveClass
){
dataPoints{
x
y
}
}
}
id
}
}
Variables
{
"performanceMetric": "metric",
"positiveClass": "positive_class_value",
"timeZone": "time/zome", #The timezone of the request, used to determine the localized offset from UTC.
"id": "model_id",
"startTime": "2024-06-25T06:00:00.000Z",
"endTime": "2024-07-26T05:59:59.999Z",
"environmentName": "production",
"timeSeriesDataGranularity": "month", #desired granularity
}
query AveragePerformanceQuery(
$startTime: DateTime!
$endTime: DateTime!
$timeZone: String!,
$id: ID!
$environmentName: ModelEnvironmentName!
$timeSeriesDataGranularity:DataGranularity!
$customMetricConfig:String
) {
node(id: $id) {
__typename
... on Model {
performanceMetricOverTime(
performanceMetric: udf
timeZone: $timeZone,
startTime: $startTime,
endTime: $endTime,
externalModelVersionIds: [],
externalBatchIds: [],
environmentName: $environmentName,
timeSeriesDataGranularity: $timeSeriesDataGranularity
filters: []
customMetricConfig: $customMetricConfig
){
dataPoints{
x
y
}
}
}
id
}
}
variables
{
"timeZone": "time/zone",
"id": "model_id",
"startTime": "2024-06-25T06:00:00.000Z", #target start time
"endTime": "2024-07-26T05:59:59.999Z", #target end time
"environmentName": "production", #The timezone of the request, used to determine the localized offset from UTC.
"timeSeriesDataGranularity": "month", #target granularity for points
"customMetricConfig": "select count(*) from model" #udf in SQL syntax
}
Last updated