Commit 0b73bff
authored
[OTEL] Vendoring OtlpGrpcExportClient And Enabling OTLP Metrics gRPC Tests (#7666)
## Summary of changes
Added gRPC protocol support to the OTLP metrics exporter by vendoring
OpenTelemetry's gRPC transport client. The implementation now supports
`grpc` which also was updated to be the default protocol value.
## Reason for change
Customers need gRPC support for OTLP metrics export to maintain
compatibility with OpenTelemetry ecosystem standards and their existing
infrastructure that may require or prefer gRPC transport.
## Implementation details
**Vendored dependencies:**
- Vendored `OpenTelemetry.Exporter.OpenTelemetryProtocol`
v1.13.1(lastest ATM with included fixes) gRPC transport client
(`OtlpGrpcExportClient` and related helpers)
- Created `OpenTelemetryStubs.cs` with minimal stub implementations to
avoid vendoring the entire OpenTelemetry SDK:
- `Guard` and `UriExtensions` from `OpenTelemetry.Internal` (Would need
to discard deletion after usng vendoring command)
- `OtlpExporterOptions` (minimal configuration class)
- `OtlpExportProtocol` enum (kept in stub due to namespace issues with
the original being in parent namespace `OpenTelemetry.Exporter`)
- `OpenTelemetryProtocolExporterEventSource` (stub EventSource for
logging)
**Core changes:**
- Updated `OtlpExporter.cs` to instantiate and use the vendored
`OtlpGrpcExportClient` when protocol is `Grpc`
- Added 5-byte gRPC message frame prefix (compression flag + message
length) to protobuf payloads for gRPC transport
- Modified `OtlpMetricsSerializer.cs` to optionally reserve bytes at the
start of the buffer for the gRPC frame header
**Vendoring infrastructure:**
- Added `AddOpenTelemetryUsings` transform to inject common `using`
directives needed by vendored OTel files
- Configured exclusions to vendor only the gRPC transport client, not
the full OTLP exporter
## Test coverage
- Updated `OpenTelemetrySdkTests.SubmitsOtlpMetrics` to test both
`http/protobuf` and `grpc` protocols
- gRPC tests use the `dd-apm-test-agent` container
- All tests validate metrics are correctly exported and received by the
respective agents
## DLL File Size Difference
After building both `master` branch and this branch locally then
comparing file size I got:
|Target Framework | Master (bytes) | Feature (bytes) | Difference
(bytes) | Difference (%) | Impact |
|------------------|----------------|-----------------|-------------------|----------------|--------|
| net6.0 | 8,252,416 | 8,270,336 | **+17,920** | +0.22% | +17.5 KB |
| netcoreapp3.1 | 8,173,056 | 8,190,976 | **+17,920** | +0.22% | +17.5
KB |
## Other Details
[APMAPI-1679](https://datadoghq.atlassian.net/browse/APMAPI-1679)
[APMAPI-1679]:
https://datadoghq.atlassian.net/browse/APMAPI-1679?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ1 parent abe7838 commit 0b73bff
File tree
29 files changed
+1795
-44
lines changed- tracer
- build/_build/UpdateVendors
- dependabot
- src
- Datadog.Trace.Trimming/build
- Datadog.Trace
- Configuration
- OpenTelemetry
- Metrics
- Stubs
- Vendors/OpenTelemetry.Exporter.OpenTelemetryProtocol
- Implementation/ExportClient
- Grpc
- test
- Datadog.Trace.ClrProfiler.IntegrationTests
- Datadog.Trace.Tests/Configuration
29 files changed
+1795
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
| 448 | + | |
448 | 449 | | |
449 | 450 | | |
450 | 451 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 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 | + | |
156 | 202 | | |
157 | 203 | | |
158 | 204 | | |
| |||
398 | 444 | | |
399 | 445 | | |
400 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
401 | 473 | | |
402 | 474 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 31 | + | |
| 32 | + | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
| |||
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 46 | | |
52 | 47 | | |
53 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
369 | 371 | | |
370 | 372 | | |
| 373 | + | |
371 | 374 | | |
372 | 375 | | |
373 | 376 | | |
| |||
379 | 382 | | |
380 | 383 | | |
381 | 384 | | |
| 385 | + | |
382 | 386 | | |
383 | 387 | | |
384 | 388 | | |
| |||
645 | 649 | | |
646 | 650 | | |
647 | 651 | | |
| 652 | + | |
648 | 653 | | |
649 | 654 | | |
650 | 655 | | |
| |||
911 | 916 | | |
912 | 917 | | |
913 | 918 | | |
| 919 | + | |
914 | 920 | | |
915 | 921 | | |
916 | 922 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | 211 | | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| |||
1279 | 1279 | | |
1280 | 1280 | | |
1281 | 1281 | | |
1282 | | - | |
| 1282 | + | |
1283 | 1283 | | |
1284 | 1284 | | |
1285 | 1285 | | |
| |||
0 commit comments