stackdriver: change reducer mapping for distribution metrics

- Distribution metrics are now mapped to more reducers
when the metric kind is cumulative.
- The witdth of the metrics dropdown is now much wider.
- Changed the text from Select Aggregation to Select Reducer
to line up with the UI in Stackdriver.
pull/15624/head
Daniel Lee 6 years ago
parent e6830b0681
commit 35fc0c5329
  1. 3
      public/app/plugins/datasource/stackdriver/components/Aggregations.test.tsx
  2. 2
      public/app/plugins/datasource/stackdriver/components/Aggregations.tsx
  3. 2
      public/app/plugins/datasource/stackdriver/components/Metrics.tsx
  4. 2
      public/app/plugins/datasource/stackdriver/components/__snapshots__/Aggregations.test.tsx.snap
  5. 4
      public/app/plugins/datasource/stackdriver/components/__snapshots__/QueryEditor.test.tsx.snap
  6. 10
      public/app/plugins/datasource/stackdriver/constants.ts

@ -49,7 +49,8 @@ describe('Aggregations', () => {
}); });
it('', () => { it('', () => {
const options = wrapper.state().aggOptions[0].options; const options = wrapper.state().aggOptions[0].options;
expect(options.length).toEqual(5);
expect(options.length).toEqual(10);
expect(options.map(o => o.value)).toEqual(expect.arrayContaining(['REDUCE_NONE'])); expect(options.map(o => o.value)).toEqual(expect.arrayContaining(['REDUCE_NONE']));
}); });
}); });

@ -73,7 +73,7 @@ export class Aggregations extends React.Component<Props, State> {
value={crossSeriesReducer} value={crossSeriesReducer}
variables={templateSrv.variables} variables={templateSrv.variables}
options={aggOptions} options={aggOptions}
placeholder="Select Aggregation" placeholder="Select Reducer"
className="width-15" className="width-15"
/> />
</div> </div>

@ -185,7 +185,7 @@ export class Metrics extends React.Component<Props, State> {
}, },
]} ]}
placeholder="Select Metric" placeholder="Select Metric"
className="width-15" className="width-26"
/> />
</div> </div>
<div className="gf-form gf-form--grow"> <div className="gf-form gf-form--grow">

@ -28,7 +28,7 @@ Array [
<div <div
className="css-0 gf-form-select-box__placeholder" className="css-0 gf-form-select-box__placeholder"
> >
Select Aggregation Select Reducer
</div> </div>
<div <div
className="css-0" className="css-0"

@ -72,7 +72,7 @@ Array [
Metric Metric
</span> </span>
<div <div
className="css-0 gf-form-input gf-form-input--form-dropdown width-15" className="css-0 gf-form-input gf-form-input--form-dropdown width-26"
onKeyDown={[Function]} onKeyDown={[Function]}
> >
<div <div
@ -196,7 +196,7 @@ Array [
<div <div
className="css-0 gf-form-select-box__placeholder" className="css-0 gf-form-select-box__placeholder"
> >
Select Aggregation Select Reducer
</div> </div>
<div <div
className="css-0" className="css-0"

@ -189,7 +189,7 @@ export const aggOptions = [
ValueTypes.BOOL, ValueTypes.BOOL,
ValueTypes.STRING, ValueTypes.STRING,
], ],
metricKinds: [MetricKind.GAUGE, MetricKind.DELTA], metricKinds: [MetricKind.GAUGE, MetricKind.DELTA, MetricKind.CUMULATIVE],
}, },
{ {
text: 'count true', text: 'count true',
@ -207,25 +207,25 @@ export const aggOptions = [
text: '99th percentile', text: '99th percentile',
value: 'REDUCE_PERCENTILE_99', value: 'REDUCE_PERCENTILE_99',
valueTypes: [ValueTypes.INT64, ValueTypes.DOUBLE, ValueTypes.MONEY, ValueTypes.DISTRIBUTION], valueTypes: [ValueTypes.INT64, ValueTypes.DOUBLE, ValueTypes.MONEY, ValueTypes.DISTRIBUTION],
metricKinds: [MetricKind.GAUGE, MetricKind.DELTA], metricKinds: [MetricKind.GAUGE, MetricKind.DELTA, MetricKind.CUMULATIVE],
}, },
{ {
text: '95th percentile', text: '95th percentile',
value: 'REDUCE_PERCENTILE_95', value: 'REDUCE_PERCENTILE_95',
valueTypes: [ValueTypes.INT64, ValueTypes.DOUBLE, ValueTypes.MONEY, ValueTypes.DISTRIBUTION], valueTypes: [ValueTypes.INT64, ValueTypes.DOUBLE, ValueTypes.MONEY, ValueTypes.DISTRIBUTION],
metricKinds: [MetricKind.GAUGE, MetricKind.DELTA], metricKinds: [MetricKind.GAUGE, MetricKind.DELTA, MetricKind.CUMULATIVE],
}, },
{ {
text: '50th percentile', text: '50th percentile',
value: 'REDUCE_PERCENTILE_50', value: 'REDUCE_PERCENTILE_50',
valueTypes: [ValueTypes.INT64, ValueTypes.DOUBLE, ValueTypes.MONEY, ValueTypes.DISTRIBUTION], valueTypes: [ValueTypes.INT64, ValueTypes.DOUBLE, ValueTypes.MONEY, ValueTypes.DISTRIBUTION],
metricKinds: [MetricKind.GAUGE, MetricKind.DELTA], metricKinds: [MetricKind.GAUGE, MetricKind.DELTA, MetricKind.CUMULATIVE],
}, },
{ {
text: '5th percentile', text: '5th percentile',
value: 'REDUCE_PERCENTILE_05', value: 'REDUCE_PERCENTILE_05',
valueTypes: [ValueTypes.INT64, ValueTypes.DOUBLE, ValueTypes.MONEY, ValueTypes.DISTRIBUTION], valueTypes: [ValueTypes.INT64, ValueTypes.DOUBLE, ValueTypes.MONEY, ValueTypes.DISTRIBUTION],
metricKinds: [MetricKind.GAUGE, MetricKind.DELTA], metricKinds: [MetricKind.GAUGE, MetricKind.DELTA, MetricKind.CUMULATIVE],
}, },
]; ];

Loading…
Cancel
Save