Commit 108bcb0
authored
*Description of changes:*
Java version of these PRs:
-
aws-observability/aws-otel-python-instrumentation#442
-
aws-observability/aws-otel-python-instrumentation#437
This PR introduces Console EMF exporter and Compact Console logs
exporter and enabling them for Lambda environments, allowing all forms
of telemetry to be emitted directly to CloudWatch for users who've
installed the Application Signals lambda layer.
To enable the Compact Console logs exporter, users must set the
following environment variables in their Lambda:
- `OTEL_LOGS_EXPORTER`: `console` **required**
To enable the Console EMF exporter, users must set the following
environment variables in their Lambda:
- `OTEL_METRICS_EXPORTER`: `awsemf` **required**
- `OTEL_EXPORTER_OTLP_LOGS_HEADERS`:
`x-aws-log-group=your-log-group,x-aws-log-stream=your-log-stream,x-aws-metric-namespace`
**optional**
Enabling the console exporters for EMF and logs will store the user's
OTel metrics and logs directly in their Lambda log group.
**Note 1:** if users would like to store their EMF logs to a separate
log group, they **MUST*** set this configuration
`OTEL_EXPORTER_OTLP_LOGS_HEADERS`:
`x-aws-log-group=your-log-group,x-aws-log-stream=your-log-stream`
**Note 2:** `x-aws-metric-namespace` will use `default` if it is not set
**Testing**:
- Added unit tests to validate EMF and console log record exporter
configuration scenarios, including parameterized tests for both valid
configurations and invalid configurations. The tests ensure the EMF and
console log exporters are correctly enabled only when all required
environment variables are properly configured.
Manual end to end testing with a custom built Lambda layer using the
sample app configured with the following environment variables in Lambda
environment:
<img width="763" height="235" alt="image"
src="https://github.com/user-attachments/assets/2098a0a1-ea81-4999-89d5-4759f0a7822d"
/>
EMF translated OTel metrics and OTel logs:
OTel log:
<img width="1579" height="593" alt="image"
src="https://github.com/user-attachments/assets/56451d44-d349-4cf3-9846-131057bd9e26"
/>
EMF log
<img width="1578" height="482" alt="image"
src="https://github.com/user-attachments/assets/91267f20-4928-4230-9b36-ace99b7a9eff"
/>
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
1 parent b60ba73 commit 108bcb0
File tree
9 files changed
+888
-54
lines changed- awsagentprovider/src
- main/java/software/amazon/opentelemetry/javaagent/providers
- exporter
- aws/logs
- otlp/aws/logs
- test/java/software/amazon/opentelemetry/javaagent/providers
- exporter
- aws/logs
- otlp/aws
- sample-apps/apigateway-lambda/src/main/java/com/amazon/sampleapp
9 files changed
+888
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
19 | 26 | | |
20 | | - | |
21 | | - | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
Lines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
| 96 | + | |
94 | 97 | | |
| 98 | + | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| |||
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
184 | 192 | | |
185 | 193 | | |
186 | 194 | | |
| |||
515 | 523 | | |
516 | 524 | | |
517 | 525 | | |
518 | | - | |
| 526 | + | |
519 | 527 | | |
520 | 528 | | |
521 | 529 | | |
| |||
528 | 536 | | |
529 | 537 | | |
530 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
531 | 546 | | |
532 | 547 | | |
533 | 548 | | |
534 | 549 | | |
535 | 550 | | |
536 | 551 | | |
| 552 | + | |
537 | 553 | | |
538 | 554 | | |
539 | 555 | | |
540 | 556 | | |
541 | 557 | | |
| 558 | + | |
542 | 559 | | |
543 | 560 | | |
544 | | - | |
545 | | - | |
546 | 561 | | |
547 | 562 | | |
548 | 563 | | |
549 | 564 | | |
550 | 565 | | |
551 | 566 | | |
552 | | - | |
| 567 | + | |
| 568 | + | |
553 | 569 | | |
554 | 570 | | |
555 | 571 | | |
556 | 572 | | |
557 | | - | |
558 | | - | |
| 573 | + | |
559 | 574 | | |
560 | 575 | | |
561 | 576 | | |
| |||
Lines changed: 277 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
0 commit comments