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 support for custom middleware (eg. tracing) #14

Merged
merged 12 commits into from
Feb 21, 2024

Conversation

wseaton
Copy link
Contributor

@wseaton wseaton commented Jan 31, 2024

I'm very interested in using this project as an alternative for the gosnowflake API, but one thing I need to get working is tracing support. This attempts to make that possible via feature flag, and it works great testing with local Jaeger and OTLP as the exporter.

Is there a creative way to make this work without forcing users to take opentelemetry_0_21? Or potentially by allowing a SnowflakeApi instance to be created with a fully custom client?

Copy link
Owner

@andrusha andrusha left a comment

Choose a reason for hiding this comment

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

Yes, that's very specific to you functionality to hide behind a feature flag.

I think cleaner solution would be to have a constructor on Connection which accepts ClientWithMiddleware, so you could provide one with whatever middlewares you would like, along with a reasonable default to make using library simpler.

@wseaton
Copy link
Contributor Author

wseaton commented Feb 12, 2024

Sounds good, when I have some time I'll take a pass at that.

@wseaton
Copy link
Contributor Author

wseaton commented Feb 13, 2024

@andrusha I took a crack at a new SnowflakeApiBuilder as a mechanism for exposing the client middleware without breaking the existing SnowflakeApi's API, let me know what you think!

@wseaton wseaton changed the title Add support for tracing Add support for custom middleware (eg. tracing) Feb 13, 2024
@andrusha andrusha requested a review from dmzmk February 15, 2024 20:18
Copy link
Owner

@andrusha andrusha left a comment

Choose a reason for hiding this comment

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

lgtm, appreciate that you've went out of your way to introduce builder

@andrusha
Copy link
Owner

andrusha commented Feb 21, 2024

Could you merge with the main? I've removed nursery linters

@wseaton
Copy link
Contributor Author

wseaton commented Feb 21, 2024

@andrusha done!

@wseaton
Copy link
Contributor Author

wseaton commented Feb 21, 2024

Tests are failing due to doctest in comment, going to mark to be skipped

@andrusha andrusha merged commit ebaa93a into andrusha:main Feb 21, 2024
7 checks passed
@wseaton wseaton deleted the add-tracing branch February 21, 2024 21:16
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