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: support classic ingest keys #96

Merged
merged 7 commits into from
Mar 4, 2024

Conversation

brookesargent
Copy link
Contributor

@brookesargent brookesargent commented Mar 1, 2024

Which problem is this PR solving?

  • We've released Ingest Keys, but need to update the key detection logic to allow Ingest Keys to be used to send data to Classic environments.

Short description of the changes

  • Updated the IsClassic lambda expression to a function with the new Regex logic
  • Updated the Dataset test to include cases for the new key format**

** Note: For most other libhoneys we have made this IsClassic function public. However, since .NET does not have a beeline, it seemed like it would be best to leave this as a private method. Since it is private, it also becomes harder to write a unit test for, which is why I am testing it through DefaultDataset. Let me know if there's a preferred approach to testing private methods through reflection or something like that.


@brookesargent brookesargent requested a review from a team March 1, 2024 14:07
@brookesargent brookesargent marked this pull request as ready for review March 1, 2024 14:10
@brookesargent brookesargent requested a review from a team as a code owner March 1, 2024 14:10
Copy link

@cewkrupa cewkrupa left a comment

Choose a reason for hiding this comment

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

Testing this change the same way the isClassic check was being tested before makes sense if we're keeping it a private method! I could still be convinced to make it a public method, but this seems perfectly fine to me

@MikeGoldsmith MikeGoldsmith added type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible. labels Mar 4, 2024
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.

The new function looks good. I've added a commit to make the IsClassic function internal and then exposed it to the test project using the InternalsVisbleTo directive. This means the function isn't public for consumers to see / use and can be tested.

If you could add some tests IsClassic like we have for the other libhoney's, that would be great.

@MikeGoldsmith MikeGoldsmith force-pushed the brooke.support-classic-ingest-keys branch from 0f18191 to ee91934 Compare March 4, 2024 13:04
@MikeGoldsmith MikeGoldsmith force-pushed the brooke.support-classic-ingest-keys branch from ee91934 to b0d6415 Compare March 4, 2024 13:06
@brookesargent
Copy link
Contributor Author

The new function looks good. I've added a commit to make the IsClassic function internal and then exposed it to the test project using the InternalsVisbleTo directive. This means the function isn't public for consumers to see / use and can be tested.

If you could add some tests IsClassic like we have for the other libhoney's, that would be great.

Thanks for your help, Mike! Just pushed up some direct tests for IsClassic

@brookesargent brookesargent added the merge at will Reviewer can merge the PR once reviewed. label Mar 4, 2024
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 👍🏻

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 👍🏻

PS I noticed one more small suggestion for checking the write key is not null / empty.

Co-authored-by: Mike Goldsmith <goldsmith.mike@gmail.com>
@MikeGoldsmith MikeGoldsmith merged commit ad8f93b into main Mar 4, 2024
3 checks passed
@MikeGoldsmith MikeGoldsmith deleted the brooke.support-classic-ingest-keys branch March 4, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge at will Reviewer can merge the PR once reviewed. 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.

3 participants