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
[SPARK] introduce circuit breaker #2407
Conversation
f74e9c8
to
73cc67b
Compare
73cc67b
to
1a19ca5
Compare
1850b8c
to
3030482
Compare
0135cde
to
70dff95
Compare
70dff95
to
4ce044f
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.
Thanks @pawel-big-lebowski for the awesome work! I have a few comments.
More complex version of circuit breaker. The amount of free memory can be low as long as | ||
amount of time spent on Garbage Collection is acceptable. `JavaRuntimeCircuitBreaker` closes | ||
when free memory drops below threshold and amount of time spent on garbage collection exceeds | ||
given threshold (`10%` by default). The circuit breaker is always open when checked for the first time |
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.
In general: I don't think we should have defaults here. If user hasn't configured any threshold, it should mean that we don't take this particular factor into account.
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.
It's based on this circuit breaker https://docs.newrelic.com/docs/apm/agents/java-agent/custom-instrumentation/circuit-breaker-java-custom-instrumentation/ which has the same default values.
I think it makes sense for people to turn something on and experiment with values later when needed.
|
||
boolean isClosed(); | ||
|
||
default boolean isOpen() { |
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.
isOpen
and isClosed
could provide additional information about reason
of it being closed or open.
I think returning something some object that has both the boolean and the reason would be nice.
client/java/src/main/java/io/openlineage/client/circuitBreaker/CircuitBreakerResolver.java
Outdated
Show resolved
Hide resolved
import java.util.stream.Collectors; | ||
import lombok.NonNull; | ||
|
||
public class TestCircuitBreaker extends CommonCircuitBreaker { |
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.
Why not have TestCircuitBreaker
in tests?
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 use this for integration tests within Spark and Flink integration, so the class shall be part of a openlineage-java jar. I can rename it into StaticCircuitCreaker
, because it closes/opens based on list of boolean values true, false,true
provided.
} else if (value instanceof TestCircuitBreaker) { | ||
return CIRCUIT_BREAKER_TYPE_TEST; | ||
} | ||
throw new UnsupportedOperationException("Unsupported circuit breaker " + value); |
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.
Why can't we define custom CircuitBreaker
similar to Transport
?
If we want to allow that later but not do this in this PR then I'd document that
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 don't like the ServiceLoader approach that we use for Transport. I agree the code with if/else
chain has some code smell. I will introduce config builders as we have for transport. Custom circuit breaker is outside the scope of this PR.
client/java/src/main/java/io/openlineage/client/circuitBreaker/CommonCircuitBreaker.java
Outdated
Show resolved
Hide resolved
client/java/src/main/java/io/openlineage/client/circuitBreaker/CommonCircuitBreaker.java
Outdated
Show resolved
Hide resolved
client/java/src/main/java/io/openlineage/client/circuitBreaker/JavaRuntimeCircuitBreaker.java
Show resolved
Hide resolved
try { | ||
return callable.call(); | ||
} catch (Exception e) { | ||
log.error("OpenLineage callable failed to execute. Swallowing the exception {}", e); |
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.
Swallowing the exception is not exactly no-op, do we really want that?
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 can happen in case of some uncaught exception of OL integration. This should not happen, but if this is happens we should catch it. I think we want this.
fd2200d
to
1668468
Compare
1668468
to
75f8a32
Compare
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
75f8a32
to
a1ecfed
Compare
* [SPARK][FLINK] introduce circuit breaker Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com> * [SPARK] daemon circuit breaker Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com> * [SPARK] pmd fix for java client Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com> --------- Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
Problem
Add mechanism to prevent from over-instrumentation which turns off Openlineage integration if specified criteria are met.
Closes: #1255
Solution
java-client
,If you're contributing a new integration, please specify the scope of the integration and how/where it has been tested (e.g., Apache Spark integration supports
S3
andGCS
filesystem operations, tested with AWS EMR).One-line summary:
Checklist
SPDX-License-Identifier: Apache-2.0
Copyright 2018-2023 contributors to the OpenLineage project