Skip to content

Commit 9eecee6

Browse files
docs: Add documentation for dotnet instrumentation of lambda functions
1 parent 2e6694d commit 9eecee6

File tree

2 files changed

+122
-0
lines changed
  • docs/apm/traces/get-started-transaction-tracing

2 files changed

+122
-0
lines changed

docs/apm/traces/get-started-transaction-tracing/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ Learn how to install and configure OpenTelemetry distributed tracing for AWS Lam
118118
<img src='https://upload.wikimedia.org/wikipedia/commons/c/c3/Python-logo-notext.svg' alt="Thumbnail icon" width="50"/>
119119
<h4><a href="/docs/apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/aws-lambda/python">Python</a></h4>
120120
</div>
121+
<div className="box smallbox card">
122+
<div className="container">
123+
<img src='https://upload.wikimedia.org/wikipedia/commons/c/c3/Python-logo-notext.svg' alt="Thumbnail icon" width="50"/>
124+
<h4><a href="/docs/apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/aws-lambda/dotnet">Dotnet</a></h4>
125+
</div>
126+
</div>
121127
</div>
122128
</div>
123129

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
id: dotnet
3+
title: AWS Lambda - .NET Function Instrumentation
4+
sidebar_label: .NET
5+
description: Learn how to install and configure OpenTelemetry distributed tracing for AWS .NET-based Lambda functions and send data to Sumo Logic.
6+
---
7+
8+
import useBaseUrl from '@docusaurus/useBaseUrl';
9+
import ApmTrace from '../../../../../reuse/apm-traces-layer-order.md';
10+
11+
This document covers how to install and configure OpenTelemetry distributed tracing for AWS Lambda functions based on .NET and send the data to Sumo Logic.
12+
13+
To obtain tracing data from AWS Lambda functions developed in .NET, you can use the following components
14+
15+
### Provided SDK
16+
17+
[OpenTelemetry Lambda SDK for .NET](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.AWSLambda) includes tracing APIs to instrument Lambda handlers and is provided on [NuGet](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.AWSLambda).
18+
19+
### OpenTelemetry Lambda layer
20+
21+
[OpenTelemetry Lambda Layer for Collector](https://github.com/open-telemetry/opentelemetry-lambda/tree/main/collector#opentelemetry-collector-aws-lambda-extension-layer) includes OpenTelemetry Collector for Lambda components. Apply this layer to your Lambda handler that's already been instrumented with the OpenTelemetry Lambda .NET SDK to enable end-to-end tracing.
22+
23+
#### .NET Lambda layer supports
24+
25+
* .NET 6 SDK or later
26+
* x86_64 and arm64 architectures
27+
28+
### Lambda function requirements
29+
30+
You'll need the following:
31+
32+
* .NET 6 SDK or later
33+
* Lambda layers add permissions
34+
* Sumo Logic OTLP/HTTP Source endpoint URL - To send spans from the instrumented Lambda function to Sumo Logic you need an endpoint URL from an existing or new [OTLP/HTTP source](/docs/send-data/hosted-collectors/http-source/otlp).
35+
36+
```text
37+
┌─────────────────────┐ OTLP ┌──────────────────────┐ HTTP ┌─────────────┐
38+
│ .NET Lambda │ ────────► │ Collector Layer │ ────────► │ Sumo Logic │
39+
│ Function │ (default) │ (Lambda Extension) │ (protobuf) │ OTLP Endpoint│
40+
│ (Function.cs) │ │ localhost:4318 │ │ │
41+
└─────────────────────┘ └──────────────────────┘ └─────────────┘
42+
```
43+
44+
## Quick Start
45+
46+
### Prerequisites
47+
48+
* AWS CLI configured with appropriate permissions
49+
* Configure the [AWS credential](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html)
50+
* .NET 6 SDK
51+
* Sumo Logic OTLP endpoint URL
52+
53+
### Build your OpenTelemetry Collector Lambda layer
54+
55+
At the moment users have to build Collector Lambda layer by themselves, we will provide sharing Lambda layer in the future.
56+
57+
* Download a local copy of the [opentelemetry-lambda repository from Github](https://github.com/open-telemetry/opentelemetry-lambda).
58+
59+
* Configure the collector layer to send data to SumoLogic:
60+
61+
```yaml
62+
receivers:
63+
otlp:
64+
protocols:
65+
grpc:
66+
endpoint: localhost:4317
67+
http:
68+
endpoint: localhost:4318
69+
70+
exporters:
71+
otlphttp:
72+
endpoint: ${SUMO_LOGIC_OTLP_ENDPOINT}
73+
headers:
74+
Content-Type: application/x-protobuf
75+
encoding: proto
76+
77+
service:
78+
pipelines:
79+
traces:
80+
receivers: [otlp]
81+
exporters: [otlphttp]
82+
```
83+
84+
Set the following environment variables:
85+
86+
| Variable | Value | Purpose |
87+
|----------|-------|---------|
88+
| `SUMO_LOGIC_OTLP_ENDPOINT` | `https://your-endpoint.sumologic.net/receiver/v1/otlp/YOUR_TOKEN/v1/traces` | Sumo Logic endpoint |
89+
90+
* Run command: `cd collector && make publish-layer` to publish OpenTelemetry Collector Lambda layer in your AWS account and get its ARN
91+
92+
### Configure the lambda function
93+
94+
Navigate to [functions](https://console.aws.amazon.com/lambda/home#/functions) in the AWS Lambda Console and open the function you want to instrument.
95+
96+
* Navigate to the **Layers** section and click **Add a layer**.
97+
98+
* In the **Choose a layer** menu, select **Specify an ARN** and paste the ARN ID for your Lambda function AWS Region
99+
100+
## Environment Variables
101+
102+
Set the following environment variables:
103+
104+
| Variable | Value | Purpose |
105+
|----------|-------|---------|
106+
| `OTEL_EXPORTER_OTLP_ENDPOINT` | `localhost:4318` | Collector endpoint |
107+
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | Export protocol |
108+
| `AWS_LAMBDA_EXEC_WRAPPER` | `/opt/otel-instrument` | Lambda wrapper |
109+
110+
Your function should be successfully instrumented. Invoke the function and find your traces in the [Sumo Logic Tracing screen](/docs/apm/traces/view-and-investigate-traces)
111+
112+
## References
113+
114+
* [OpenTelemetry Lambda Layer Documentation](https://github.com/open-telemetry/opentelemetry-lambda)
115+
116+
* [Sumo Logic OTLP Integration](https://help.sumologic.com/docs/apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/)

0 commit comments

Comments
 (0)