Thursday, January 13, 2022

Application Insights with .net core and lambda.

 How to add application insights to AWS Serverless Lambda?


Need to specify the website_hostname 

and need to specify the APPINSIGHTS_INSTRUMENTATIONKEY

var functionProps = new FunctionProps()
{
Environment = new Dictionary<string, string>()
{
{ nameof(DeploymentOptions.ApiConfigKey), apiConfigKey},
{ "WEBSITE_HOSTNAME", scope.StackName },
{ "APPINSIGHTS_INSTRUMENTATIONKEY", Fn.ImportValue(ATS.AWSBootstrap.ExportNames.EmployeePlatformAppInsightsKey) },
},
Timeout = Duration.Minutes(1),
MemorySize = 1024,
};



{
  "Logging": {
    "ApplicationInsights": {
      "LogLevel": {
        "Default": "Debug",
        "Microsoft": "Error"
      }
    },
    "LogLevel": {
      "Default": "Information"
    }
  },
  "ApplicationInsights": {
    "InstrumentationKey": "000000000000000000000000000000"
  }
}

1 comment:

  1. APPINSIGHTS_INSTRUMENTATIONKEY
    Logging__LogLevel__Default - Information
    WEBSITE_HOSTNAME - Accounts

    ReplyDelete