Skip to content
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

fix(backend): upsert annotations #1508

Merged
merged 1 commit into from
Sep 15, 2022
Merged

fix(backend): upsert annotations #1508

merged 1 commit into from
Sep 15, 2022

Conversation

eh-am
Copy link
Collaborator

@eh-am eh-am commented Sep 14, 2022

Closes #1507

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
webapp/public/assets/app.js 430.58 KB (0%) 8.7 s (0%) 4.3 s (-4.87% 🔽) 12.9 s
webapp/public/assets/app.css 16.6 KB (0%) 332 ms (0%) 0 ms (+100% 🔺) 332 ms
webapp/public/assets/styles.css 9.49 KB (0%) 190 ms (0%) 0 ms (+100% 🔺) 190 ms
packages/pyroscope-flamegraph/dist/index.js 92.08 KB (0%) 1.9 s (0%) 1.4 s (-22.01% 🔽) 3.3 s
packages/pyroscope-flamegraph/dist/index.node.js 91.97 KB (0%) 1.9 s (0%) 576 ms (-18.26% 🔽) 2.5 s
packages/pyroscope-flamegraph/dist/index.css 7.32 KB (0%) 147 ms (0%) 0 ms (+100% 🔺) 147 ms

@codecov
Copy link

codecov bot commented Sep 14, 2022

Codecov Report

Base: 65.81% // Head: 66.31% // Increases project coverage by +0.51% 🎉

Coverage data is based on head (c301765) compared to base (4dbde5e).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1508      +/-   ##
==========================================
+ Coverage   65.81%   66.31%   +0.51%     
==========================================
  Files         139      139              
  Lines        4755     4755              
  Branches     1288     1288              
==========================================
+ Hits         3129     3153      +24     
+ Misses       1621     1597      -24     
  Partials        5        5              
Impacted Files Coverage Δ
...lameGraph/FlameGraphComponent/Flamegraph_render.ts 91.47% <0.00%> (+14.64%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

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

Looks good

Comment on lines +33 to +37
if tx.Where(model.CreateAnnotation{
AppName: params.AppName,
Timestamp: params.Timestamp,
}).Updates(&u).RowsAffected == 0 {
return &u, tx.Create(&u).Error
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like a working solution, though I used slightly different approach in past to avoid conflicts – you may find it useful: https://gorm.io/docs/create.html#Upsert-x2F-On-Conflict

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe no conflict will be generated since I haven't added a unique constraint on the columns /facepalm https://github.com/pyroscope-io/pyroscope/blob/main/pkg/sqlstore/migrations/migrations.go#L118-L119

Hopefully it will be solved via #1509

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I see – thank you for the explanation!

@eh-am eh-am merged commit a557183 into main Sep 15, 2022
@eh-am eh-am deleted the fix/annotations-upsert branch September 15, 2022 14:29
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.

Upsert annotation is not working
2 participants