Skip to content

Conversation

@korniltsev
Copy link
Contributor

@korniltsev korniltsev commented May 10, 2022

Right now tags are sent as protobuf along with JFR as a separate multipart form field.
All events are grouped by contextId to minimize storage.Putter.Put operations
Other logic should be the same as previously

@CLAassistant
Copy link

CLAassistant commented May 10, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Contributor

github-actions bot commented May 10, 2022

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
webapp/public/assets/app.js 463 KB (0%) 9.3 s (0%) 2.5 s (+1.18% 🔺) 11.7 s

@codecov
Copy link

codecov bot commented May 10, 2022

Codecov Report

Merging #1096 (9dda771) into main (a35d562) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #1096      +/-   ##
==========================================
+ Coverage   70.79%   70.80%   +0.02%     
==========================================
  Files          93       94       +1     
  Lines        3022     3047      +25     
  Branches      757      759       +2     
==========================================
+ Hits         2139     2157      +18     
- Misses        879      886       +7     
  Partials        4        4              
Impacted Files Coverage Δ
...raphComponent/DiffLegendPaletteDropdown.module.css 61.54% <ø> (ø)
webapp/javascript/redux/reducers/ui.ts 63.64% <0.00%> (-6.73%) ⬇️
webapp/javascript/util/formatDate.ts 88.00% <0.00%> (-1.13%) ⬇️
.../FlameGraphComponent/DiffLegendPaletteDropdown.tsx 73.59% <0.00%> (ø)
webapp/javascript/hooks/colorMode.hook.ts 84.62% <0.00%> (ø)
webapp/javascript/components/Sidebar.tsx 88.10% <0.00%> (+0.30%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b00a490...9dda771. Read the comment docs.

@korniltsev korniltsev marked this pull request as draft May 10, 2022 19:39
@petethepig petethepig marked this pull request as ready for review May 13, 2022 05:07
Copy link
Collaborator

@petethepig petethepig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good overall. There are a few go nits, but I think performance-wise and code-wise it all looks good.

A couple of things we need to change before merging this:

  • parse http form in a more reliable manner (see comments above)
  • add some tests here — i think a simple new test ensuring that multiple tags get created when you upload a jfr with tags should be good enough.
  • fix linting errors
  • address other comments above
  • rename tags to labels


func parseJFRMultipart(ctx context.Context, in *PutInput, err error, p *Parser, pi *storage.PutInput) error {
reader := multipart.NewReader(in.Body, in.MultipartBoundary)
contextsPart, err := reader.NextPart()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This depends on a very specific order of fields in a form, which I don't think we can guarantee. I think it would be better to address the form field via it's name ("tags"). We do something similar when parsing pprof (there's profile and prev_profile fields). I think you can use this method here: https://github.com/pyroscope-io/pyroscope/blob/42ef7de5c83f59d16cd8551552ba4146fa531d38/pkg/parser/parser.go#L206-L216

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote with the same approach as pprof - read whole request into memory up to 32M.

I think I can parse jfr requests without reading whole reqeust in memory

  1. iterate over multipart fields, if found labels - parse labels, if found jfr - parse jfr
  2. link labels to jfr & put into storage.

@petethepig let me know if I should do it or it is ok to keep as it is now.

@korniltsev
Copy link
Contributor Author

Oops, got test timeout on CI.
Unexpectedly, a JFR file produced on my machine takes 600ms to parse on my machine and >2s on CI.
It should be much less than 600ms
I will investigate reasons.

@korniltsev korniltsev changed the title Add tags to JFR with async-profiler's contextId Add labels to JFR with async-profiler's contextId May 22, 2022
@korniltsev korniltsev requested a review from petethepig June 2, 2022 12:29
@petethepig petethepig changed the title Add labels to JFR with async-profiler's contextId feat: add support for labels when used with JFR and async-profiler's contextId Jun 6, 2022
@petethepig petethepig merged commit b5a57a3 into main Jun 6, 2022
@petethepig petethepig deleted the feat/context_id branch June 6, 2022 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants