Go route harvesting - #889
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #889 +/- ##
==========================================
- Coverage 55.08% 54.99% -0.09%
==========================================
Files 251 252 +1
Lines 21505 21600 +95
==========================================
+ Hits 11845 11878 +33
- Misses 8843 8904 +61
- Partials 817 818 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rafaelroquetto
approved these changes
Nov 13, 2025
|
|
||
| // Get method from the incoming call arguments | ||
| if (!read_go_str_n("method", method_ptr, (u64)method_len, &trace->path, sizeof(trace->path))) { | ||
| if (!read_go_str_n("method", method_ptr, (u64)method_len, trace->path, sizeof(trace->path))) { |
| req, | ||
| go_offset_of(ot, (go_offset){.v = _method_ptr_pos}), | ||
| &invocation.method, | ||
| invocation.method, |
Contributor
There was a problem hiding this comment.
man, how come this was working? nice catch
Contributor
Author
There was a problem hiding this comment.
madness :) I have no idea, address of an address.
Merged
marctc
pushed a commit
to grafana/opentelemetry-ebpf-instrumentation
that referenced
this pull request
Dec 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds extraction of the HTTP routes from Go programs. I've added support for the built-in Go Mux that was introduced in 1.21, Gorilla Mux and Gin. This should cover a lot of the use-cases, the rest of the frameworks will use the regular heuristic matcher.
I also looked into reading the go binary symbol tables and extracting routes like we did for Java, but it proved to not be feasible. We essentially would need to disassemble all of the code and then look for instructions that read the symbol tables, then figure out if those are actually HTTP routes.
Instead my approach uses uprobes in the frameworks to read the route value when they match it internally and determine the handler.