Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support config via query params #13

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

zoidyzoidzoid
Copy link
Owner

@zoidyzoidzoid zoidyzoidzoid commented Mar 11, 2022

Closes #12

  • Add support for query parameters
  • Add tests for them
    • Make sure we use the right API key / host / dataset

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@zoidyzoidzoid
Copy link
Owner Author

I have a feeling this might not actually work.

I need to check what libhoney.Init does, since it might do some global state stuff.

@zoidyzoidzoid zoidyzoidzoid force-pushed the zoid/support-public-instance branch from c259cf3 to 8b22871 Compare March 14, 2022 11:58
@catouc
Copy link
Collaborator

catouc commented May 7, 2022

I have a feeling this might not actually work.

I need to check what libhoney.Init does, since it might do some global state stuff.

I think I found out what libhoney.Init() does - there is a package level variable dc and package level functions like NewEvent() (see the actual code). The package level libhoney.Init() basically does a bunch of shenanigans around the config you passed, setting up transmissions and right at the end calls dc, err = NewClient(clientConf).

Unfortunately there is no Init() method implemented on the actual client struct so to make this possible we'd need to figure out what client we realistically need and build it up ourselves. Apart from that the rest of the exercise becomes straight forward because we could then just hold a HoneyClient *libhoney.Client in our Hook struct, then in the createEvent() function we call the NewEvent() function on our held client instead of the package level one.

The only problem I see currently is that we'd still have to create one client per incoming unique combination of the 3 query params since else we'd run into concurrency bugs and started writing stuff to other peoples honeycomb instances, which seems bad 🙃 We could hold them in a map indexed by the three URL params and have some GC running in the background? Definitely a bit of complexity here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it possible to run a public instance
3 participants