-
Notifications
You must be signed in to change notification settings - Fork 98
feat: Support CRaC priming for powertools-tracing #2121
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
Changes from 14 commits
eea14d7
9fb3739
786a16a
fdbb6db
136a3fa
ea2d50c
71d2247
bd2db02
0167d2b
f42d4a9
10f4890
711ada7
99b7422
d8f89ad
e2865e3
e2d934f
0959c63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this change is the same you're proposing in a different PR (#2124), please revert this and make sure to keep PRs focused and scoped to the change at hand. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
java.lang.Object | ||
java.io.Serializable | ||
java.lang.Comparable | ||
java.lang.CharSequence | ||
java.lang.String | ||
java.lang.Class | ||
java.lang.Cloneable | ||
java.lang.ClassLoader | ||
java.lang.System | ||
java.lang.Throwable | ||
java.lang.Error | ||
java.lang.Exception | ||
java.lang.RuntimeException | ||
com.amazonaws.xray.AWSXRay | ||
com.amazonaws.xray.entities.Entity | ||
com.amazonaws.xray.entities.Subsegment | ||
com.amazonaws.xray.entities.Segment | ||
com.amazonaws.xray.entities.TraceID | ||
com.amazonaws.xray.entities.TraceHeader | ||
com.amazonaws.xray.strategy.sampling.SamplingStrategy | ||
com.amazonaws.xray.strategy.sampling.LocalizedSamplingStrategy | ||
com.amazonaws.xray.strategy.sampling.NoSamplingStrategy | ||
com.amazonaws.xray.strategy.sampling.AllSamplingStrategy | ||
com.amazonaws.xray.strategy.sampling.CentralizedSamplingStrategy | ||
com.amazonaws.xray.strategy.ContextMissingStrategy | ||
com.amazonaws.xray.strategy.LogErrorContextMissingStrategy | ||
com.amazonaws.xray.strategy.RuntimeErrorContextMissingStrategy | ||
com.amazonaws.xray.strategy.IgnoreErrorContextMissingStrategy | ||
com.amazonaws.xray.contexts.LambdaSegmentContext | ||
com.amazonaws.xray.contexts.SegmentContext | ||
com.amazonaws.xray.contexts.ThreadLocalSegmentContext | ||
com.amazonaws.xray.emitters.Emitter | ||
com.amazonaws.xray.emitters.UDPEmitter | ||
com.amazonaws.xray.listeners.SegmentListener | ||
com.amazonaws.xray.plugins.Plugin | ||
com.amazonaws.xray.plugins.ECSPlugin | ||
com.amazonaws.xray.plugins.EC2Plugin | ||
com.amazonaws.xray.plugins.EKSPlugin | ||
software.amazon.lambda.powertools.tracing.TracingUtils | ||
software.amazon.lambda.powertools.tracing.Tracing | ||
software.amazon.lambda.powertools.tracing.CaptureMode | ||
software.amazon.lambda.powertools.tracing.internal.LambdaTracingAspect | ||
software.amazon.lambda.powertools.common.internal.LambdaHandlerProcessor | ||
software.amazon.lambda.powertools.common.internal.LambdaConstants | ||
com.fasterxml.jackson.databind.ObjectMapper | ||
com.fasterxml.jackson.databind.JsonNode | ||
com.fasterxml.jackson.databind.node.ObjectNode | ||
com.fasterxml.jackson.databind.node.ArrayNode | ||
com.fasterxml.jackson.databind.node.TextNode | ||
com.fasterxml.jackson.databind.node.NumericNode | ||
com.fasterxml.jackson.databind.node.BooleanNode | ||
com.fasterxml.jackson.databind.node.NullNode | ||
com.fasterxml.jackson.core.JsonFactory | ||
com.fasterxml.jackson.core.JsonGenerator | ||
com.fasterxml.jackson.core.JsonParser | ||
com.fasterxml.jackson.core.JsonToken | ||
com.fasterxml.jackson.databind.DeserializationFeature | ||
com.fasterxml.jackson.databind.SerializationFeature | ||
com.fasterxml.jackson.databind.MapperFeature | ||
com.fasterxml.jackson.databind.JsonSerializer | ||
com.fasterxml.jackson.databind.JsonDeserializer | ||
com.fasterxml.jackson.databind.SerializerProvider | ||
com.fasterxml.jackson.databind.DeserializationContext | ||
org.slf4j.Logger | ||
org.slf4j.LoggerFactory | ||
org.slf4j.MDC |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2023 Amazon.com, Inc. or its affiliates. | ||
* Licensed under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
dreamorosi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
package software.amazon.lambda.powertools.tracing; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatNoException; | ||
import static org.mockito.Mockito.mock; | ||
|
||
import java.lang.reflect.Field; | ||
import org.crac.Context; | ||
import org.crac.Resource; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class TracingUtilsCracTest { | ||
|
||
Context<Resource> context = mock(Context.class); | ||
|
||
@Test | ||
void testPrimeMethodDoesNotThrowException() { | ||
assertThatNoException().isThrownBy(() -> TracingUtils.prime()); | ||
} | ||
|
||
@Test | ||
void testTracingUtilsLoadsSuccessfully() { | ||
// Simply calling TracingUtils.prime() should trigger CRaC registration | ||
assertThatNoException().isThrownBy(() -> TracingUtils.prime()); | ||
|
||
// Verify that TracingUtils class is loaded and accessible | ||
assertThatNoException().isThrownBy(() -> TracingUtils.objectMapper()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,8 +193,16 @@ | |
</Match> | ||
<Match> | ||
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> | ||
<Class name="software.amazon.lambda.powertools.validation.ValidationConfig"/> | ||
<Method name="beforeCheckpoint"/> | ||
<Or> | ||
<And> | ||
<Class name="software.amazon.lambda.powertools.validation.ValidationConfig"/> | ||
<Method name="beforeCheckpoint"/> | ||
</And> | ||
<And> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this being excluded from the spotbugs configuration? |
||
<Class name="software.amazon.lambda.powertools.tracing.TracingUtils"/> | ||
<Method name="beforeCheckpoint"/> | ||
</And> | ||
</Or> | ||
</Match> | ||
<!--Functionally needed--> | ||
<Match> | ||
|
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.
Please revert this, we shouldn't be making SonarCloud rules more lax just to make the CI green, especially without a proper justification in the PR discussion.
If this is valid and absolutely necessary, then please share your thought process.