mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* Always pass index patterns as strings. * Abide by prettier rules.
This commit is contained in:
parent
61fb83a1fb
commit
d98a1ebd39
6 changed files with 14 additions and 13 deletions
|
@ -7,7 +7,7 @@
|
|||
import { InfraFrameworkRequest } from '../framework';
|
||||
|
||||
export interface FieldsAdapter {
|
||||
getIndexFields(req: InfraFrameworkRequest, indices: string[]): Promise<IndexFieldDescriptor[]>;
|
||||
getIndexFields(req: InfraFrameworkRequest, indices: string): Promise<IndexFieldDescriptor[]>;
|
||||
}
|
||||
|
||||
export interface IndexFieldDescriptor {
|
||||
|
|
|
@ -16,7 +16,7 @@ export class FrameworkFieldsAdapter implements FieldsAdapter {
|
|||
|
||||
public async getIndexFields(
|
||||
request: InfraFrameworkRequest,
|
||||
indices: string[]
|
||||
indices: string
|
||||
): Promise<IndexFieldDescriptor[]> {
|
||||
const indexPatternsService = this.framework.getIndexPatternsService(request);
|
||||
const response = await indexPatternsService.getFieldsForWildcard({
|
||||
|
|
|
@ -29,10 +29,9 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter {
|
|||
[InfraNodeType.container]: options.sourceConfiguration.fields.container,
|
||||
[InfraNodeType.pod]: options.sourceConfiguration.fields.pod,
|
||||
};
|
||||
const indexPattern = [
|
||||
options.sourceConfiguration.metricAlias,
|
||||
options.sourceConfiguration.logAlias,
|
||||
];
|
||||
const indexPattern = `${options.sourceConfiguration.metricAlias},${
|
||||
options.sourceConfiguration.logAlias
|
||||
}`;
|
||||
const timeField = options.sourceConfiguration.fields.timestamp;
|
||||
const interval = options.timerange.interval;
|
||||
const nodeField = fields[options.nodeType];
|
||||
|
|
|
@ -38,7 +38,7 @@ export async function calculateCardinalityOfNodeField(
|
|||
|
||||
const resp = await search<CardinalityAggregation>({
|
||||
body,
|
||||
index: [sourceConfiguration.logAlias, sourceConfiguration.metricAlias],
|
||||
index: `${sourceConfiguration.logAlias},${sourceConfiguration.metricAlias}`,
|
||||
});
|
||||
|
||||
if (resp.aggregations) {
|
||||
|
|
|
@ -27,8 +27,8 @@ export function createPartitionBodies(
|
|||
const numberOfPartitions: number = Math.ceil(totalNodes / NODE_REQUEST_PARTITION_SIZE);
|
||||
const indices =
|
||||
nodeOptions.metric.type === InfraMetricType.logRate
|
||||
? [sourceConfiguration.logAlias]
|
||||
: [sourceConfiguration.metricAlias];
|
||||
? sourceConfiguration.logAlias
|
||||
: sourceConfiguration.metricAlias;
|
||||
times(
|
||||
numberOfPartitions,
|
||||
(partitionId: number): void => {
|
||||
|
|
|
@ -24,10 +24,12 @@ export class InfraFieldsDomain {
|
|||
const includeMetricIndices = [InfraIndexType.ANY, InfraIndexType.METRICS].includes(indexType);
|
||||
const includeLogIndices = [InfraIndexType.ANY, InfraIndexType.LOGS].includes(indexType);
|
||||
|
||||
const fields = await this.adapter.getIndexFields(request, [
|
||||
...(includeMetricIndices ? [configuration.metricAlias] : []),
|
||||
...(includeLogIndices ? [configuration.logAlias] : []),
|
||||
]);
|
||||
const fields = await this.adapter.getIndexFields(
|
||||
request,
|
||||
`${includeMetricIndices ? configuration.metricAlias : ''},${
|
||||
includeLogIndices ? configuration.logAlias : ''
|
||||
}`
|
||||
);
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue