Skip to content

Conversation

@sam-kayg
Copy link

@sam-kayg sam-kayg commented Oct 18, 2024

Explicitly handle the case when the backend provided by params is not supported by AppProfiler

Skip profiling if the backend is not supported
@sam-kayg sam-kayg force-pushed the validate-backend-params branch from 4114413 to d402d3a Compare October 18, 2024 14:35
@sam-kayg sam-kayg marked this pull request as ready for review October 18, 2024 14:38
end

def valid_backend?
return true if AppProfiler::Backend::StackprofBackend.name == backend
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it achieves the same outcome and it is probably a matter of personal preference - but I would rather get rid of AppProfiler::Backend::StackprofBackend.name == backend and have something which checks if backend is one of the two. We can define a constant AVAILABLE_BACKENDS

end

test "#valid? returns false when backend is not supported" do
AppProfiler.logger.expects(:info).with { |value| value =~ /unsupported backend='not-a-real-backend'/ }
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we do not need check the logs and valid? is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants