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

Add endpoints to help debug refinery rules #500

Merged
merged 7 commits into from
Sep 6, 2022
Merged

Conversation

kentquirk
Copy link
Contributor

Which problem is this PR solving?

There have been multiple reports of people not realizing their configs were not parsing the way they were intended. This adds two endpoints:

  • /debug/allrules/$FORMAT will retrieve the entire rules configuration
  • /debug/rules/$FORMAT/$DATASET will retrieve the rule set that refinery will use for the specified dataset. It comes back as a map of the sampler type to its rule set.

Short description of the changes

  • Add the endpoints
  • Add a feature to config to return the full rule set
  • Extend existing config feature to return the sampler name along with its rules struct
  • Add/expand tests for it all

@kentquirk kentquirk requested review from a team and JamieDanielson September 4, 2022 21:41
@kentquirk kentquirk changed the title Kent.debug config Add endpoints to help debug refinery rules Sep 5, 2022
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Looks good - suggested small fix to return early when handling bad requests

route/route.go Show resolved Hide resolved
route/route.go Show resolved Hide resolved
@MikeGoldsmith MikeGoldsmith added type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible. labels Sep 6, 2022
@kentquirk kentquirk merged commit 8442d86 into main Sep 6, 2022
@kentquirk kentquirk deleted the kent.debug_config branch September 6, 2022 19:31
kentquirk added a commit that referenced this pull request Sep 6, 2022
## Which problem is this PR solving?

- Adds a local query token to allow the changes in #500 to be protected by a locally-defined token in a header.

## Short description of the changes

- Before #500, there was a single /debug/trace endpoint, but there is also an optional /debug endpoint intended for use with a debugger and profiler. So I renamed /debug to /query for the trace and config.
- I added to these new /query endpoints a local configuration value `QueryAuthToken` that can be specified in the config file or in the environment. If specified, the `X-Honeycomb-Refinery-Query` header must be specified on a query request.
- If the QueryAuthToken is not specified in the configuration, the /query endpoints are not accessible. 

Note that because the `/debug/trace` request has been renamed and is now protected by a token, this is technically a breaking change (although `/debug/trace` isn't intended for regular operation and wasn't documented outside of the source code).
ghost pushed a commit to opsramp/tracing-proxy that referenced this pull request Jul 5, 2024
## Which problem is this PR solving?

There have been multiple reports of people not realizing their configs were not parsing the way they were intended. This adds two endpoints:
- `/debug/allrules/$FORMAT` will retrieve the entire rules configuration
- `/debug/rules/$FORMAT/$DATASET` will retrieve the rule set that refinery will use for the specified dataset. It comes back as a map of the sampler type to its rule set.

## Short description of the changes

- Add the endpoints
- Add a feature to config to return the full rule set
- Extend existing config feature to return the sampler name along with its rules struct
- Add/expand tests for it all
ghost pushed a commit to opsramp/tracing-proxy that referenced this pull request Jul 5, 2024
## Which problem is this PR solving?

- Adds a local query token to allow the changes in honeycombio#500 to be protected by a locally-defined token in a header.

## Short description of the changes

- Before honeycombio#500, there was a single /debug/trace endpoint, but there is also an optional /debug endpoint intended for use with a debugger and profiler. So I renamed /debug to /query for the trace and config.
- I added to these new /query endpoints a local configuration value `QueryAuthToken` that can be specified in the config file or in the environment. If specified, the `X-Honeycomb-Refinery-Query` header must be specified on a query request.
- If the QueryAuthToken is not specified in the configuration, the /query endpoints are not accessible. 

Note that because the `/debug/trace` request has been renamed and is now protected by a token, this is technically a breaking change (although `/debug/trace` isn't intended for regular operation and wasn't documented outside of the source code).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants