Skip to content

Commit 67c33f4

Browse files
authored
Merge pull request #413 from open-o11y/updatedoc
Update java doc to reflect relevant info
2 parents 270cd46 + 884e57c commit 67c33f4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/docs/getting-started/lambda/lambda-java-auto-instr.mdx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The AWS managed Lambda layer for ADOT Java Auto-instumentation Agent provides a
1515

1616
## Requirements
1717

18-
The Lambda layer supports the Java 11 (Corretto) Lambda runtime. It _does not_ support the Java 8 Lambda runtimes. For more information about supported Java versions, see the [OpenTelemetry Java documentation](https://github.com/open-telemetry/opentelemetry-java).
18+
The Lambda layer supports the Java 11 (Corretto) Lambda runtime. It _does not_ support the Java 8 Lambda runtimes. For more information about supported Java versions, see the [OpenTelemetry Java documentation](https://github.com/open-telemetry/opentelemetry-java#requirements).
1919

2020
Note: ADOT Lambda Layer for Java Auto-instrumentation Agent - Automatic instrumentation has a notable impact on startup time on AWS Lambda and you will generally need to use this along with provisioned concurrency and warmup requests to serve production requests without causing timeouts on initial requests while it initializes.
2121

@@ -49,21 +49,22 @@ For more on AWS X-Ray permissions for AWS Lambda, see the [AWS Lambda documentat
4949

5050
### Metric Instrumentation in your Lambda Function
5151

52-
**Note:** As of v1.6.0 of the OpenTelemetry Java Agent, metric exporting is disabled by default to preserve stability. To enable exporting metrics for use with backends like Amazon Managed Prometheus, set the environment variable `OTEL_METRICS_EXPORTER=otlp`.
53-
54-
Unlike traces, Metric auto instrumentation has not been supported in OpenTelemetry yet. You would have to manually instrument your code in your Lambda application in order to generate application metrics. We will be using the [OpenTelemetry Java Metrics API](https://github.com/open-telemetry/opentelemetry-java/tree/main/api/metrics/src/main/java/io/opentelemetry/api/metrics) to define our metrics. You can define your metric types in a MetricGenerator.java file.
52+
Metric auto instrumentation is supported in OpenTelemetry. You would have to instrument your code in your Lambda application in order to generate application metrics. We will be using the [OpenTelemetry Java Metrics API](https://github.com/open-telemetry/opentelemetry-java/tree/main/api/metrics/src/main/java/io/opentelemetry/api/metrics) to define our metrics. You can define your metric types in a MetricGenerator.java file. To enable exporting metrics for use with backends like Amazon Managed Prometheus, set the environment variable `OTEL_METRICS_EXPORTER=otlp`.
5553

5654
1. Import the OpenTelemetry Java Metrics API into your dependency file
5755
```
5856
dependencies {
59-
implementation platform("io.opentelemetry:opentelemetry-bom:1.6.0")
57+
implementation platform("io.opentelemetry:opentelemetry-bom:1.19.0")
6058
implementation('io.opentelemetry:opentelemetry-api')
6159
}
6260
```
6361
2. Create Metric instruments by using the OpenTelemetry Java Metrics API
6462
```
6563
// get meter
66-
Meter meter = GlobalMeterProvider.getMeter("aws-otel", "1.0");
64+
Meter meter = GlobalOpenTelemetry.getMeterProvider()
65+
.meterBuilder("aws-otel")
66+
.setInstrumentationVersion("1.0")
67+
.build();
6768
6869
// creating a Counter metric to count total API payload bytes sent
6970
LongUpDownCounter apiBytesSentCounter = meter
@@ -96,8 +97,6 @@ memoryObserver.observer(Runtime.getRuntime().totalMemory(), Attributes.empty());
9697
```
9798
4. The Lambda layer will take care of exporting the metrics to the Collector and then to AMP.
9899

99-
*Please note that the [OpenTelemetry Java Metrics API](https://github.com/open-telemetry/opentelemetry-java) is currently in alpha, there may be future breaking changes to the API.*
100-
101100
### Remove OpenTelemetry from your Lambda function
102101

103102
To disable OpenTelemetry for your Lambda function, remove the Lambda layer, remove the environment variable AWS_LAMBDA_EXEC_WRAPPER, and disable active tracing, as explained in the section above.
@@ -113,7 +112,7 @@ By default, the ADOT Lambda layer uses the [config.yaml](https://github.com/aws-
113112

114113
## Exporting Metrics to AMP
115114

116-
The layer is not configured by default to export Prometheus metrics to Amazon Managed Service for Prometheus (AMP) (https://docs.aws.amazon.com/prometheus/latest/userguide/what-is-Amazon-Managed-Service-Prometheus.html). To enable it:
115+
The layer is not configured by default to export Prometheus metrics, see Amazon Managed Service for Prometheus (AMP)(https://docs.aws.amazon.com/prometheus/latest/userguide/what-is-Amazon-Managed-Service-Prometheus.html). To enable it:
117116

118117
1. Upload a custom collector configuration file `collector.yaml` with your Lambda application, like the example shown below, with the `prometheusremotewriteexporter` and the `sigv4authextension` enabled. Set up the `endpoint` of your own AMP workspace, and `region` of the `sigv4authextension`.
119118
```

0 commit comments

Comments
 (0)