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

Add instrumentation for sql.Exec #733

Merged
merged 6 commits into from
Apr 12, 2024
Merged

Add instrumentation for sql.Exec #733

merged 6 commits into from
Apr 12, 2024

Conversation

marctc
Copy link
Contributor

@marctc marctc commented Apr 11, 2024

This PR adds missing instrumentation for database/sql package for sql.Exec

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 53.84615% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 69.09%. Comparing base (64c90d4) to head (b8eab56).

Files Patch % Lines
pkg/internal/ebpf/nethttp/bpf_debug_x86_bpfel.go 0.00% 2 Missing ⚠️
...kg/internal/ebpf/nethttp/bpf_tp_debug_x86_bpfel.go 0.00% 2 Missing ⚠️
pkg/internal/ebpf/nethttp/bpf_tp_x86_bpfel.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #733      +/-   ##
==========================================
- Coverage   76.04%   69.09%   -6.95%     
==========================================
  Files         105      128      +23     
  Lines        8527     9746    +1219     
==========================================
+ Hits         6484     6734     +250     
- Misses       1683     2628     +945     
- Partials      360      384      +24     
Flag Coverage Δ
integration-test 61.88% <53.84%> (-6.12%) ⬇️
unittests 33.40% <0.00%> (-4.83%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -39,7 +39,8 @@ func main() {
if len(urlQuery["query"]) > 0 {
queryString := urlQuery["query"][0]
fmt.Println("query arg in url query is:", queryString)
rows, e = db.Query(queryString)
//rows, e = db.Query(queryString)
_, e = db.Exec(queryString)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you probably want to check if the query doesn't start with 'SELECT' and run db.Query if it's 'SELECT'

@marctc marctc changed the title Add exec dc Add instrumentation for sql.Exec Apr 11, 2024
@marctc marctc marked this pull request as ready for review April 11, 2024 16:11
@marctc marctc requested a review from mariomac as a code owner April 11, 2024 16:11
Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

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

LGTM! Great job!

@marctc marctc merged commit 48c0e2d into main Apr 12, 2024
4 checks passed
@marctc marctc deleted the add_exec_dc branch April 12, 2024 07:40
mattdurham pushed a commit to mattdurham/beyla that referenced this pull request Jan 22, 2025
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