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 Grape raising error while tracing is disabled #1943

Merged
merged 1 commit into from
Mar 22, 2022

Conversation

delner
Copy link
Contributor

@delner delner commented Mar 18, 2022

Closes #1940

When tracing is disabled, the enabled? function in Grape instrumentation was still evaluating to true, because it was only checking the Grape configuration setting. This would cause instrumentation to still run, but yield a nil trace and attempt to decorate it.

Updating enabled? to check for whether tracing.enabled is set fixes the issue.

It would be better in the future if setting c.tracing.enabled simply precluded all instrumentation blocks, but our API currently doesn't support this. Thus, instrumentation must check the state itself. Something to improve another time.

@delner delner added bug Involves a bug integrations Involves tracing integrations labels Mar 18, 2022
@delner delner added this to the 1.0.0.beta2 milestone Mar 18, 2022
@delner delner self-assigned this Mar 18, 2022
@delner delner requested a review from a team March 18, 2022 20:33
Copy link
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

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

Fix looks reasonable, thanks!

@delner delner force-pushed the fix/grape_resource_while_disabled branch from f409c07 to c3e2706 Compare March 22, 2022 20:02
@delner delner merged commit ea4219d into master Mar 22, 2022
@delner delner deleted the fix/grape_resource_while_disabled branch March 22, 2022 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug integrations Involves tracing integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined method 'resource=' for nil:NilClass: Disabling tracing breaks grape application on 1.0.0.beta1
2 participants