You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61-28Lines changed: 61 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
# AWS Lambda OpenTracing Java SDK
2
2
3
-
## Purpose
3
+
This SDK provides Open Tracing instrumentation for AWS Lambda. Releases for this project will be on an "as needed" basis. As new features of Lambda come out we will evaluate them and if useful will add support for them here.
4
4
5
-
Open Tracing instrumentation for AWS Lambda [RequestHandler](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/RequestHandler.java) and [RequestStreamHandler](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/RequestStreamHandler.java).
5
+
Versioning will have the following format: {majorVersion}.{minorVersion}.{pointVersion}
6
6
7
-
## How it Works
7
+
###How it Works
8
8
9
-
The SDK provides `TracingRequestHandler` and `TracingRequestStreamHandler` interfaces that extend AWS' Lambda request handlers. When a Lambda function that is using an implementation of either tracing request handler is invoked, the handler will obtain the globally registered OpenTracing [Tracer](https://opentracing.io/docs/overview/tracers/) and create/start an OpenTracing [Span](https://opentracing.io/docs/overview/spans/) to capture timing information and `key:value` pairs ([Tags/Logs](https://opentracing.io/docs/overview/tags-logs-baggage/)) detailing the trace data.
9
+
The SDK provides [`TracingRequestHandler`](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/RequestHandler.java) and [`TracingRequestStreamHandler`](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/RequestStreamHandler.java) interfaces that extend AWS' Lambda request handlers. When a Lambda function that is using an implementation of either tracing request handler is invoked, the handler will obtain the globally registered OpenTracing [Tracer](https://opentracing.io/docs/overview/tracers/) and create/start an OpenTracing [Span](https://opentracing.io/docs/overview/spans/) to capture timing information and `key:value` pairs ([Tags/Logs](https://opentracing.io/docs/overview/tags-logs-baggage/)) detailing the trace data.
10
10
11
11
As part of the implementation the user must override the tracing handler's `doHandleRequest` method which is called by the handler interface's `handleRequest` method.
12
12
13
-
## Collected Span Tags/Logs
13
+
###Collected Span Tags/Logs
14
14
15
-
Lambda attributes:
15
+
Below are a list of the collected Lambda attributes:
|`stack`|`Throwable` stacktrace | The the stack trace information of the throwable |
32
32
|`error.kind`|`String``"Exception"`| Indicates that the error was an `Exception`|
33
33
34
-
## How to Use
35
-
36
-
1. Add the `java-aws-lambda` dependency to your project.
37
-
-**Option A:**[Build the project from sources](#build-the-project) and [add the jar to your project as a Gradle dependency](#add-artifact-to-gradle-project)
38
-
-**Option B:** Add gradle or maven dependency to your project: [TODO N/A for Beta](https://mvnrepository.com)
39
-
2. Implement the `TracingRequestHandler` interface as shown in the [example](#example-usage), defining the Lambda function input and output types that your function requires.
40
-
3. Override the `doHandleRequest` method from the interface and execute your function logic within it. *Note:* If you are refactoring a pre-existing Lambda handler to take advantage of this SDK's tracing request handler make sure that it overrides `doHandleRequest` but not `handleRequest`.
41
-
4. Register the OpenTracing Tracer of your choice.
42
-
5. See Amazon's documentation on [creating a ZIP deployment package for a Java Lambda function](https://docs.aws.amazon.com/lambda/latest/dg/create-deployment-pkg-zip-java.html)
43
-
6. When creating your Lambda function in AWS Lambda console the handler for the given example would be entered as `com.handler.example.MyLambdaHandler::handleRequest` or just `com.handler.example.MyLambdaHandler`, the latter of which will use `handleRequest` as the handler method by default. *Note:*`handleRequest` is used as the handler entry point as it will call `doHandleRequest`.
1. Implement the `TracingRequestHandler` interface as shown in the [example](#example-usage), defining the Lambda function input and output types that your function requires.
53
+
2. Override the `doHandleRequest` method from the interface and execute your function logic within it. *Note:* If you are refactoring a pre-existing Lambda handler to take advantage of this SDK's tracing request handler make sure that it overrides `doHandleRequest` but not `handleRequest`.
54
+
3. Register the OpenTracing Tracer of your choice.
55
+
4. See Amazon's documentation on [creating a ZIP deployment package for a Java Lambda function](https://docs.aws.amazon.com/lambda/latest/dg/create-deployment-pkg-zip-java.html)
56
+
5. When creating your Lambda function in AWS Lambda console the handler for the given example would be entered as `com.handler.example.MyLambdaHandler::handleRequest` or just `com.handler.example.MyLambdaHandler`, the latter of which will use `handleRequest` as the handler method by default. *Note:*`handleRequest` is used as the handler entry point as it will call `doHandleRequest`.
60
57
61
-
## Example Usage
58
+
####Example Usage
62
59
63
60
```java
64
61
packagecom.handler.example;
@@ -97,3 +94,39 @@ public class MyLambdaHandler implements TracingRequestHandler<Map<String, Object
97
94
}
98
95
}
99
96
```
97
+
98
+
99
+
## Getting Started
100
+
101
+
### Requirements
102
+
103
+
* AWS Lambda instance
104
+
* Java 8
105
+
* Gradle
106
+
107
+
### Building
108
+
Run the following gradle task:
109
+
```
110
+
./gradlew java-aws-lambda:jar
111
+
```
112
+
113
+
This generates a jar artifact in the following subdirectory:
Full details are available in our CONTRIBUTING file;
126
+
127
+
We'd love to get your contributions to improve AWS Lambda OpenTracing Java SDK! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at open-source@newrelic.com.
128
+
129
+
### Licensing
130
+
The AWS Lambda OpenTracing Java SDK is licensed under the Apache 2.0 License.
131
+
132
+
The AWS Lambda OpenTracing Java SDK also uses source code from third party libraries. Full details on which libraries are used and the terms under which they are licensed can be found in the third party notices document.
0 commit comments