|
@@ -1,4 +1,8 @@
|
|
|
-import { extractServicesFromMetricDescriptors, getMetricTypesByService } from './functions';
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ extractServicesFromMetricDescriptors,
|
|
|
|
|
+ getMetricTypesByService,
|
|
|
|
|
+ getAlignmentOptionsByMetric,
|
|
|
|
|
+} from './functions';
|
|
|
import has from 'lodash/has';
|
|
import has from 'lodash/has';
|
|
|
|
|
|
|
|
export default class StackdriverMetricFindQuery {
|
|
export default class StackdriverMetricFindQuery {
|
|
@@ -15,6 +19,8 @@ export default class StackdriverMetricFindQuery {
|
|
|
return this.handleLabelQueryType(query);
|
|
return this.handleLabelQueryType(query);
|
|
|
case 'resourceTypes':
|
|
case 'resourceTypes':
|
|
|
return this.handleResourceType(query);
|
|
return this.handleResourceType(query);
|
|
|
|
|
+ case 'alignerns':
|
|
|
|
|
+ return this.handleAlignersType(query);
|
|
|
default:
|
|
default:
|
|
|
return [];
|
|
return [];
|
|
|
}
|
|
}
|
|
@@ -85,4 +91,13 @@ export default class StackdriverMetricFindQuery {
|
|
|
return [];
|
|
return [];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ async handleAlignersType({ metricType }) {
|
|
|
|
|
+ if (!metricType) {
|
|
|
|
|
+ return [];
|
|
|
|
|
+ }
|
|
|
|
|
+ const metricDescriptors = await this.datasource.getMetricTypes(this.datasource.projectName);
|
|
|
|
|
+ const { valueType, metricKind } = metricDescriptors.find(m => m.type === metricType);
|
|
|
|
|
+ return getAlignmentOptionsByMetric(valueType, metricKind);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|