-
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
[core.metrics] Add support for multiple processes in ops metrics & stats API; deprecate process field #109820
Conversation
@elasticmachine merge upstream |
...llection/server/collectors/event_loop_delays/rollups/integration_tests/daily_rollups.test.ts
Show resolved
Hide resolved
src/plugins/kibana_usage_collection/server/collectors/ops_stats/ops_stats_collector.test.ts
Show resolved
Hide resolved
… into core/process_multi_process
docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md
Show resolved
Hide resolved
public collect(): OpsProcessMetrics[] { | ||
return [this.getCurrentPidMetrics()]; | ||
} |
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.
(just thinking out loud, please ignore) I know this array format is better for the downstream indexation, but I'm still not a big fan compared to a Record<workerId, Data>
src/core/server/metrics/event_loop_delays/event_loop_delays_monitor.test.ts
Outdated
Show resolved
Hide resolved
"fromTimestamp", | ||
"lastUpdatedAt", | ||
"percentiles", |
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.
Not sure how far we want to go with unit testing (do we have IT test for this?), but maybe having the mocked monitorEventLoopDelay
returning a mocked value to assert that we're properly using/mapping the correct values to our structure would make sense?
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.
Youre right the wiring of this function is not tested. I've added a unit test to ensure that.
max: number; | ||
// The mean of the recorded event loop delays. | ||
mean: number; | ||
// The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold. |
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.
1 hour?
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.
This is taken from https://nodejs.org/api/perf_hooks.html#perf_hooks_histogram_exceeds
I've opened an issue in the node repo to clarify this metric and my understanding of it: nodejs/node#40096
src/plugins/kibana_usage_collection/server/collectors/event_loop_delays/saved_objects.ts
Show resolved
Hide resolved
// @ts-expect-error | ||
delete metrics.process.pid; | ||
for (const process of metrics.processes) { | ||
// @ts-expect-error | ||
delete process.pid; | ||
} |
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.
Not directly related to the PR as this was done already, but I see we're cloneDeep
'ing the metrics just to remove a few fields. Can't we avoid this costly call with just spreads and/or omits?
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 agree we can improve this logic. I'd suggest we do it in a different RP though
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Public APIs missing comments
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
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.
Added a couple small questions, but overall the updates LGTM!
* Side Public License, v 1. | ||
*/ | ||
|
||
/* eslint-disable dot-notation */ |
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.
Curious, why disabling dot-notation here?
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.
Testing private methods must be accessed by bracket notation which is not allowed by eslint in the project. example eventLoopDelaysMonitor['loopMonitor'].enable
/** Process related metrics */ | ||
/** | ||
* Process related metrics. | ||
* @deprecated use the processes field instead. |
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.
Should we add a @removeBy
for the new docs system? (Not sure if it works here)
*/ | ||
export interface IntervalHistogram { | ||
// The first timestamp the interval timer kicked in for collecting data points. | ||
fromTimestamp: string; |
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.
nit: maybe worth commenting that these are iso 8601
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
…ats API; deprecate process field (elastic#109820) Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…ats API; deprecate process field (#109820) (#112108) Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Ahmad Bamieh <[email protected]>
Summary
name
field for each process since we do not support multi-processes yet.histogram.mean
forevent_loop_delay
.pid: 1
to the kibana process. This fixes a bug for multi kibana instances running on docker machines, or in the rare case more than one server assigns the kibana process the same pid./api/status
Closes #104031
Rebased changes from #107900 (there was a weird issue happening when running TS type checker on that branch).