-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dataset quality] Support failure store #199806
base: main
Are you sure you want to change the base?
Changes from 1 commit
81ad3fa
301a53a
2ad742f
4fe638e
56a1793
e11fabf
a9f173c
41d249a
91e2c3e
f753581
74df05c
73a90be
5ff14d6
1ba2535
b70c960
36131aa
ad7d150
5f1b389
2e47a6b
3715579
dd9816e
076cb6c
0057ecb
f10abac
f9ba989
c6846eb
895110f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,14 @@ | |
*/ | ||
|
||
import { DataStreamDocsStat } from '../api_types'; | ||
import { DEFAULT_DATASET_QUALITY, DEFAULT_DEGRADED_DOCS } from '../constants'; | ||
import { DEFAULT_DATASET_QUALITY, DEFAULT_QUALITY_DOC_STATS } from '../constants'; | ||
import { DataStreamType, QualityIndicators } from '../types'; | ||
import { indexNameToDataStreamParts, mapPercentageToQuality } from '../utils'; | ||
import { Integration } from './integration'; | ||
import { DataStreamStatType } from './types'; | ||
|
||
type QualityStat = Omit<DataStreamDocsStat, 'dataset'> & { percentage: number }; | ||
|
||
export class DataStreamStat { | ||
rawName: string; | ||
type: DataStreamType; | ||
|
@@ -30,6 +32,10 @@ export class DataStreamStat { | |
percentage: number; | ||
count: number; | ||
}; | ||
failedDocs: { | ||
percentage: number; | ||
count: number; | ||
}; | ||
|
||
private constructor(dataStreamStat: DataStreamStat) { | ||
this.rawName = dataStreamStat.rawName; | ||
|
@@ -46,6 +52,7 @@ export class DataStreamStat { | |
this.quality = dataStreamStat.quality; | ||
this.docsInTimeRange = dataStreamStat.docsInTimeRange; | ||
this.degradedDocs = dataStreamStat.degradedDocs; | ||
this.failedDocs = dataStreamStat.failedDocs; | ||
} | ||
|
||
public static create(dataStreamStat: DataStreamStatType) { | ||
|
@@ -63,36 +70,45 @@ export class DataStreamStat { | |
userPrivileges: dataStreamStat.userPrivileges, | ||
totalDocs: dataStreamStat.totalDocs, | ||
quality: DEFAULT_DATASET_QUALITY, | ||
degradedDocs: DEFAULT_DEGRADED_DOCS, | ||
degradedDocs: DEFAULT_QUALITY_DOC_STATS, | ||
failedDocs: DEFAULT_QUALITY_DOC_STATS, | ||
}; | ||
|
||
return new DataStreamStat(dataStreamStatProps); | ||
} | ||
|
||
public static fromDegradedDocStat({ | ||
public static fromQualityStats({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note We can extend this method with more qualityStats and construct a Dataset from them |
||
datasetName, | ||
degradedDocStat, | ||
failedDocStat, | ||
datasetIntegrationMap, | ||
totalDocs, | ||
}: { | ||
degradedDocStat: DataStreamDocsStat & { percentage: number }; | ||
datasetName: string; | ||
degradedDocStat: QualityStat; | ||
failedDocStat: QualityStat; | ||
datasetIntegrationMap: Record<string, { integration: Integration; title: string }>; | ||
totalDocs: number; | ||
}) { | ||
const { type, dataset, namespace } = indexNameToDataStreamParts(degradedDocStat.dataset); | ||
const { type, dataset, namespace } = indexNameToDataStreamParts(datasetName); | ||
|
||
const dataStreamStatProps = { | ||
rawName: degradedDocStat.dataset, | ||
rawName: datasetName, | ||
type, | ||
name: dataset, | ||
title: datasetIntegrationMap[dataset]?.title || dataset, | ||
title: datasetIntegrationMap[datasetName]?.title || dataset, | ||
namespace, | ||
integration: datasetIntegrationMap[dataset]?.integration, | ||
quality: mapPercentageToQuality(degradedDocStat.percentage), | ||
integration: datasetIntegrationMap[datasetName]?.integration, | ||
quality: mapPercentageToQuality([degradedDocStat.percentage, failedDocStat.percentage]), | ||
docsInTimeRange: totalDocs, | ||
degradedDocs: { | ||
percentage: degradedDocStat.percentage, | ||
count: degradedDocStat.count, | ||
}, | ||
failedDocs: { | ||
percentage: failedDocStat.percentage, | ||
count: failedDocStat.count, | ||
}, | ||
}; | ||
|
||
return new DataStreamStat(dataStreamStatProps); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ export const indexNameToDataStreamParts = (dataStreamName: string) => { | |
}; | ||
|
||
export const extractIndexNameFromBackingIndex = (indexString: string): string => { | ||
const pattern = /.ds-(.*?)-[0-9]{4}\.[0-9]{2}\.[0-9]{2}-[0-9]{6}/; | ||
const pattern = /.(?:ds|fs)-(.*?)-[0-9]{4}\.[0-9]{2}\.[0-9]{2}-[0-9]{6}/; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Important Failure store is at the moment a backing index that starts with |
||
const match = indexString.match(pattern); | ||
|
||
return match ? match[1] : indexString; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
mohamedhamed-ahmed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiSkeletonRectangle, EuiFlexGroup } from '@elastic/eui'; | ||
import React from 'react'; | ||
import { QualityPercentageIndicator } from '../../quality_indicator'; | ||
import { DataStreamStat } from '../../../../common/data_streams_stats/data_stream_stat'; | ||
import { TimeRangeConfig } from '../../../../common/types'; | ||
|
||
export const FailedDocsPercentageLink = ({ | ||
isLoading, | ||
dataStreamStat, | ||
timeRange, | ||
}: { | ||
isLoading: boolean; | ||
dataStreamStat: DataStreamStat; | ||
timeRange: TimeRangeConfig; | ||
}) => { | ||
const { | ||
failedDocs: { percentage }, | ||
} = dataStreamStat; | ||
|
||
return ( | ||
<EuiSkeletonRectangle width="50px" height="20px" borderRadius="m" isLoading={isLoading}> | ||
<EuiFlexGroup alignItems="center" gutterSize="s"> | ||
<QualityPercentageIndicator percentage={percentage} /> | ||
</EuiFlexGroup> | ||
</EuiSkeletonRectangle> | ||
); | ||
}; |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
This is now reused by
degradedDocs
andfailedDocs
.