Skip to content

Commit a7d51ca

Browse files
committed
Addressing comments from PR #29
- Corrected a bad refactoring referencing `isColdStart` - Added Copyright headers.
1 parent b6259b8 commit a7d51ca

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

src/main/java/com/newrelic/opentracing/aws/EnhancedSpanBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright 2019 New Relic Corporation. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package com.newrelic.opentracing.aws;
27

38
import io.opentracing.Span;

src/main/java/com/newrelic/opentracing/aws/SpanUtil.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,25 @@
1313
import java.util.Collections;
1414
import java.util.HashMap;
1515
import java.util.Map;
16+
import java.util.concurrent.atomic.AtomicBoolean;
1617

1718
public class SpanUtil {
1819

1920
private SpanUtil() {}
2021

2122
static <Input> Span buildSpan(
22-
Input input, Context context, Tracer tracer, SpanContext spanContext) {
23+
Input input,
24+
Context context,
25+
Tracer tracer,
26+
SpanContext spanContext,
27+
AtomicBoolean isColdStart) {
2328
return EnhancedSpanBuilder.basedOn(tracer, "handleRequest")
2429
.asChildOf(spanContext)
2530
.withTag("aws.requestId", context.getAwsRequestId())
2631
.withTag("aws.lambda.arn", context.getInvokedFunctionArn())
2732
.optionallyWithTag(
2833
"aws.lambda.eventSource.arn", EventSourceParser.parseEventSourceArn(input))
29-
.optionallyWithTag(
30-
"aws.lambda.coldStart", TracingRequestHandler.isColdStart.getAndSet(false))
34+
.optionallyWithTag("aws.lambda.coldStart", isColdStart.getAndSet(false))
3135
.start();
3236
}
3337

src/main/java/com/newrelic/opentracing/aws/TracingRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ default Output handleRequest(Input input, Context context) {
4343
final Tracer tracer = GlobalTracer.get();
4444
final SpanContext spanContext = extractContext(tracer, input);
4545

46-
Span span = SpanUtil.buildSpan(input, context, tracer, spanContext);
46+
Span span = SpanUtil.buildSpan(input, context, tracer, spanContext, isColdStart);
4747
try (Scope scope = tracer.activateSpan(span)) {
4848
try {
4949
Output output = doHandleRequest(input, context);

src/main/java/com/newrelic/opentracing/aws/TracingRequestStreamHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ default void handleRequest(InputStream input, OutputStream output, Context conte
4242
final Tracer tracer = GlobalTracer.get();
4343
final SpanContext spanContext = extractContext(tracer, input);
4444

45-
Span span = SpanUtil.buildSpan(input, context, tracer, spanContext);
45+
Span span = SpanUtil.buildSpan(input, context, tracer, spanContext, isColdStart);
4646
try (Scope scope = tracer.activateSpan(span)) {
4747
try {
4848
doHandleRequest(input, output, context);

src/test/java/com/newrelic/opentracing/aws/EnhancedSpanBuilderTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright 2019 New Relic Corporation. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package com.newrelic.opentracing.aws;
27

38
import static io.opentracing.propagation.Format.Builtin.TEXT_MAP;

0 commit comments

Comments
 (0)