mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 02:04:07 +08:00
Elasticsearch: Remove xpack button and make includeFrozen not dependant on it (#84734)
This commit is contained in:
@ -38,7 +38,6 @@ type DatasourceInfo struct {
|
||||
Interval string
|
||||
MaxConcurrentShardRequests int64
|
||||
IncludeFrozen bool
|
||||
XPack bool
|
||||
}
|
||||
|
||||
type ConfiguredFields struct {
|
||||
@ -262,7 +261,7 @@ func (c *baseClientImpl) getMultiSearchQueryParameters() string {
|
||||
}
|
||||
qs = append(qs, fmt.Sprintf("max_concurrent_shard_requests=%d", maxConcurrentShardRequests))
|
||||
|
||||
if c.ds.IncludeFrozen && c.ds.XPack {
|
||||
if c.ds.IncludeFrozen {
|
||||
qs = append(qs, "ignore_throttled=false")
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ func TestClient_ExecuteMultisearch(t *testing.T) {
|
||||
Interval: "Daily",
|
||||
MaxConcurrentShardRequests: 6,
|
||||
IncludeFrozen: true,
|
||||
XPack: true,
|
||||
}
|
||||
|
||||
from := time.Date(2018, 5, 15, 17, 50, 0, 0, time.UTC)
|
||||
@ -148,7 +147,6 @@ func TestClient_ExecuteMultisearch(t *testing.T) {
|
||||
Interval: "Daily",
|
||||
MaxConcurrentShardRequests: 6,
|
||||
IncludeFrozen: true,
|
||||
XPack: true,
|
||||
}
|
||||
|
||||
from := time.Date(2018, 5, 15, 17, 50, 0, 0, time.UTC)
|
||||
@ -253,7 +251,6 @@ func TestClient_Index(t *testing.T) {
|
||||
Interval: test.patternInDatasource,
|
||||
MaxConcurrentShardRequests: 6,
|
||||
IncludeFrozen: true,
|
||||
XPack: true,
|
||||
}
|
||||
|
||||
from := time.Date(2018, 5, 10, 17, 50, 0, 0, time.UTC)
|
||||
|
@ -157,11 +157,6 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst
|
||||
includeFrozen = false
|
||||
}
|
||||
|
||||
xpack, ok := jsonData["xpack"].(bool)
|
||||
if !ok {
|
||||
xpack = false
|
||||
}
|
||||
|
||||
configuredFields := es.ConfiguredFields{
|
||||
TimeField: timeField,
|
||||
LogLevelField: logLevelField,
|
||||
@ -177,7 +172,6 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst
|
||||
ConfiguredFields: configuredFields,
|
||||
Interval: interval,
|
||||
IncludeFrozen: includeFrozen,
|
||||
XPack: xpack,
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ func newFlowTestDsInfo(body []byte, statusCode int, requestCallback func(req *ht
|
||||
HTTPClient: &client,
|
||||
MaxConcurrentShardRequests: 42,
|
||||
IncludeFrozen: false,
|
||||
XPack: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,29 +115,18 @@ export const ElasticDetails = ({ value, onChange }: Props) => {
|
||||
placeholder="10s"
|
||||
/>
|
||||
</InlineField>
|
||||
|
||||
<InlineField label="X-Pack enabled" labelWidth={29} tooltip="Enable or disable X-Pack specific features">
|
||||
<InlineField
|
||||
label="Include Frozen Indices"
|
||||
htmlFor="es_config_frozenIndices"
|
||||
labelWidth={29}
|
||||
tooltip="Include frozen indices in searches."
|
||||
>
|
||||
<InlineSwitch
|
||||
id="es_config_xpackEnabled"
|
||||
value={value.jsonData.xpack || false}
|
||||
onChange={jsonDataSwitchChangeHandler('xpack', value, onChange)}
|
||||
id="es_config_frozenIndices"
|
||||
value={value.jsonData.includeFrozen ?? false}
|
||||
onChange={jsonDataSwitchChangeHandler('includeFrozen', value, onChange)}
|
||||
/>
|
||||
</InlineField>
|
||||
|
||||
{value.jsonData.xpack && (
|
||||
<InlineField
|
||||
label="Include Frozen Indices"
|
||||
htmlFor="es_config_frozenIndices"
|
||||
labelWidth={29}
|
||||
tooltip="Include frozen indices in searches."
|
||||
>
|
||||
<InlineSwitch
|
||||
id="es_config_frozenIndices"
|
||||
value={value.jsonData.includeFrozen ?? false}
|
||||
onChange={jsonDataSwitchChangeHandler('includeFrozen', value, onChange)}
|
||||
/>
|
||||
</InlineField>
|
||||
)}
|
||||
</ConfigSubSection>
|
||||
);
|
||||
};
|
||||
|
@ -1056,19 +1056,13 @@ describe('ElasticDatasource', () => {
|
||||
|
||||
describe('getMultiSearchUrl', () => {
|
||||
it('Should add correct params to URL if "includeFrozen" is enabled', () => {
|
||||
const { ds } = getTestContext({ jsonData: { includeFrozen: true, xpack: true } });
|
||||
const { ds } = getTestContext({ jsonData: { includeFrozen: true } });
|
||||
|
||||
expect(ds.getMultiSearchUrl()).toMatch(/ignore_throttled=false/);
|
||||
});
|
||||
|
||||
it('Should NOT add ignore_throttled if "includeFrozen" is disabled', () => {
|
||||
const { ds } = getTestContext({ jsonData: { includeFrozen: false, xpack: true } });
|
||||
|
||||
expect(ds.getMultiSearchUrl()).not.toMatch(/ignore_throttled=false/);
|
||||
});
|
||||
|
||||
it('Should NOT add ignore_throttled if "xpack" is disabled', () => {
|
||||
const { ds } = getTestContext({ jsonData: { includeFrozen: true, xpack: false } });
|
||||
const { ds } = getTestContext({ jsonData: { includeFrozen: false } });
|
||||
|
||||
expect(ds.getMultiSearchUrl()).not.toMatch(/ignore_throttled=false/);
|
||||
});
|
||||
|
@ -115,7 +115,6 @@ export class ElasticDatasource
|
||||
name: string;
|
||||
index: string;
|
||||
timeField: string;
|
||||
xpack: boolean;
|
||||
interval: string;
|
||||
maxConcurrentShardRequests?: number;
|
||||
queryBuilder: ElasticQueryBuilder;
|
||||
@ -144,7 +143,6 @@ export class ElasticDatasource
|
||||
|
||||
this.index = settingsData.index ?? instanceSettings.database ?? '';
|
||||
this.timeField = settingsData.timeField;
|
||||
this.xpack = Boolean(settingsData.xpack);
|
||||
this.indexPattern = new IndexPattern(this.index, settingsData.interval);
|
||||
this.intervalPattern = settingsData.interval;
|
||||
this.interval = settingsData.timeInterval;
|
||||
@ -827,7 +825,7 @@ export class ElasticDatasource
|
||||
searchParams.append('max_concurrent_shard_requests', `${this.maxConcurrentShardRequests}`);
|
||||
}
|
||||
|
||||
if (this.xpack && this.includeFrozen) {
|
||||
if (this.includeFrozen) {
|
||||
searchParams.append('ignore_throttled', 'false');
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,6 @@ export interface ElasticsearchOptions extends DataSourceJsonData {
|
||||
timeField: string;
|
||||
// we used to have a field named `esVersion` in the past,
|
||||
// please do not use that name in the future.
|
||||
xpack?: boolean;
|
||||
interval?: Interval;
|
||||
timeInterval: string;
|
||||
maxConcurrentShardRequests?: number;
|
||||
|
Reference in New Issue
Block a user