-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(otel): Add native OpenTelemetry Transport module #3938
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
base: master
Are you sure you want to change the base?
feat(otel): Add native OpenTelemetry Transport module #3938
Conversation
|
@gmlewis - Surprise! Haha. Please review. |
|
@merchantmoh-debug - I'm starting to think I'm talking to a bot. |
|
@gmlewis - Yeah. My bad. It's on my local disk set up. I use antigravity heavily. It likely made an error. I'll fix it. |
1d9b307 to
4536640
Compare
A bot that codes 3x performance boosts to stringify? Can I get access to that bot please? |
|
@merchantmoh-debug - are you planning on updating this PR as requested, or shall we close it since the PR title and description have nothing to do with the changes that have been made? |
42cbea7 to
0b0ca7c
Compare
|
@gmlewis - Fixed. |
0b0ca7c to
19330d6
Compare
alexandear
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix lint issues: ./script/lint.sh.
19330d6 to
c786a38
Compare
|
Thanks for the review @alexandear @gmlewis I've addressed all your feedback in the latest push: Directory Structure: Moved otel/example to example/otel to align with repo conventions. Standards: Added missing Copyright headers (2026) and updated the instrumentationName to v82. Code Design: Exported HeaderRateReset in github/github.go and updated transport.go to use this constant instead of the hardcoded string. Maintenance: Added a sentinel // NOTE comment above instrumentationName to flag it for manual updates during release cycles. Linting: Ran go mod tidy in both the root and example directories to resolve the go.sum validation errors. Requesting review @gmlewis @alexandear |
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can completely remove otel/example/* since the example now lives in example/otel.
Please fix the linting and test errors (see CONTRIBUTING.md) and push the changes before we can fully review this PR.
c786a38 to
9ea671d
Compare
|
@merchantmoh-debug - you just force-pushed over 1000 files.
|
|
@gmlewis - Lmao. Antigravity is finicky. My bad. It's still a google labs product.... hahaha - I'm laughing my head off right now. "Over 1000" omg what did it push? my entire library? lmao. I'll reverse it --- If the lint doesn't fix I might need your help figuring it out. |
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merchantmoh-debug - please remove the "go" folder.
I really wish you would review your PRs using the GitHub user interface before requesting code reviews as this is truly a waste of my time and patience.
Hey @merchantmoh-debug, could you manually edit and push changes by using
No worries! You can fix lint issues easily by running |
|
@gmlewis - Well seeing as I'm both using my time & patience to give google free upgrades to its library - - We both lose time when things to go right now don't we? Yeah - once more; I'm still learning the ropes. Ever taught at a school? You don't get far with impatience & frustration. You have to be patient. Don't be fooled by the competence of my coding and assume I know what I'm doing fully. I don't. I'm a unicorn - you'll have to delete any patterns you have on what's "normal" when dealing with me. I'm High-IQ Autistic, Non-Automatic TOMS < (I bet you can tell) > ADHD > OCD > OCPD. I see the world in systems and logic. It makes me amazingly good at learning extremely complex things extremely quickly. But it often leads me to learn something like "How to be a badass coder" before I ever learn "How to navigate Githubs user-interface" And I like to trial & error my way through problems - try, review, try, review - I WOULD do this automatically but the tests are set to only happen when you review. Forcing a human-in-the-loop situation where you get frustrated when I make an oppsie which will NOT stop happening right away. It's the trade off of the neurodivergent my friend - super-smart but super-hard to deal with. And me? I'm actually pretty good to deal with in comparison. 🤷♂️ |
@alexandear - Thanks! I appreciate the guidance! Yeah of course! No problem! I'll manually edit them! You're awesome. |
9ea671d to
03b05e6
Compare
|
@alexandear - Thanks for the cheat sheet & the other link. Huge help. Saves a lot of your guys time now that I can do the testing myself. I'll update soon. |
|
@gmlewis @alexandear - I'm testing it extensively -- yet for some reason it keeps failing the github workflow even though it passes the local one. Weird. To decompress I made this song for us - https://www.youtube.com/watch?v=AL175r0MQ4E Any ideas where we're going wrong? |
Yes, the copyright message wasn't exactly identical to other files and |
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, great... we are almost there.
Now we need a new file called "otel/transport_test.go" that will provide excellent code coverage over its corresponding "otel/transport.go" file and then we should hopefully be ready for a final review.
You will need to "git pull" the changes I made to your current branch to get the copyright and formatting changes locally so that you can continue.
example/otel/main.go
Outdated
| // Use of this source code is governed by a BSD-style | ||
| // license that can be found in the LICENSE file. | ||
|
|
||
| // This example demonstrates ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfinished sentence. What this package demonstrates? 🙃
Run `go mod tidy` in `example/otel` and `otel` to resolve linting and testing failures. This updates `go.opentelemetry.io/otel/sdk` from v1.24.0 to v1.27.0 in the example module, aligning it with the core `otel` module and resolving the "context loading failed" error in `script/lint.sh`. Co-authored-by: merchantmoh-debug <241568449+merchantmoh-debug@users.noreply.github.com>
…427587979539721511 fix(otel): synchronize dependencies in example/otel
|
@gmlewis - Give it a go bro. Should pass the lint now. |
example/otel/main.go
Outdated
| ), | ||
| } | ||
|
|
||
| // Create GitHub client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is not needed. It's clear that github.NewClient creates a GitHub client
| HeaderRateReset = "X-Ratelimit-Reset" | ||
| HeaderRateResource = "X-Ratelimit-Resource" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exported constants should be moved above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above, but below the Version.
otel/transport.go
Outdated
| span.SetAttributes(attribute.Int("github.rate_limit.limit", v)) | ||
| } | ||
| } | ||
| if remaining := resp.Header.Get("X-Ratelimit-Remaining"); remaining != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use a constant from the github package.
|
@alexandear - On it. |
- Export and group rate limit header constants in `github/github.go`. - Update `otel/transport.go` to use exported constants instead of string literals. - Remove redundant comment in `example/otel/main.go`. - Fix module version mismatch in `otel` and `example/otel` to match `v81` and align OpenTelemetry dependency versions. - Ensure all tests pass. Co-authored-by: merchantmoh-debug <241568449+merchantmoh-debug@users.noreply.github.com>
…back-15903149166570935690
…ack-15903149166570935690 Apply code review feedback for OpenTelemetry support
|
|
||
| const ( | ||
| // instrumentationName is the name of this instrumentation package. | ||
| // NOTE: This must be updated when the major version of go-github changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is no longer needed?
| if reset := resp.Header.Get(github.HeaderRateReset); reset != "" { | ||
| span.SetAttributes(attribute.String("github.rate_limit.reset", reset)) | ||
| } | ||
| if reqID := resp.Header.Get("X-Github-Request-Id"); reqID != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can create a constant for the "X-Github-Request-Id" string in the github package.
@gmlewis what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM.
| HeaderRateReset = "X-Ratelimit-Reset" | ||
| HeaderRateResource = "X-Ratelimit-Resource" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above, but below the Version.
| // Primary rate limit exceeded: GitHub returns 403 or 429 with X-RateLimit-Remaining: 0 | ||
| // See: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api | ||
| case (r.StatusCode == http.StatusForbidden || r.StatusCode == http.StatusTooManyRequests) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be removed.
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
|
@gmlewis - I'll update in about 30 minutes. It'll pass the lint & ubuntu -- I'll ping you to request a review when it's done. Then we can knock this one out today as well (hopefully) |

Adds a new optional module
github.com/google/go-github/v81/otelwhich provides anhttp.RoundTripperinstrumented with OpenTelemetry.Features
github/GET).X-RateLimit-*) and records them as Span Attributes (github.rate_limit.remaining,github.rate_limit.reset).X-Github-Request-Idfor easy debugging with GitHub Support.Verification
Validated with
otel/exampleapp against the live API.Dependencies are isolated in a nested module to avoid bloating core
go-github.