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

feat: Allow URL encoded dataset in libhoney endpoint paths #1199

Merged
merged 9 commits into from
Jun 17, 2024

Conversation

MikeGoldsmith
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith commented Jun 13, 2024

Which problem is this PR solving?

Allow URL encoded dataset names in /event and /batch endpoint.

For example, to send data to a dataset with the name foo/bar, you can now send data like this:

curl -i -H "x-honeycomb-team: <api-key>" -X POST 'http://localhost:8080/1/events/foo%2Fbar' -d '{"name":"mike"}'

The dataset name foo%2Fbar is URL decoded into foo/bar and used as the dataset name. When forwarding events to the Honeycomb API, the dataset name is URL encoded again to ensure it's received into HNY correctly.

Short description of the changes

  • Update mux router to allow encoded paths
  • Add utility function to get the dataset from mux vars and url escape the value
  • Add tests for utility function
  • Simplify batch event processing by removing batchedEventToEvent, adding getSampleRate batchEvent member func and re-using apiHost and dataset

@MikeGoldsmith MikeGoldsmith self-assigned this Jun 13, 2024
@MikeGoldsmith
Copy link
Contributor Author

Waiting on the following PR:

@MikeGoldsmith MikeGoldsmith marked this pull request as ready for review June 13, 2024 20:20
@MikeGoldsmith MikeGoldsmith requested a review from a team as a code owner June 13, 2024 20:20
route/route.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

I don't need to block it, but given that there's an old TODO there and this code is being touched...

route/route_test.go Show resolved Hide resolved
route/route.go Show resolved Hide resolved
@MikeGoldsmith MikeGoldsmith merged commit 59418df into main Jun 17, 2024
4 checks passed
@MikeGoldsmith MikeGoldsmith deleted the mike/encodes-datasetname branch June 17, 2024 10:45
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.

3 participants