Skip to content

Commit 0df7a78

Browse files
docs: Add documentation for sending traces with instrumentation of dotnet lambda functions
1 parent 2e6694d commit 0df7a78

File tree

3 files changed

+127
-0
lines changed

3 files changed

+127
-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: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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+
## Quick Start
37+
38+
### Overview
39+
40+
```text
41+
┌─────────────────────┐ OTLP ┌──────────────────────┐ HTTP ┌─────────────┐
42+
│ .NET Lambda │ ────────► │ Collector Layer │ ────────► │ Sumo Logic │
43+
│ Function │ (default) │ (Lambda Extension) │ (protobuf) │ OTLP Endpoint│
44+
│ (Function.cs) │ │ localhost:4318 │ │ │
45+
└─────────────────────┘ └──────────────────────┘ └─────────────┘
46+
```
47+
48+
### Prerequisites
49+
50+
* AWS CLI configured with appropriate permissions
51+
* Configure the [AWS credential](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html)
52+
* .NET 6 SDK
53+
* Sumo Logic OTLP endpoint URL
54+
55+
### Build your OpenTelemetry Collector Lambda layer
56+
57+
At the moment users have to build Collector Lambda layer by themselves, we may provide a collector Lambda layer in the future.
58+
59+
* Download a local copy of the [opentelemetry-lambda repository from Github](https://github.com/open-telemetry/opentelemetry-lambda).
60+
61+
* Configure the collector layer to send data to SumoLogic:
62+
63+
```yaml
64+
receivers:
65+
otlp:
66+
protocols:
67+
grpc:
68+
endpoint: localhost:4317
69+
http:
70+
endpoint: localhost:4318
71+
72+
exporters:
73+
otlphttp:
74+
endpoint: ${SUMO_LOGIC_OTLP_ENDPOINT}
75+
headers:
76+
Content-Type: application/x-protobuf
77+
encoding: proto
78+
79+
service:
80+
pipelines:
81+
traces:
82+
receivers: [otlp]
83+
exporters: [otlphttp]
84+
```
85+
86+
Set the following environment variables:
87+
88+
| Variable | Value | Purpose |
89+
|----------|-------|---------|
90+
| `SUMO_LOGIC_OTLP_ENDPOINT` | `https://your-endpoint.sumologic.net/receiver/v1/otlp/YOUR_TOKEN/v1/traces` | Sumo Logic endpoint |
91+
92+
* Run command: `cd collector && make publish-layer` to publish OpenTelemetry Collector Lambda layer in your AWS account and get its ARN
93+
94+
### Configure the lambda function
95+
96+
Navigate to [functions](https://console.aws.amazon.com/lambda/home#/functions) in the AWS Lambda Console and open the function you want to instrument.
97+
98+
* Navigate to the **Layers** section and click **Add a layer**.
99+
100+
* In the **Choose a layer** menu, select **Specify an ARN** and paste the ARN ID for your Lambda function
101+
102+
:::note
103+
Lambda layers are a regionalized resource, meaning that they can only be used in the Region in which they are published. Make sure to use the layer in the same region as your Lambda functions.
104+
:::
105+
106+
* Configure the following environment variables:
107+
108+
| Variable | Value | Purpose |
109+
|----------|-------|---------|
110+
| `OTEL_EXPORTER_OTLP_ENDPOINT` | `localhost:4318` | Collector endpoint |
111+
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | Export protocol |
112+
| `AWS_LAMBDA_EXEC_WRAPPER` | `/opt/otel-instrument` | Lambda wrapper |
113+
114+
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)
115+
116+
## References
117+
118+
* [OpenTelemetry Lambda Layer Documentation](https://github.com/open-telemetry/opentelemetry-lambda)
119+
120+
* [Sumo Logic OTLP Integration](https://help.sumologic.com/docs/apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/)

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,6 +1819,7 @@ module.exports = {
18191819
'apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/aws-lambda/java',
18201820
'apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/aws-lambda/nodejs',
18211821
'apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/aws-lambda/python',
1822+
'apm/traces/get-started-transaction-tracing/opentelemetry-instrumentation/aws-lambda/dotnet',
18221823
],
18231824
},
18241825
{

0 commit comments

Comments
 (0)