-
Notifications
You must be signed in to change notification settings - Fork 179
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
refactor: Freeze all range objects #1172 #1222
refactor: Freeze all range objects #1172 #1222
Conversation
Created a readable constant in 8 files to freeze ranges 100..399 . Relate to open-telemetry#1172
….399 . Reviewed-by: kaylareopelle Refs: open-telemetry#1172
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.
@open-telemetry/ruby-contrib-approvers now that I'm looking at this I'm wondering if there is an opportunity to extract status setter helper method rather than defining a range per http instrumentation and implementing the same logic in each instrumentation separately.
Something like this
Semconv::Http::Client.set_status(span, http_status_code)
Which would then set the span status based on the http status code falling in the range of bad client status code.
That would reduce the number of places we would need to update when satisfying the specification.
Maybe that could be a follow up PR and this perf refactoring is a first step?
@arielvalentin - I like that idea! My vote would be to keep this refactoring as a first step and open that up in a follow-up PR. |
Hi @Victorsesan! Thanks for re-opening this PR! It looks like there are a few rubocop (Ruby linter) failures on your changes. The general message is:
I think the solution is to remove If you'd like to run rubocop locally to test yourself, you can do so using: docker compose run app
<container_sha>: /app$ cd instrumentation/http_client
<container_sha>: /app/instrumentation/http_client$ bundle install
<container_sha>: /app/instrumentation/http_client$ bundle exec rubocop |
Reviewed-by: kaylareopelle Refs: open-telemetry#1172
Thanks very much for reviewing @kaylareopelle . I have taken a look at the failures again from my end and have them sorted. Some end-of-line characters & carriage return test failures were also found which i converted with |
Hi @Victorsesan! Thank you for your Rubocop updates! Great work so far! It looks like your latest commit resolved the Rubocop error only on HTTP Client instrumentation. I should've been more specific in my earlier instructions that they would only run the HTTP Client instrumentation. The changes in your PR span multiple instrumentation libraries. This means you'll need to change directory into those libraries within the Docker container to run Rubocop on each of them. Alternatively, you could try a find-and-replace to remove the If you'd like to try to run Rubocop locally on each of those libraries, you can do so by: docker compose run app
<container_sha>: /app$ cd instrumentation/<gem name, ex. ethon>
<container_sha>: /app/instrumentation/<gem name>$ bundle install
<container_sha>: /app/instrumentation/<gem name>$ bundle exec rubocop --autocorrect
<container_sha>: /app/instrumentation/<gem name>$ cd ../<next gem name, ex. excon>
<container_sha>: /app/instrumentation/<next gem name>$ bundle install
<container_sha>: /app/instrumentation/<next gem name>$ bundle exec rubocop --autocorrect
# repeat for the remaining gems: faraday, http, httpx, net_http, restclient |
Reviewed-by: kaylareopelle Refs: open-telemetry#1172
Did i hit the mark this time, @kaylareopelle . I might have missed something tho🤔 , i had some offenses which i'm not sure i understand what they're. |
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.
Hi @Victorsesan, this looks great! 🎉
Thank you so much for your patience and willingness to work with me through this.
I think the extra offenses you saw are related to an issue with the way Windows terminates lines. This Stack Overflow might help for the future.
Ref #1172