.NET

Instructions for installing the Lumigo .NET tracer

Overview

Configuring the Lumigo tracer for .NET Lambda functions consists of two steps: installation and wrapping your code.

Supported runtimes: .NET Core 2.1, .NET Core 3.1

Installation

Add the Lumigo tracer package via NuGet by running:

Install-Package Lumigo.DotNET

Wrapping Your Lambda

Wrap your lambda function by implementing a supplier which contains your code:

sync handler:

using Lumigo.DotNET;
using Lumigo.DotNET.Instrumentation;
...
public class Function : LumigoRequestHandler
    {
        public Function()
        {
            LumigoBootstrap.Bootstrap();
        }

        public Response FunctionHandler(string input, ILambdaContext context)
        {
            return Handle(input, context, () =>
            {
                //Your lambda code
                //return <result>; - For void functions remove the return statements
            });
        }
    }

async handler:

using Lumigo.DotNET;
using Lumigo.DotNET.Instrumentation;
...
public class Function : LumigoRequestHandler
    {
        public Function()
        {
            LumigoBootstrap.Bootstrap();
        }

        public async Task<Response> FunctionHandler(string input, ILambdaContext context)
        {
            return await Handle(input, context, async () =>
            {
                //Your lambda code
                //return <result>; - For void functions remove the return statements
            });
        }
    }

Connect Your Lumigo Account

Add LUMIGO_TRACER_TOKEN environment variable to connect the tracing to your Lumigo account.

Track HTTP Requests

To track HTTP requests add UseLumigo to the HTTP client:

using Lumigo.DotNET.Utilities.Extensions;
...
    var httpClient = new HttpClient().UseLumigo();

Did this page help you?