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

Automatically ignore Rails' health-check #1317

Closed
wants to merge 1 commit into from

Conversation

unflxw
Copy link
Contributor

@unflxw unflxw commented Oct 11, 2024

Suggested by a customer: https://app.intercom.com/a/inbox/yzor8gyw/inbox/shared/unassigned/conversation/16410700366724#part_id=comment-16410700366724-21909575460

(leaving this as a draft to not forget; will make a proper PR later)

Adds Rails::HealthController#show to the default ignore_actions
value.

Modified some existing tests that used ignore_actions as an array
config option that defaulted to empty, so that they use ignore_errors
instead.

See https://github.com/appsignal/diagnose_tests/compare/add-ignore-actions-ruby-default-value for diagnose tests changes.

@unflxw unflxw self-assigned this Oct 11, 2024
@backlog-helper
Copy link

backlog-helper bot commented Oct 11, 2024

✔️ All good!

New issue guide | Backlog management | Rules | Feedback

@unflxw
Copy link
Contributor Author

unflxw commented Oct 14, 2024

Wondering how to move forward with this. The idea of ignoring this by default makes sense to me.

But adding it into the config option means that, when customers override the config option, they'll override this as well, forcing them to add it back manually as part of the override. However, that's also how the REQUEST_HEADERS config option works, so maybe it's fine.

We could make the config option merge with the default list instead of replacing it, but then that's equivalent to it being hardcoded -- there's no way customers can delete this entry from the list. Which is fine, probably? I see no use case for wanting calls to this endpoint to be instrumented.

EDIT: Decided to go with the first option for now, open to changing it though. Will wait to move forward until @tombruijn is back.

Suggested by a customer: https://app.intercom.com/a/inbox/yzor8gyw/inbox/shared/unassigned/conversation/16410700366724#part_id=comment-16410700366724-21909575460

Adds `Rails::HealthController#show` to the default `ignore_actions`
value.

Modified some existing tests that used `ignore_actions` as an array
config option that defaulted to empty, so that they use `ignore_errors`
instead.
@tombruijn
Copy link
Member

Wondering how to move forward with this. The idea of ignoring this by default makes sense to me.

But adding it into the config option means that, when customers override the config option, they'll override this as well, forcing them to add it back manually as part of the override. However, that's also how the REQUEST_HEADERS config option works, so maybe it's fine.

We could make the config option merge with the default list instead of replacing it, but then that's equivalent to it being hardcoded -- there's no way customers can delete this entry from the list. Which is fine, probably? I see no use case for wanting calls to this endpoint to be instrumented.

EDIT: Decided to go with the first option for now, open to changing it though. Will wait to move forward until @tombruijn is back.

This is a limitation for the YAML file mostly. In the Appsignal.configure helper, which I want to make the recommended config method, apps can merge their config and remove defaults if they want.

Appsignal.configure do |config|
  # Overwrite defaults with a new list of ignored actions
  config.ignore_actions = ["MyController#action"]
  # Delete specific defaults and keep other gem defaults
  config.ignore_actions.delete("Rails::HealthController#show")
  # Merge app config with gem defaults
  config.ignore_actions << "MyController#action"
end

For the environment variables I hope this is less of an issue and we can wait until someone presents us a case where it needs to be done using environment variables, and cannot be somehow done with the Appsignal.configure helper.

Comment on lines +84 to +86
:ignore_actions => [
"Rails::HealthController#show"
],
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to add these to the Rails loader defaults, like the other Rails specific config. It will be part of the config of apps using both Rails and another framework.

Appsignal::Config.add_loader_defaults(

@unflxw
Copy link
Contributor Author

unflxw commented Oct 16, 2024

Feedback needs to be addressed and approved before merging.

@tombruijn tombruijn self-assigned this Oct 21, 2024
@tombruijn
Copy link
Member

I can pick this up while Noemi is away.

@tombruijn
Copy link
Member

Created a new PR with a different implementation here: #1321

@tombruijn tombruijn closed this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants