Skip to content

Commit 823620d

Browse files
committed
2.0.1 release commit
update CHANGELOG
1 parent 141290e commit 823620d

File tree

14 files changed

+64
-34
lines changed

14 files changed

+64
-34
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 2.0.1 - 2018-09-06
4+
### Changed
5+
- Fixed a bug that caused XRay sampling rules fetching to fail when AWS SDK instrumentor is included. [ISSUE25](https://github.com/aws/aws-xray-sdk-java/issues/25)
6+
37
## 2.0.0 - 2018-08-28
48
### Backwards incompatible change
59
- Default Sampling Strategy has been updated to Centralized Sampling Strategy which gets sampling rules from X-Ray backend instead of from a static JSON file. [More Information](https://docs.aws.amazon.com/xray/latest/devguide/xray-console-sampling.html)
@@ -28,7 +32,7 @@
2832

2933
## 1.2.2 - 2017-12-05
3034
### Changed
31-
- Fixed a bug a bug which caused certain non-sampled segments to be emitted to the X-Ray daemon. This issue occurred only when the segment began as sampled and was manually overridden to non-sampled using `setSampled(false)`.
35+
- Fixed a bug which caused certain non-sampled segments to be emitted to the X-Ray daemon. This issue occurred only when the segment began as sampled and was manually overridden to non-sampled using `setSampled(false)`.
3236

3337
## 1.2.1 - 2017-11-20
3438
### Changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,37 @@ Add the AWS X-Ray SDK dependencies to your pom.xml:
1414
<dependency>
1515
<groupId>com.amazonaws</groupId>
1616
<artifactId>aws-xray-recorder-sdk-core</artifactId>
17-
<version>2.0.0</version>
17+
<version>2.0.1</version>
1818
</dependency>
1919
<dependency>
2020
<groupId>com.amazonaws</groupId>
2121
<artifactId>aws-xray-recorder-sdk-apache-http</artifactId>
22-
<version>2.0.0</version>
22+
<version>2.0.1</version>
2323
</dependency>
2424
<dependency>
2525
<groupId>com.amazonaws</groupId>
2626
<artifactId>aws-xray-recorder-sdk-aws-sdk</artifactId>
27-
<version>2.0.0</version>
27+
<version>2.0.1</version>
2828
</dependency>
2929
<dependency>
3030
<groupId>com.amazonaws</groupId>
3131
<artifactId>aws-xray-recorder-sdk-aws-sdk-instrumentor</artifactId>
32-
<version>2.0.0</version>
32+
<version>2.0.1</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>com.amazonaws</groupId>
3636
<artifactId>aws-xray-recorder-sdk-sql-mysql</artifactId>
37-
<version>2.0.0</version>
37+
<version>2.0.1</version>
3838
</dependency>
3939
<dependency>
4040
<groupId>com.amazonaws</groupId>
4141
<artifactId>aws-xray-recorder-sdk-sql-postgresql</artifactId>
42-
<version>2.0.0</version>
42+
<version>2.0.1</version>
4343
</dependency>
4444
<dependency>
4545
<groupId>com.amazonaws</groupId>
4646
<artifactId>aws-xray-recorder-sdk-spring</artifactId>
47-
<version>2.0.0</version>
47+
<version>2.0.1</version>
4848
</dependency>
4949
```
5050

aws-xray-recorder-sdk-apache-http/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.amazonaws</groupId>
66
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
7-
<version>2.0.0</version>
7+
<version>2.0.1</version>
88
</parent>
99
<groupId>com.amazonaws</groupId>
1010
<artifactId>aws-xray-recorder-sdk-apache-http</artifactId>
11-
<version>2.0.0</version>
11+
<version>2.0.1</version>
1212
<name>AWS X-Ray Recorder SDK for Java - Apache HTTP Client Proxy</name>
1313
<build>
1414
<plugins>

aws-xray-recorder-sdk-aws-sdk-instrumentor/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.amazonaws</groupId>
66
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
7-
<version>2.0.0</version>
7+
<version>2.0.1</version>
88
</parent>
99
<groupId>com.amazonaws</groupId>
1010
<artifactId>aws-xray-recorder-sdk-aws-sdk-instrumentor</artifactId>
11-
<version>2.0.0</version>
11+
<version>2.0.1</version>
1212
<name>AWS X-Ray Recorder SDK for Java - AWS SDK Instrumentor</name>
1313
<build>
1414
<plugins>

aws-xray-recorder-sdk-aws-sdk/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.amazonaws</groupId>
66
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
7-
<version>2.0.0</version>
7+
<version>2.0.1</version>
88
</parent>
99
<groupId>com.amazonaws</groupId>
1010
<artifactId>aws-xray-recorder-sdk-aws-sdk</artifactId>
11-
<version>2.0.0</version>
11+
<version>2.0.1</version>
1212
<name>AWS X-Ray Recorder SDK for Java - AWS SDK Handler</name>
1313
<build>
1414
<plugins>

aws-xray-recorder-sdk-aws-sdk/src/main/java/com/amazonaws/xray/handlers/TracingHandler.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public class TracingHandler extends RequestHandler2 {
5858
private static final String S3_EXTENDED_REQUEST_ID_HEADER_KEY = "x-amz-id-2";
5959
private static final String CONTENT_LENGTH_HEADER_KEY = "Content-Length";
6060

61+
private static final String XRAY_SERVICE_NAME = "AWSXRay";
62+
private static final String XRAY_SAMPLING_RULE_REQUEST = "GetSamplingRules";
63+
private static final String XRAY_SAMPLING_TARGET_REQUEST = "GetSamplingTargets";
64+
6165
private static final String REQUEST_ID_SUBSEGMENT_KEY = "request_id";
6266
private static final String EXTENDED_REQUEST_ID_SUBSEGMENT_KEY = "id_2";
6367
private static final String CONTENT_LENGTH_SUBSEGMENT_KEY = "content_length";
@@ -138,7 +142,15 @@ public AmazonWebServiceRequest beforeExecution(AmazonWebServiceRequest request)
138142

139143
@Override
140144
public void beforeRequest(Request<?> request) {
141-
if(S3_SERVICE_NAME.equals(extractServiceName(request)) && S3_PRESIGN_REQUEST.equals(extractOperationName(request))) {
145+
String serviceName = extractServiceName(request);
146+
String operationName = extractOperationName(request);
147+
148+
if(S3_SERVICE_NAME.equals(serviceName) && S3_PRESIGN_REQUEST.equals(operationName)) {
149+
return;
150+
}
151+
152+
if(XRAY_SERVICE_NAME.equals(serviceName) && (XRAY_SAMPLING_RULE_REQUEST.equals(operationName)
153+
|| XRAY_SAMPLING_TARGET_REQUEST.equals(operationName))) {
142154
return;
143155
}
144156

@@ -149,12 +161,12 @@ public void beforeRequest(Request<?> request) {
149161
if (null != entityContext) {
150162
recorder.setTraceEntity(entityContext);
151163
}
152-
Subsegment currentSubsegment = recorder.beginSubsegment(extractServiceName(request));
164+
Subsegment currentSubsegment = recorder.beginSubsegment(serviceName);
153165
if (null == currentSubsegment) {
154166
return;
155167
}
156168
currentSubsegment.putAllAws(extractRequestParameters(request));
157-
currentSubsegment.putAws(OPERATION_SUBSEGMENT_KEY, extractOperationName(request));
169+
currentSubsegment.putAws(OPERATION_SUBSEGMENT_KEY, operationName);
158170
if (null != accountId) {
159171
currentSubsegment.putAws(ACCOUNT_ID_SUBSEGMENT_KEY, accountId);
160172
}

aws-xray-recorder-sdk-aws-sdk/src/test/java/com/amazonaws/xray/handlers/TracingHandlerTest.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import java.io.InputStream;
66
import java.nio.charset.StandardCharsets;
77

8+
import com.amazonaws.services.xray.AWSXRayClientBuilder;
9+
import com.amazonaws.services.xray.model.GetSamplingRulesRequest;
10+
import com.amazonaws.services.xray.model.GetSamplingTargetsRequest;
811
import org.apache.http.HttpResponse;
912
import org.apache.http.HttpVersion;
1013
import org.apache.http.client.methods.HttpUriRequest;
@@ -84,12 +87,9 @@ public void testLambdaInvokeSubsegmentContainsFunctionName() {
8487
InvokeRequest request = new InvokeRequest();
8588
request.setFunctionName("testFunctionName");
8689
InvokeResult r = lambda.invoke(request);
87-
System.out.println(r.getStatusCode());
88-
System.out.println(r);
8990

9091
Assert.assertEquals(1, segment.getSubsegments().size());
9192
Assert.assertEquals("Invoke", segment.getSubsegments().get(0).getAws().get("operation"));
92-
System.out.println(segment.getSubsegments().get(0).getAws());
9393
Assert.assertEquals("testFunctionName", segment.getSubsegments().get(0).getAws().get("function_name"));
9494
}
9595

@@ -105,7 +105,6 @@ public void testS3PutObjectSubsegmentContainsBucketName() {
105105
s3.putObject(BUCKET, KEY, "This is a test from java");
106106
Assert.assertEquals(1, segment.getSubsegments().size());
107107
Assert.assertEquals("PutObject", segment.getSubsegments().get(0).getAws().get("operation"));
108-
System.out.println(segment.getSubsegments().get(0).getAws());
109108
Assert.assertEquals(BUCKET, segment.getSubsegments().get(0).getAws().get("bucket_name"));
110109
Assert.assertEquals(KEY, segment.getSubsegments().get(0).getAws().get("key"));
111110
}
@@ -126,11 +125,26 @@ public void testS3CopyObjectSubsegmentContainsBucketName() {
126125
s3.copyObject(BUCKET, KEY, DST_BUCKET, DST_KEY);
127126
Assert.assertEquals(1, segment.getSubsegments().size());
128127
Assert.assertEquals("CopyObject", segment.getSubsegments().get(0).getAws().get("operation"));
129-
System.out.println(segment.getSubsegments().get(0).getAws());
130128
Assert.assertEquals(BUCKET, segment.getSubsegments().get(0).getAws().get("source_bucket_name"));
131129
Assert.assertEquals(KEY, segment.getSubsegments().get(0).getAws().get("source_key"));
132130
Assert.assertEquals(DST_BUCKET, segment.getSubsegments().get(0).getAws().get("destination_bucket_name"));
133131
Assert.assertEquals(DST_KEY, segment.getSubsegments().get(0).getAws().get("destination_key"));
134132
}
135133

134+
@Test
135+
public void testShouldNotTraceXRaySamplingOperations() {
136+
com.amazonaws.services.xray.AWSXRay xray = AWSXRayClientBuilder.standard()
137+
.withRequestHandlers(new TracingHandler()).withRegion(Regions.US_EAST_1)
138+
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("fake", "fake")))
139+
.build();
140+
mockHttpClient(xray, null);
141+
142+
Segment segment = AWSXRay.beginSegment("test");
143+
xray.getSamplingRules(new GetSamplingRulesRequest());
144+
Assert.assertEquals(0, segment.getSubsegments().size());
145+
146+
xray.getSamplingTargets(new GetSamplingTargetsRequest());
147+
Assert.assertEquals(0, segment.getSubsegments().size());
148+
}
149+
136150
}

aws-xray-recorder-sdk-bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.amazonaws</groupId>
66
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
7-
<version>2.0.0</version>
7+
<version>2.0.1</version>
88
</parent>
99
<groupId>com.amazonaws</groupId>
1010
<artifactId>aws-xray-recorder-sdk-bom</artifactId>

aws-xray-recorder-sdk-core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<parent>
55
<groupId>com.amazonaws</groupId>
66
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
7-
<version>2.0.0</version>
7+
<version>2.0.1</version>
88
</parent>
99
<groupId>com.amazonaws</groupId>
1010
<artifactId>aws-xray-recorder-sdk-core</artifactId>
1111
<name>AWS X-Ray Recorder SDK for Java - Core</name>
12-
<version>2.0.0</version>
12+
<version>2.0.1</version>
1313
<build>
1414
<plugins>
1515
<plugin>

aws-xray-recorder-sdk-spring/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.amazonaws</groupId>
77
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
8-
<version>2.0.0</version>
8+
<version>2.0.1</version>
99
</parent>
1010

1111
<artifactId>aws-xray-recorder-sdk-spring</artifactId>

0 commit comments

Comments
 (0)