Commit graph

24 commits

Author SHA1 Message Date
Cauê Marcondes
a0f8d910b7
[Profling] Adding symbols callout on frame information window (#154478)
This PR adds a callout on the Frame information window for each symbol
status and Storybook support.

`Symbolized`:
<img width="897" alt="Screenshot 2023-04-05 at 2 46 36 PM"
src="https://user-images.githubusercontent.com/55978943/230176122-ad495e1d-76aa-431c-a6a7-4f2f319625c9.png">

`Native language`:
<img width="901" alt="Screenshot 2023-04-05 at 2 46 24 PM"
src="https://user-images.githubusercontent.com/55978943/230176224-e247d57c-538b-4c35-8a74-dd0176ac0f0c.png">

`Interpreted language`:
<img width="893" alt="Screenshot 2023-04-05 at 2 46 16 PM"
src="https://user-images.githubusercontent.com/55978943/230176264-d2d9b72a-6048-4ba3-93af-b60f9ea04001.png">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-04-10 10:11:04 -07:00
Cauê Marcondes
8b66119431
[Stacktraces] Syncing color in the main chart and in the subchart (#152832)
closes https://github.com/elastic/prodfiler/issues/3069


https://user-images.githubusercontent.com/55978943/223480200-036f8d2c-5c08-48cc-a205-47ae1eb8e803.mov

I also refactored the components a bit and wrote a unit test.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-03-08 08:54:05 -05:00
Dario Gieselaar
1854c310a3
[Profiling] Improved differential flamegraph controls (#150254)
Co-authored-by: boriskirov <boris.kirov@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/prodfiler/issues/2639
2023-02-07 06:54:17 -07:00
Dario Gieselaar
807b402f0b
[Profling] Single-click setup from Kibana (#148959)
Co-authored-by: inge4pres <francesco.gualazzi@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tim Rühsen <tim.ruehsen@gmx.de>
Co-authored-by: Francesco Gualazzi <inge4pres@users.noreply.github.com>
Closes https://github.com/elastic/prodfiler/issues/2884
2023-02-07 06:10:30 -07:00
Joseph Crail
b42bb18119
[Profiling] Prepare for inline stackframes (#150401)
This PR adds initial support for initial stackframes as described in
elastic/prodfiler#2918.

It also adds tests and a minor refactor to account for the removal of
synthetic source from stackframes (see elastic/prodfiler#2850).

For stackframes, the profiling stack is composed of multiple write paths
into Elasticsearch and multiple read paths out of Elasticsearch:
* there are three services that can write into Elasticsearch (`APM
agent`, `pf-elastic-collector`, and `pf-elastic-symbolizer`).
* there are also two ways to read from Elasticsearch (the profiling
plugin in Elasticsearch, and a combination of `search` and `mget`
calls).

This PR was written to handle all permutations of these paths. For those
reviewers that wish to try the PR, please keep this in mind. I also
wrote tests to handle these permutations.

Note: Future PRs will add full support for inline stackframes. At this
time, we only read the first inlined stackframe since the UI does not
support inline stackframes.

---------

Co-authored-by: Tim Rühsen <tim.ruhsen@elastic.co>
2023-02-07 05:22:59 -07:00
Tim Rühsen
62e0d0ebb8
Remove unused/obsolete source type field from frames metadata (#150013)
## Summary
We don't use the source type for frames, but parse it from the query
response.

In the near future, we remove this field completely from the
`profiling-stackframes` index, because we have no reliable way to
determine the type of source code for a frame of type 'native' or
'kernel'.
For interpreted languages we have this information stored in the
`profiling-stacktraces` index.
2023-02-02 20:34:42 +01:00
Dario Gieselaar
08d85554b9
[Profiling] Flamegraph legend (#147910)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/prodfiler/issues/2810
2023-01-16 06:45:54 -07:00
Joseph Crail
a58aaeb6a8
[Profiling] Retrieve profiling data via Elasticsearch plugin (#147152)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
2023-01-10 09:21:01 -07:00
Dario Gieselaar
7bbf24acf6
[Profiling] Strip leading subdirs for frame group ID (#147906)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/prodfiler/issues/2756
2023-01-10 15:35:27 +01:00
Dario Gieselaar
d01b5de252
[Profiling] Show values of highlighted sample in TopN chart (#147431)
Closes https://github.com/elastic/prodfiler/issues/2842
2022-12-21 11:38:42 +01:00
Florian Lehner
e7f858bdbe
[Profiling] Add color for PHP JIT frames (#147495)
Signed-off-by: Florian Lehner <florian.lehner@elastic.cloud>

## Summary

Add a color for the PHP JIT frame type.

Signed-off-by: Florian Lehner <florian.lehner@elastic.cloud>
2022-12-15 07:35:21 +01:00
Thomas Dullien
0a065f3c1d
[profiling] Ensure constant colors in profiling bar chart (#146696)
## Summary

Make sure that identical objects in the bar chart always get assigned
the same colors.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tim Rühsen <tim.ruhsen@elastic.co>
2022-12-01 12:11:49 +01:00
Joseph Crail
642ab74cfc
[Profiling] Add APIs to clear frame and executable caches (#145499)
This PR adds two endpoints to clear each respective cache:

* `DELETE {BASE_KIBANA_PATH}/api/profiling/v1/cache/executables`
* `DELETE {BASE_KIBANA_PATH}/api/profiling/v1/cache/stackframes`

Related to https://github.com/elastic/prodfiler/issues/2759

#### Design choices

1. The `DELETE` method was chosen instead of `PUT` or `POST` since the
given semantics of `DELETE` matches the expected behavior for the
related issue.
2. Each endpoint will remove all items from the respective cache. A
separate API for each cache allows us to selectively clear the necessary
cache without the downsides of a catch-all endpoint to clear all caches.
This gives us the flexibility to add more endpoints if needed. Given the
tradeoff between complexity now or later, it was decided to implement
general invalidation now with the option to invalidate specific items
later.
3. The RESTful design allows us to clear specific items later (e.g.
`DELETE {BASE_KIBANA_PATH}/api/profiling/v1/cache/executables/{ID}`
could clear only executable `ID` from the cache).
4. Each endpoint returns an empty payload on success. However, the
Kibana logs reflect the actions taken and how many cache items were
affected.
5. The stacktrace cache was ignored since it was not affected by symbols
written to Elasticsearch.
6. Each endpoint is not directly accessible from UI since it is expected
that the endpoints will be called outside of Kibana. However, the
endpoints can be called manually from the browser's console.
2022-11-17 11:04:58 +01:00
Tim Rühsen
528486f2af
[Profiling] Remove timestamp from traces and executables (#145261)
## Summary
We are removing @timestamp from the backend soon.
And we do not currently use @timestamp in Kibana.

This PR just cleans up the unused field definitions for the Timestamps.
2022-11-15 20:56:14 -08:00
Daniel Mitterdorfer
614daf0b15
[Profiling] Fix decoding of long sequences (#144979)
We store stack frame types with a run-length encoding in Elasticsearch
and decode the raw data in Kibana. The current implementation was
working fine when the frame type did not change often but failed for
long sequences of unique frame types. With this commit we make sure that
these longer sequences can also properly decoded.

Co-authored-by: Tim Rühsen <tim.ruhsen@elastic.co>
2022-11-10 06:50:22 -07:00
Joseph Crail
a4b20e6e89
[Profiling] Improve performance when decoding stacktraces (#143084)
* Derive address and file ID from base64 encoding

This skips the intermediate deserialization step to a buffer object.

* Move run-length encoding methods

* Decode run-length directly from base64 encoding

This skips the intermediate deserialization step to a buffer object.

* Minor refactor

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-10-24 16:24:31 -07:00
Joseph Crail
39811a3bd5
[Profiling] Fix UI discrepancies in frame information window (#142812)
* Fix UI discrepancies in frame information window

* Fix comment

* Use source line instead

This matches with the value used in the flamegraph labels.
2022-10-06 12:50:21 -07:00
Joseph Crail
c888aca9b4
[Profiling] Move additional flamegraph calculations into UI (#142415)
* Remove total and sampled traces from API

* Remove Samples array from flamegraph API

These values are redundant with CountInclusive so could be removed
without issue.

* Remove totalCount and eventsIndex

These values are no longer needed.

* Remove samples from callee tree

* Refactor columnar view model into separate file

* Add more lazy-loaded flamegraph calculations

* Fix spacing in frame label

* Remove frame information API

* Improve test coverage

* Fix type error

* Replace fnv-plus with custom 64-bit FNV1-a

* Add exceptions for linting errors

* Add workaround for frame type truncation bug

* Replace prior workaround for truncation bug

This fix supercedes the prior workaround and addresses the truncation at
its source.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-10-05 06:10:38 -07:00
Joseph Crail
924c7f912a
[Profiling] Simplify query post-processing and flamegraph response (#141729)
* Replace non-null assertion with nullish coalescing

* Remove createFrameGroup

* Remove callers

* Use adjacency list representation for tree

* Move frame type map outside function

* Inline frame group name

* Replace FrameGroupID with ID

* Create columnar view model in client
2022-09-26 10:27:06 -07:00
Joseph Crail
d8901857aa
[Profiling] Reduce CPU usage for flamegraph and TopN function (#141017)
* Add instrumentation for flamegraph

I inlined the construction of the flamegraph into the respective route
so that we could add fine-grained instrumentation. We now use APM and
console logging to understand how long flamegraph construction takes.

* Remove unnecessary Set usage

* Remove superfluous clone

This was likely added when we needed to avoid infinite recursion when
serializing to JSON. This no longer has a useful function.

* Pass in pre-calculated frame group info

I noticed that we were creating frame group info multiple times so I
added it as a parameter for the intermediate node.

* Sort callees in one place

Callees should be sorted first by samples decreasing and then by frame
groups. Combining the two sorts makes the post-processing clearer to
future readers and/or maintainers.

* Capitalize fields in preparation of merging

* Align both node data structures

* Pass metadata instead of copying fields

* Refactor frame label method

* Use pre-calculated array length

* Use pre-allocated array

* Refactor intermediate node

* Remove intermediate node structure

* Move if statement out of for loop

* Fix comments

* Sort sibling nodes by frame group ID

* Calculate graph size during creation

* Add missing groupStackFrameMetadataByStackTrace

* Fix formatting

* Fix generated callee source

* Fix creation of frame group

* Fix test

* Remove filter for relevant traces

* Stop passing frame group

* Create root node inside createCallerCalleeGraph

* Fix timestamps

* Remove frame group comparator

* Add instrumentation for topN functions

* Allow for missing stacktraces

* Use Date.now instead
2022-09-22 09:37:45 -07:00
Tim Rühsen
03b360a6b8
[Profiling] Aggregate ELF frames by exeFilename, not fileID (#141139)
* [Profiling] Aggregate ELF frames by exeFilename, not fileID

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-09-22 11:45:20 +02:00
Pierre Gayvallet
9579ea7235
Move src/core/types/elasticsearch to @kbn/es-types (#140522)
* create empty package

* move types to packages

* [CI] Auto-commit changed files from 'node scripts/generate codeowners'

* start fixing imports

* fix more imports

* fix inline import

* add apm-ui as owners

* [CI] Auto-commit changed files from 'node scripts/generate codeowners'

* fix new usages

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-09-20 10:32:13 +02:00
Dario Gieselaar
c522506519
[Profiling] Show host.name or host.ip when available (#140941) 2022-09-19 06:53:41 -07:00
Dario Gieselaar
b66cf585ca
[Profiling] Add Profiling application (#140722)
Co-authored-by: Joseph Crail <jbcrail@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: Joseph Crail <joseph.crail@elastic.co>
Co-authored-by: Stephanie Boomsma <stephanieboomsma@optimyze.cloud>
Co-authored-by: inge4pres <fgualazzi@gmail.com>
Co-authored-by: inge4pres <francesco.gualazzi@elastic.co>
Co-authored-by: Francesco Gualazzi <inge4pres@users.noreply.github.com>
Co-authored-by: Tim Rühsen <tim.ruhsen@elastic.co>
Co-authored-by: Tim Rühsen <tim.ruehsen@gmx.de>
2022-09-15 19:24:41 +02:00