-
Notifications
You must be signed in to change notification settings - Fork 193
Bug Fix: Propagate managerWrapException setting in mkManagerSettingsContext'
#566
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
base: master
Are you sure you want to change the base?
Conversation
|
@adithyaov sorry, I'm still a little bit lost here. Am I right to assume that you consider this a bug fix (as opposed to a new feature)? As for cachix/hs-opentelemetry-instrumentation-http-client, is it currently completely broken, or does it work in certain situations, but not in others? Can you explain in which situations it works, and what you are doing differently so that it does not work for you? I capture that Also, do you currently have any workarounds? (e.g. can you achieve what are you're trying to do by setting |
|
@sol Yes, sorry, this is a bug fix. This isn't a new feature. cachix/hs-opentelemetry-instrumentation-http-client works as expected when
I don't understand what you mean by the user's perspective. Could you please elaborate?
A workaround is possible, but this PR is primarily a bug fix. The only reason I've added more context on our usage is to motivate this fix. I should've worded it better. |
managerWrapException setting in mkManagerSettingsContext'
Something like
I think I have all the information I need now. But for the future, something like this would tell me:
|
@adithyaov do you think this is observable? |
|
I think we have the same issue with other settings as well, e.g. |
|
I think that the best way here is
In this case we will be consistent with non-TLS client:
This bug is really annoying... UPD: But in this case the old code with |
Summary
mkManagerSettingsContext'replaces amanagerWrapExceptionin theManagerSettings, which prevents themanagerWrapExceptionfrom the input settings from being propagated, resulting in the loss of input behaviour.This PR is a bug fix.
Problem description
Functions of interest:
managerWrapExceptioninManagerSettings.mkManagerSettingsContext'.newTlsManagerWith.managerWrapException
Consider the setting
managerWrapExceptionin theManagerSettings. It's a modifier of type:The assumption is that the action configured here is triggered at a certain point in the execution flow. (Where it is triggered is irrelevant to the issue).
mkManagerSettingsContext'
mkManagerSettingsContext'does a lot of things, but the relevant part is the following.There is an input argument
set :: ManagerSettings. This function returns the modifiedManagerSettingsusing the inputManagerSettings.The important thing to note here is that the
managerWrapExceptionfrom the inputManagerSettingsis ignored and overwritten.This means, if we had previously configured
managerWrapExceptionand createdManagerSettings. UsingmkManagerSettingsContext'on theManagerSettingswe created will overwrite the configured functionality.newTlsManagerWith
newTlsManagerWithtakes an inputManagerSettingsand returns aManager.newTlsManagerWithusesmkManagerSettingsContext'on the inputManagerSettingsbefore creating aManager. So the configuredmanagerWrapExceptionis lost when theManageris created.Changes made
The change in this PR modifies
mkManagerSettingsContext'so that it uses themanagerWrapExceptionfrom the inputManagerSettings.Side effects of this change
mkManagerSettingsContext'was originally idempotent; this change breaks that idempotency.The only issue I see is that multiple applications of
mkManagerSettingsContext'will nest the handler inmanagerWrapException. This occurs when we do something likenewTlsManagerWith tlsManagerSettings.Verification
The test case added will fail without the change but will succeed with the change.
More context on why this is required
We are using cachix/hs-opentelemetry-instrumentation-http-client for integrating
hs-opentelemetry.This package hooks telemetry (hs-opentelemetry) into the HTTP manager. The pre-hook is inserted into
managerWrapException, and the post-hook intomanagerModifyResponse.