-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Metricbeat] Remove elasticsearch.index.created from the SM code #25113
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
@sayden This would be my main concern with removing this field. Can we get someone from @elastic/stack-monitoring-ui team to confirm that removing this field will have no impact on the UI? Once we have that, I'm good with removing it to reduce the expensive API call. |
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.
I can confirm there are no references to any field named "created" in the Stack Monitoring UI at this moment.
For later reference, here is a search for "created" in x-pack/plugins/monitoring (excluding snapshot tests and SVG files):
x-pack/plugins/monitoring/public/plugin.ts:
32 import { createLegacyAlertTypes } from './alerts/legacy_alert';
33: import { createDiskUsageAlertType } from './alerts/disk_usage_alert';
34 import { createThreadPoolRejectionsAlertType } from './alerts/thread_pool_rejections_alert';
172 alertTypeRegistry.register(createCpuUsageAlertType());
173: alertTypeRegistry.register(createDiskUsageAlertType());
174 alertTypeRegistry.register(createMemoryUsageAlertType());
x-pack/plugins/monitoring/public/alerts/disk_usage_alert/index.tsx:
19
20: export function createDiskUsageAlertType(): AlertTypeModel {
21 return {
x-pack/plugins/monitoring/public/alerts/lib/alerts_toast.tsx:
81 id="xpack.monitoring.healthCheck.disabledWatches.title"
82: defaultMessage="New alerts created"
83 />
x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_category.test.tsx:
48 params: {},
49: createdBy: null,
50 updatedBy: null,
51: createdAt: new Date('2020-12-08'),
52 updatedAt: new Date('2020-12-08'),
x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_node.test.tsx:
46 params: {},
47: createdBy: null,
48 updatedBy: null,
49: createdAt: new Date('2020-12-08'),
50 updatedAt: new Date('2020-12-08'),
x-pack/plugins/monitoring/server/lib/mb_safe_query.ts:
11 * queries/aggs continue to work but we need to handle the reality that these aliases will not
12: * exist for older metricbeat-* indices, created before the aliases existed.
13 *
x-pack/plugins/monitoring/server/lib/details/get_series.js:
245 console.log(
246: `metric.debug field=${metric.field} bucketsCreated: ${countBuckets(
247 get(response, 'aggregations.check')
x-pack/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.js:
17 *
18: * Historically, the get_nodes
function created an aggregation with multiple sub date_histogram
19 * aggregations for each metric aggregation. From a top down view, the entire aggregations look liked:
x-pack/plugins/monitoring/server/lib/metrics/beats/metrics.js:
72 description: i18n.translate('xpack.monitoring.metrics.beats.eventsRate.totalDescription', {
73: defaultMessage: 'All events newly created in the publishing pipeline',
74 }),
x-pack/plugins/monitoring/server/routes/api/v1/alerts/enable.ts:
79
80: let createdAlerts: Array<SanitizedAlert> = [];
81 const disabledWatcherClusterAlerts = await disableWatcherClusterAlerts(
86 if (disabledWatcherClusterAlerts) {
87: createdAlerts = await Promise.all(
88 alerts.map((alert) => alert.createIfDoesNotExist(alertsClient, actionsClient, actions))
91
92: return response.ok({ body: { createdAlerts, disabledWatcherClusterAlerts } });
93 } catch (err) {
</details>
if err != nil { | ||
return errors.Wrap(err, "failed to get index creation time") | ||
} | ||
idx.Created = created |
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.
I think we can remove the Created
field from the struct as well?
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.
Good point
Thanks for checking and confirming, @jasonrhodes. |
@sayden Reviewing the code changes in this PR, it looks like we are not actually removing the API call to ES. This PR is simply removing the code that parses the cluster state API response to extract the index metadata field from it. |
Yes, sorry for that. I cherry-picked the commit from a different branch and I didn't realize that I split the change in two commits |
Ok, I actually removed the call now 😅 (actually, the request into a different call), deleted the field in struct and added a changelog entry into breaking changes. |
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.
LGTM.
Thank you for your help too, @jasonrhodes |
Pinging @elastic/integrations-services (Team:Services) |
…tic#25113) (cherry picked from commit a951d19)
…-github-pr-comment-template * upstream/master: Check native environment before starting (elastic#25186) Change event.code and winlog.event_id type (elastic#25176) [Ingest Manager] Proxy processes/elastic-agent to stats (elastic#25193) Update mergify backporting to 7.x and 7.13 (elastic#25196) [Heartbeat]: ensure synthetics version co* [Heartbeat]: ensure synthetics version compatability for suites * address review and fix notice * fix lowercase struct * fix version conflict and rebase * update go.* stuff to master * fix notice.txt * move validate inside sourcempatability for suites (elastic#24777) [Filebeat] Ensure Kibana audit `event.category` and `event.type` are still processed as strings. (elastic#25101) Update replace.asciidoc (elastic#25055) Fix nil panic when overwriting metadata (elastic#24741) [Filebeat] Add Malware Bazaar to Threat Intel Module (elastic#24570) Fix k8s svc selectors mapping (elastic#25169) [Ingest Manager] Make agent retry values for bootstraping configurable (elastic#25163) [Metricbeat] Remove elasticsearc.index.created from the SM code (elastic#25113)
…ng-versions-stack * upstream/master: (28 commits) Add support for parsers in filestream input (elastic#24763) Skip flaky test TestFilestreamTruncate (elastic#25218) backport: Add 7.13 branch (elastic#25189) Update decode_json_fields.asciidoc (elastic#25056) [Elastic Agent] Fix status and inspect command to work inside running container (elastic#25204) Check native environment before starting (elastic#25186) Change event.code and winlog.event_id type (elastic#25176) [Ingest Manager] Proxy processes/elastic-agent to stats (elastic#25193) Update mergify backporting to 7.x and 7.13 (elastic#25196) [Heartbeat]: ensure synthetics version co* [Heartbeat]: ensure synthetics version compatability for suites * address review and fix notice * fix lowercase struct * fix version conflict and rebase * update go.* stuff to master * fix notice.txt * move validate inside sourcempatability for suites (elastic#24777) [Filebeat] Ensure Kibana audit `event.category` and `event.type` are still processed as strings. (elastic#25101) Update replace.asciidoc (elastic#25055) Fix nil panic when overwriting metadata (elastic#24741) [Filebeat] Add Malware Bazaar to Threat Intel Module (elastic#24570) Fix k8s svc selectors mapping (elastic#25169) [Ingest Manager] Make agent retry values for bootstraping configurable (elastic#25163) [Metricbeat] Remove elasticsearc.index.created from the SM code (elastic#25113) [Ingest Manager] Keep http and logging config during enroll (elastic#25132) Refactor kubernetes autodiscover to avoid skipping short-living pods (elastic#24742) [libbeat] New decode xml wineventlog processor (elastic#25115) ...
What does this PR do?
SM
index
metricset does an API HTTP call to elasticsearch to retrieve index metadata information. This information is required to populate fieldelasticsearch.index.created
or (index_stats.created
ifxpack.enabled: true
when configuring the module).The code removes the API call to
/_cluster/state/metadata
.Why is it important?
The HTTP call to
/_cluster/state/metadata
can be VERY expensive. The reason for this is that it returns the entire mapping of all indices on a cluster. If a user has many indices and / or each index has many fields, this could lead to very heavy responses from elasticsearchr (20 Mb in big clusters measured with curl).Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
elasticsearch.index.created
orindex_stats.created
and they will be removed.