-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add system config options for success / failure levels to write blocking / non-blocking activations to db #5169
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 system config options for success / failure levels to write blocking / non-blocking activations to db #5169
Conversation
protected val unstoredLogsEnabledConfig = loadConfigOrThrow[Boolean](ConfigKeys.unstoredLogsEnabled) | ||
|
||
/** | ||
* Checks if an activation should be stored in database and stores it. | ||
* | ||
* @param activation activation to store | ||
* @param isBlockingActivation is activation blocking | ||
* @param disableBlockingStore do not store activation if successful and blocking | ||
* @param disableNonBlockingStore do not store activation if successful and non-blocking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Widening the signature here this way strikes me as confusing - couldn't this be better done with an enum: always store
, never store
, store for non blocking only
, etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my question would be how could you do that without breaking the config that already exists for disableBlockingStore
that's presumably already being used?
The other thing is I think people still want to distinguish between successful and failures so they only want to turn off writes for successes. I'm not sure what the best solution is or what options should be offered.
I think I understand your suggestion in that there could be an enum set with values ALWAYS_STORE_SUCCESSES
, STORE_BLOCKING_SUCCESSES
, STORE_NONBLOCKING_SUCCESSES
, STORE_NO_SUCCESSES
. However I think doing this would break deployments unless we kept it as two booleans in the config as currently is in the pr and built the enum from the boolean values. But I think that defeats the purpose of setting up the enum at all.
And then on our discussion for our use case specifically with only needing specific failure types written (developer and system). I think that should be a separate check which could either be an enum or just a boolean of storeApplication Errors
since I think developer and system errors both are very similar in what they mean. The divider in failures to me is really just whether it's a user application error or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are two orthogonal issues - one is configuration and making that backward compatible. The other is the internal interface and implementation.
I think the distinctions you want to make suggests this alternate/simpler enum:
STORE_ALWAYS
(default)STORE_ON_FAILURE
STORE_NON_BLOCKING
From a configuration point of view, you can continue to accept the current configuration property (perhaps with a deprecation warning) and introduce a new configuration that maps to the enum. It would be an error to specify both configurations properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with that setup. The one case that I think is confusing is the existing boolean and wanting failed blocking activations to still be stored. Because setting the current boolean means store failed blocking activations and non-blocking activations. So that falls between STORE_ON_FAILURE
and STORE_NON_BLOCKING
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that STORE_ON_FAILURE
applies to everything. I suppose we can have two modes for this: STORE_ON_FAILURE_BLOCKING_AND_NON_BLOCKING
for sync/async and STORE_ON_FAILURE_NON_BLOCKING_ONLY
(and so OK there are four again :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I have. I can't think of a scenario where someone would want a subset of non blocking activations written, but not a larger subset for blocking. I can only think of wanting a subset of blocking and wanting a larger subset for non-blocking. I'll update the pr if you're good with this
STORE_ALWAYS
STORE_NON_BLOCKING_OR_ON_BLOCKING_FAILURE
STORE_ON_FAILURE
STORE_ON_NON_APPLICATION_FAILURE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STORE_NON_BLOCKING_OR_ON_BLOCKING_FAILURE
and STORE_ON_FAILURE
are redundant for blocking invokes, no? That is, to store all non blocking I'd use STORE_NON_BLOCKING_OR_ON_BLOCKING_FAILURE
and to only store non blocking failures, I'd use STORE_ON_FAILURE
and to store blocking failures, i can use either. (I think the parameters should be orthogonal.)
I like the addition of STORE_ON_NON_APPLICATION_FAILURE
- It further refines the on failure mode - so this would capture system errors and uncaught exceptions in the end user code.
Another crank on your suggestions nets us here, perhaps?
STORE_ALWAYS
(default)
STORE_NON_BLOCKING
STORE_FAILURES
STORE_FAILURES_NOT_APPLICATION_ERRORS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea so what I was originally going to say as well is that I think we're just getting close to having a separate config for each invocation type, blocking and non-blocking. In your list, the original person that created the blocking config wanted only blocking failures and all non-blocking; which is why I had STORE_NON_BLOCKING_OR_ON_BLOCKING_FAILURE
. Almost everyone would want this because not storing any non-blocking means you can't run sequences I believe, we don't have any need for that feature which is why we can turn off non-blocking. But you are correct that would mean the parameters aren't orthogonal, which is why I think we're at the point of just having two separate params with the same enum.
STORE_ALWAYS
STORE_FAILURES
STORE_FAILURES_NOT_APPLICATION_ERRORS
Codecov Report
@@ Coverage Diff @@
## master #5169 +/- ##
===========================================
+ Coverage 44.49% 72.92% +28.43%
===========================================
Files 237 238 +1
Lines 13922 13941 +19
Branches 593 588 -5
===========================================
+ Hits 6194 10166 +3972
+ Misses 7728 3775 -3953
Continue to review full report at Codecov.
|
I shared some feedback in slack on this PR. I can post those comments here as well. |
edde4b0
to
ecf5d05
Compare
ecf5d05
to
7916d90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - I still am not convinced we need two different logging levels for blocking vs non blocking but this doesn't preclude us from still collapsing the two flags in the future.
Also while the old setting is deprecated, it is taking precedence - is this the intent? I thought the idea was to check if the new fields are set and if so, use their values (they supersede) and if not, use the value implied by the deprecated property.
common/scala/src/main/scala/org/apache/openwhisk/core/database/ActivationStore.scala
Outdated
Show resolved
Hide resolved
common/scala/src/main/scala/org/apache/openwhisk/core/database/ActivationStore.scala
Outdated
Show resolved
Hide resolved
6ea9983
to
7bbac30
Compare
@rabbah Yea I believe that's what we discussed, but I made it so the store level config is required to have. I updated it such that the deprecated config is only used if it is set to true and the new blocking config has not been changed from the default value which is |
common/scala/src/main/scala/org/apache/openwhisk/core/database/ActivationStore.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: rodric rabbah <[email protected]>
if (disableStoreResultConfig) ActivationStoreLevel.STORE_FAILURES else ActivationStoreLevel.STORE_ALWAYS | ||
} | ||
} | ||
protected val storeNonBlockingResultLevelConfig = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this also be in the try and ignored/set to false if it fails?
this lgtm in general, just a question of how long you want to tolerate the deprecated flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can discuss a date to remove it since we're not really following consistent releases and I'll send an email announcing the plan to remove it.
I don't think it needs to be moved since the existing behavior is to fail if it doesn't exist which maybe was unnecessary originally and we don't need to keep it long
Description
This PR adds an additional config option to allow turning off writes to the db for successful non-blocking activations. Our use case does not have any need for writes for any activations in the success case anymore and this will greatly help us scale. We don't use sequential actions, have external logging, use events topic for activation metrics, and write data to a db for an activation off our consumers for the completed* topics where needed.
This is a follow up to #4881 where this was implemented but only allowed configuration for blocking activations.
Related issue and scope
My changes affect the following components
Types of changes
Checklist: