-
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
[Metrics UI] Add context.reason and alertOnNoData to Inventory alerts #70260
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
01b5060
[Metrics UI] Add context.reason and alertOnNoData to Inventory alerts
Zacqary bb53cf3
Remove unused imports
Zacqary 18f7d2a
Fix typecheck
Zacqary aeac440
Fix typecheck without cheating
Zacqary 0427bb8
Merge remote-tracking branch 'upstream/master' into 69441-context-rea…
Zacqary a63f2fb
Merge remote-tracking branch 'upstream/master' into 69441-context-rea…
Zacqary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { i18n } from '@kbn/i18n'; | ||
import { SnapshotMetricType } from './inventory_models/types'; | ||
|
||
const Translations = { | ||
CPUUsage: i18n.translate('xpack.infra.waffle.metricOptions.cpuUsageText', { | ||
defaultMessage: 'CPU usage', | ||
}), | ||
|
||
MemoryUsage: i18n.translate('xpack.infra.waffle.metricOptions.memoryUsageText', { | ||
defaultMessage: 'Memory usage', | ||
}), | ||
|
||
InboundTraffic: i18n.translate('xpack.infra.waffle.metricOptions.inboundTrafficText', { | ||
defaultMessage: 'Inbound traffic', | ||
}), | ||
|
||
OutboundTraffic: i18n.translate('xpack.infra.waffle.metricOptions.outboundTrafficText', { | ||
defaultMessage: 'Outbound traffic', | ||
}), | ||
|
||
LogRate: i18n.translate('xpack.infra.waffle.metricOptions.hostLogRateText', { | ||
defaultMessage: 'Log rate', | ||
}), | ||
|
||
Load: i18n.translate('xpack.infra.waffle.metricOptions.loadText', { | ||
defaultMessage: 'Load', | ||
}), | ||
|
||
Count: i18n.translate('xpack.infra.waffle.metricOptions.countText', { | ||
defaultMessage: 'Count', | ||
}), | ||
DiskIOReadBytes: i18n.translate('xpack.infra.waffle.metricOptions.diskIOReadBytes', { | ||
defaultMessage: 'Disk Reads', | ||
}), | ||
DiskIOWriteBytes: i18n.translate('xpack.infra.waffle.metricOptions.diskIOWriteBytes', { | ||
defaultMessage: 'Disk Writes', | ||
}), | ||
s3BucketSize: i18n.translate('xpack.infra.waffle.metricOptions.s3BucketSize', { | ||
defaultMessage: 'Bucket Size', | ||
}), | ||
s3TotalRequests: i18n.translate('xpack.infra.waffle.metricOptions.s3TotalRequests', { | ||
defaultMessage: 'Total Requests', | ||
}), | ||
s3NumberOfObjects: i18n.translate('xpack.infra.waffle.metricOptions.s3NumberOfObjects', { | ||
defaultMessage: 'Number of Objects', | ||
}), | ||
s3DownloadBytes: i18n.translate('xpack.infra.waffle.metricOptions.s3DownloadBytes', { | ||
defaultMessage: 'Downloads (Bytes)', | ||
}), | ||
s3UploadBytes: i18n.translate('xpack.infra.waffle.metricOptions.s3UploadBytes', { | ||
defaultMessage: 'Uploads (Bytes)', | ||
}), | ||
rdsConnections: i18n.translate('xpack.infra.waffle.metricOptions.rdsConnections', { | ||
defaultMessage: 'Connections', | ||
}), | ||
rdsQueriesExecuted: i18n.translate('xpack.infra.waffle.metricOptions.rdsQueriesExecuted', { | ||
defaultMessage: 'Queries Executed', | ||
}), | ||
rdsActiveTransactions: i18n.translate('xpack.infra.waffle.metricOptions.rdsActiveTransactions', { | ||
defaultMessage: 'Active Transactions', | ||
}), | ||
rdsLatency: i18n.translate('xpack.infra.waffle.metricOptions.rdsLatency', { | ||
defaultMessage: 'Latency', | ||
}), | ||
sqsMessagesVisible: i18n.translate('xpack.infra.waffle.metricOptions.sqsMessagesVisible', { | ||
defaultMessage: 'Messages Available', | ||
}), | ||
sqsMessagesDelayed: i18n.translate('xpack.infra.waffle.metricOptions.sqsMessagesDelayed', { | ||
defaultMessage: 'Messages Delayed', | ||
}), | ||
sqsMessagesSent: i18n.translate('xpack.infra.waffle.metricOptions.sqsMessagesSent', { | ||
defaultMessage: 'Messages Added', | ||
}), | ||
sqsMessagesEmpty: i18n.translate('xpack.infra.waffle.metricOptions.sqsMessagesEmpty', { | ||
defaultMessage: 'Messages Returned Empty', | ||
}), | ||
sqsOldestMessage: i18n.translate('xpack.infra.waffle.metricOptions.sqsOldestMessage', { | ||
defaultMessage: 'Oldest Message', | ||
}), | ||
}; | ||
|
||
export const toMetricOpt = ( | ||
metric: SnapshotMetricType | ||
): { text: string; value: SnapshotMetricType } | undefined => { | ||
switch (metric) { | ||
case 'cpu': | ||
return { | ||
text: Translations.CPUUsage, | ||
value: 'cpu', | ||
}; | ||
case 'memory': | ||
return { | ||
text: Translations.MemoryUsage, | ||
value: 'memory', | ||
}; | ||
case 'rx': | ||
return { | ||
text: Translations.InboundTraffic, | ||
value: 'rx', | ||
}; | ||
case 'tx': | ||
return { | ||
text: Translations.OutboundTraffic, | ||
value: 'tx', | ||
}; | ||
case 'logRate': | ||
return { | ||
text: Translations.LogRate, | ||
value: 'logRate', | ||
}; | ||
case 'load': | ||
return { | ||
text: Translations.Load, | ||
value: 'load', | ||
}; | ||
|
||
case 'count': | ||
return { | ||
text: Translations.Count, | ||
value: 'count', | ||
}; | ||
case 'diskIOReadBytes': | ||
return { | ||
text: Translations.DiskIOReadBytes, | ||
value: 'diskIOReadBytes', | ||
}; | ||
case 'diskIOWriteBytes': | ||
return { | ||
text: Translations.DiskIOWriteBytes, | ||
value: 'diskIOWriteBytes', | ||
}; | ||
case 's3BucketSize': | ||
return { | ||
text: Translations.s3BucketSize, | ||
value: 's3BucketSize', | ||
}; | ||
case 's3TotalRequests': | ||
return { | ||
text: Translations.s3TotalRequests, | ||
value: 's3TotalRequests', | ||
}; | ||
case 's3NumberOfObjects': | ||
return { | ||
text: Translations.s3NumberOfObjects, | ||
value: 's3NumberOfObjects', | ||
}; | ||
case 's3DownloadBytes': | ||
return { | ||
text: Translations.s3DownloadBytes, | ||
value: 's3DownloadBytes', | ||
}; | ||
case 's3UploadBytes': | ||
return { | ||
text: Translations.s3UploadBytes, | ||
value: 's3UploadBytes', | ||
}; | ||
case 'rdsConnections': | ||
return { | ||
text: Translations.rdsConnections, | ||
value: 'rdsConnections', | ||
}; | ||
case 'rdsQueriesExecuted': | ||
return { | ||
text: Translations.rdsQueriesExecuted, | ||
value: 'rdsQueriesExecuted', | ||
}; | ||
case 'rdsActiveTransactions': | ||
return { | ||
text: Translations.rdsActiveTransactions, | ||
value: 'rdsActiveTransactions', | ||
}; | ||
case 'rdsLatency': | ||
return { | ||
text: Translations.rdsLatency, | ||
value: 'rdsLatency', | ||
}; | ||
case 'sqsMessagesVisible': | ||
return { | ||
text: Translations.sqsMessagesVisible, | ||
value: 'sqsMessagesVisible', | ||
}; | ||
case 'sqsMessagesDelayed': | ||
return { | ||
text: Translations.sqsMessagesDelayed, | ||
value: 'sqsMessagesDelayed', | ||
}; | ||
case 'sqsMessagesSent': | ||
return { | ||
text: Translations.sqsMessagesSent, | ||
value: 'sqsMessagesSent', | ||
}; | ||
case 'sqsMessagesEmpty': | ||
return { | ||
text: Translations.sqsMessagesEmpty, | ||
value: 'sqsMessagesEmpty', | ||
}; | ||
case 'sqsOldestMessage': | ||
return { | ||
text: Translations.sqsOldestMessage, | ||
value: 'sqsOldestMessage', | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 to self: switch to the implementation in #69757 instead