Skip to content

Commit

Permalink
2.0.1 release commit
Browse files Browse the repository at this point in the history
update CHANGELOG
  • Loading branch information
haotianw465 committed Sep 6, 2018
1 parent 141290e commit 823620d
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 34 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 2.0.1 - 2018-09-06
### Changed
- 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)

## 2.0.0 - 2018-08-28
### Backwards incompatible change
- 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)
Expand Down Expand Up @@ -28,7 +32,7 @@

## 1.2.2 - 2017-12-05
### Changed
- 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)`.
- 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)`.

## 1.2.1 - 2017-11-20
### Changed
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@ Add the AWS X-Ray SDK dependencies to your pom.xml:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-core</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-apache-http</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-aws-sdk</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-aws-sdk-instrumentor</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-sql-mysql</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-sql-postgresql</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-spring</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions aws-xray-recorder-sdk-apache-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-apache-http</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<name>AWS X-Ray Recorder SDK for Java - Apache HTTP Client Proxy</name>
<build>
<plugins>
Expand Down
4 changes: 2 additions & 2 deletions aws-xray-recorder-sdk-aws-sdk-instrumentor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-aws-sdk-instrumentor</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<name>AWS X-Ray Recorder SDK for Java - AWS SDK Instrumentor</name>
<build>
<plugins>
Expand Down
4 changes: 2 additions & 2 deletions aws-xray-recorder-sdk-aws-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-aws-sdk</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<name>AWS X-Ray Recorder SDK for Java - AWS SDK Handler</name>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public class TracingHandler extends RequestHandler2 {
private static final String S3_EXTENDED_REQUEST_ID_HEADER_KEY = "x-amz-id-2";
private static final String CONTENT_LENGTH_HEADER_KEY = "Content-Length";

private static final String XRAY_SERVICE_NAME = "AWSXRay";
private static final String XRAY_SAMPLING_RULE_REQUEST = "GetSamplingRules";
private static final String XRAY_SAMPLING_TARGET_REQUEST = "GetSamplingTargets";

private static final String REQUEST_ID_SUBSEGMENT_KEY = "request_id";
private static final String EXTENDED_REQUEST_ID_SUBSEGMENT_KEY = "id_2";
private static final String CONTENT_LENGTH_SUBSEGMENT_KEY = "content_length";
Expand Down Expand Up @@ -138,7 +142,15 @@ public AmazonWebServiceRequest beforeExecution(AmazonWebServiceRequest request)

@Override
public void beforeRequest(Request<?> request) {
if(S3_SERVICE_NAME.equals(extractServiceName(request)) && S3_PRESIGN_REQUEST.equals(extractOperationName(request))) {
String serviceName = extractServiceName(request);
String operationName = extractOperationName(request);

if(S3_SERVICE_NAME.equals(serviceName) && S3_PRESIGN_REQUEST.equals(operationName)) {
return;
}

if(XRAY_SERVICE_NAME.equals(serviceName) && (XRAY_SAMPLING_RULE_REQUEST.equals(operationName)
|| XRAY_SAMPLING_TARGET_REQUEST.equals(operationName))) {
return;
}

Expand All @@ -149,12 +161,12 @@ public void beforeRequest(Request<?> request) {
if (null != entityContext) {
recorder.setTraceEntity(entityContext);
}
Subsegment currentSubsegment = recorder.beginSubsegment(extractServiceName(request));
Subsegment currentSubsegment = recorder.beginSubsegment(serviceName);
if (null == currentSubsegment) {
return;
}
currentSubsegment.putAllAws(extractRequestParameters(request));
currentSubsegment.putAws(OPERATION_SUBSEGMENT_KEY, extractOperationName(request));
currentSubsegment.putAws(OPERATION_SUBSEGMENT_KEY, operationName);
if (null != accountId) {
currentSubsegment.putAws(ACCOUNT_ID_SUBSEGMENT_KEY, accountId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

import com.amazonaws.services.xray.AWSXRayClientBuilder;
import com.amazonaws.services.xray.model.GetSamplingRulesRequest;
import com.amazonaws.services.xray.model.GetSamplingTargetsRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.methods.HttpUriRequest;
Expand Down Expand Up @@ -84,12 +87,9 @@ public void testLambdaInvokeSubsegmentContainsFunctionName() {
InvokeRequest request = new InvokeRequest();
request.setFunctionName("testFunctionName");
InvokeResult r = lambda.invoke(request);
System.out.println(r.getStatusCode());
System.out.println(r);

Assert.assertEquals(1, segment.getSubsegments().size());
Assert.assertEquals("Invoke", segment.getSubsegments().get(0).getAws().get("operation"));
System.out.println(segment.getSubsegments().get(0).getAws());
Assert.assertEquals("testFunctionName", segment.getSubsegments().get(0).getAws().get("function_name"));
}

Expand All @@ -105,7 +105,6 @@ public void testS3PutObjectSubsegmentContainsBucketName() {
s3.putObject(BUCKET, KEY, "This is a test from java");
Assert.assertEquals(1, segment.getSubsegments().size());
Assert.assertEquals("PutObject", segment.getSubsegments().get(0).getAws().get("operation"));
System.out.println(segment.getSubsegments().get(0).getAws());
Assert.assertEquals(BUCKET, segment.getSubsegments().get(0).getAws().get("bucket_name"));
Assert.assertEquals(KEY, segment.getSubsegments().get(0).getAws().get("key"));
}
Expand All @@ -126,11 +125,26 @@ public void testS3CopyObjectSubsegmentContainsBucketName() {
s3.copyObject(BUCKET, KEY, DST_BUCKET, DST_KEY);
Assert.assertEquals(1, segment.getSubsegments().size());
Assert.assertEquals("CopyObject", segment.getSubsegments().get(0).getAws().get("operation"));
System.out.println(segment.getSubsegments().get(0).getAws());
Assert.assertEquals(BUCKET, segment.getSubsegments().get(0).getAws().get("source_bucket_name"));
Assert.assertEquals(KEY, segment.getSubsegments().get(0).getAws().get("source_key"));
Assert.assertEquals(DST_BUCKET, segment.getSubsegments().get(0).getAws().get("destination_bucket_name"));
Assert.assertEquals(DST_KEY, segment.getSubsegments().get(0).getAws().get("destination_key"));
}

@Test
public void testShouldNotTraceXRaySamplingOperations() {
com.amazonaws.services.xray.AWSXRay xray = AWSXRayClientBuilder.standard()
.withRequestHandlers(new TracingHandler()).withRegion(Regions.US_EAST_1)
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("fake", "fake")))
.build();
mockHttpClient(xray, null);

Segment segment = AWSXRay.beginSegment("test");
xray.getSamplingRules(new GetSamplingRulesRequest());
Assert.assertEquals(0, segment.getSubsegments().size());

xray.getSamplingTargets(new GetSamplingTargetsRequest());
Assert.assertEquals(0, segment.getSubsegments().size());
}

}
2 changes: 1 addition & 1 deletion aws-xray-recorder-sdk-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-bom</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions aws-xray-recorder-sdk-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-core</artifactId>
<name>AWS X-Ray Recorder SDK for Java - Core</name>
<version>2.0.0</version>
<version>2.0.1</version>
<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion aws-xray-recorder-sdk-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>

<artifactId>aws-xray-recorder-sdk-spring</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions aws-xray-recorder-sdk-sql-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-sql-mysql</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<name>AWS X-Ray Recorder SDK for Java - AWS SDK MySQL Interceptor</name>
<build>
<plugins>
Expand Down
4 changes: 2 additions & 2 deletions aws-xray-recorder-sdk-sql-postgres/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-sql-postgres</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<name>AWS X-Ray Recorder SDK for Java - AWS SDK PostgreSQL Interceptor</name>
<build>
<plugins>
Expand Down
4 changes: 2 additions & 2 deletions aws-xray-recorder-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-bom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-pom</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<packaging>pom</packaging>
<name>AWS X-Ray Recorder SDK for Java</name>
<description>The Amazon Web Services X-Ray Recorder SDK for Java provides Java APIs for emitting tracing data to AWS X-Ray. AWS X-Ray helps developers analyze and debug distributed applications. With X-Ray, you can understand how your application and its underlying services are performing to identify and troubleshoot the root cause of performance issues and errors.</description>
Expand Down Expand Up @@ -46,7 +46,7 @@
</repository>
</distributionManagement>
<properties>
<awsxrayrecordersdk.version>2.0.0</awsxrayrecordersdk.version>
<awsxrayrecordersdk.version>2.0.1</awsxrayrecordersdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
Expand Down

0 comments on commit 823620d

Please sign in to comment.