Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Microsoft.ApplicationInsights.AspNetCore from 2.20.0 to 2.21.0 #1794

Merged
6 changes: 3 additions & 3 deletions .github/workflows/e2e-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ jobs:
IOT_HUB_RESOURCE_ID: ${{ secrets.IOT_HUB_RESOURCE_ID }}
LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
LOG_ANALYTICS_SHARED_KEY: ${{ secrets.LOG_ANALYTICS_SHARED_KEY }}
APPINSIGHTS_INSTRUMENTATIONKEY: ${{ secrets.APPINSIGHTS_INSTRUMENTATIONKEY }}
APPLICATIONINSIGHTS_CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }}
CERT_REMOTE_PATH: ${{ needs.env_var.outputs.CertRemotePath }}
SERVER_PFX_PASSWORD: ${{ secrets.SERVER_PFX_PASSWORD }}
NET_SRV_LOG_TO_TCP_ADDRESS: "itestup"
Expand Down Expand Up @@ -385,7 +385,7 @@ jobs:
IOT_HUB_RESOURCE_ID: ${{ secrets.IOT_HUB_RESOURCE_ID }}
LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
LOG_ANALYTICS_SHARED_KEY: ${{ secrets.LOG_ANALYTICS_SHARED_KEY }}
APPINSIGHTS_INSTRUMENTATIONKEY: ${{ secrets.APPINSIGHTS_INSTRUMENTATIONKEY }}
APPLICATIONINSIGHTS_CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }}
steps:
- uses: actions/checkout@v3
name: Checkout current branch
Expand Down Expand Up @@ -436,7 +436,7 @@ jobs:
IOT_HUB_RESOURCE_ID: ${{ secrets.IOT_HUB_RESOURCE_ID }}
LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
LOG_ANALYTICS_SHARED_KEY: ${{ secrets.LOG_ANALYTICS_SHARED_KEY }}
APPINSIGHTS_INSTRUMENTATIONKEY: ${{ secrets.APPINSIGHTS_INSTRUMENTATIONKEY }}
APPLICATIONINSIGHTS_CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }}
with:
deployment_file_name: '${{ secrets.DEPLOYMENT_FILE_NAME }}'
architecture: '${{ secrets.ARCHITECTURE }}'
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<SystemDynamicRuntimeVersion>4.3.0</SystemDynamicRuntimeVersion>
<StackExchangeRedisVersion>2.6.48</StackExchangeRedisVersion>
<MicrosoftCSharpVersion>4.7.0</MicrosoftCSharpVersion>
<ApplicationInsightsVersion>2.20.0</ApplicationInsightsVersion>
<ApplicationInsightsVersion>2.21.0</ApplicationInsightsVersion>
<PrometheusNetVersion>6.0.0</PrometheusNetVersion>
<AzureIdentityVersion>1.6.1</AzureIdentityVersion>
<MicrosoftAspNetCoreHttpAbstractionsVersion>2.2.0</MicrosoftAspNetCoreHttpAbstractionsVersion>
Expand Down
4 changes: 2 additions & 2 deletions LoRaEngine/deployment.ci.aio.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
"LOG_TO_TCP_ADDRESS": {
"value": "$NET_SRV_LOG_TO_TCP_ADDRESS"
},
"APPINSIGHTS_INSTRUMENTATIONKEY": {
"value": "$APPINSIGHTS_INSTRUMENTATIONKEY"
"APPLICATIONINSIGHTS_CONNECTION_STRING": {
"value": "$APPLICATIONINSIGHTS_CONNECTION_STRING"
},
"LNS_SERVER_PFX_PATH": {
"value": "/var/lorastarterkit/certs/server.pfx"
Expand Down
4 changes: 2 additions & 2 deletions LoRaEngine/deployment.ci.lns.eflow.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
"LOG_TO_TCP_ADDRESS": {
"value": "$NET_SRV_LOG_TO_TCP_ADDRESS"
},
"APPINSIGHTS_INSTRUMENTATIONKEY": {
"value": "$APPINSIGHTS_INSTRUMENTATIONKEY"
"APPLICATIONINSIGHTS_CONNECTION_STRING": {
"value": "$APPLICATIONINSIGHTS_CONNECTION_STRING"
},
"LNS_VERSION": {
"value": "$NET_SRV_VERSION"
Expand Down
4 changes: 2 additions & 2 deletions LoRaEngine/deployment.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
"LOG_TO_TCP_ADDRESS": {
"value": "$NET_SRV_LOG_TO_TCP_ADDRESS"
},
"APPINSIGHTS_INSTRUMENTATIONKEY": {
"value": "$APPINSIGHTS_INSTRUMENTATIONKEY"
"APPLICATIONINSIGHTS_CONNECTION_STRING": {
"value": "$APPLICATIONINSIGHTS_CONNECTION_STRING"
}
},
"status": "running",
Expand Down
2 changes: 1 addition & 1 deletion LoRaEngine/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ LBS_SPI_DEV=0
##############################
# Azure Monitor settings
##############################
APPINSIGHTS_INSTRUMENTATIONKEY=""
APPLICATIONINSIGHTS_CONNECTION_STRING=""
IOT_HUB_RESOURCE_ID=""
LOG_ANALYTICS_WORKSPACE_ID=""
LOG_ANALYTICS_SHARED_KEY=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace LoRaWan.NetworkServer.BasicsStation
using LoRaWan.NetworkServer.BasicsStation.ModuleConnection;
using LoRaWan.NetworkServer.BasicsStation.Processors;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.AspNetCore.Extensions;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
Expand Down Expand Up @@ -49,8 +50,8 @@ public void ConfigureServices(IServiceCollection services)
ITransportSettings[] settings = { new AmqpTransportSettings(TransportType.Amqp_Tcp_Only) };
var loraModuleFactory = new LoRaModuleClientFactory(settings);

var appInsightsKey = Configuration.GetValue<string>("APPINSIGHTS_INSTRUMENTATIONKEY");
var useApplicationInsights = !string.IsNullOrEmpty(appInsightsKey);
var appInsightsConnectionString = Configuration.GetValue<string>("APPLICATIONINSIGHTS_CONNECTION_STRING");
var useApplicationInsights = !string.IsNullOrEmpty(appInsightsConnectionString);
_ = services.AddLogging(loggingBuilder =>
{
_ = loggingBuilder.ClearProviders();
Expand All @@ -72,7 +73,8 @@ public void ConfigureServices(IServiceCollection services)

if (useApplicationInsights)
{
_ = loggingBuilder.AddApplicationInsights(appInsightsKey)
_ = loggingBuilder.AddApplicationInsights(telemetryConfiguration => { telemetryConfiguration.ConnectionString = appInsightsConnectionString; },
loggerOptions => { })
.AddFilter<ApplicationInsightsLoggerProvider>(string.Empty, logLevel);
_ = services.AddSingleton<ITelemetryInitializer>(_ => new TelemetryInitializer(NetworkServerConfiguration));
}
Expand Down Expand Up @@ -116,7 +118,7 @@ public void ConfigureServices(IServiceCollection services)

if (useApplicationInsights)
{
_ = services.AddApplicationInsightsTelemetry(appInsightsKey)
_ = services.AddApplicationInsightsTelemetry(new ApplicationInsightsServiceOptions { ConnectionString = appInsightsConnectionString })
.AddSingleton<ITracing, ApplicationInsightsTracing>();
}
else
Expand Down
8 changes: 4 additions & 4 deletions Template/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@
"value": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Template/deviceConfiguration.json')]"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).InstrumentationKey]"
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).ConnectionString]"
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
Expand Down Expand Up @@ -414,8 +414,8 @@
"discoveryZipUrl": {
"value": "[variables('discoveryServiceZipBinary')]"
},
"appInsightsInstrumentationKey": {
"value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).InstrumentationKey]"
"applicationInsightsConnectionString": {
"value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).ConnectionString]"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Template/discoveryService.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"iotHubName": {
"type": "string"
},
"appInsightsInstrumentationKey": {
"applicationInsightsConnectionString": {
"type": "string"
},
"roleNameGuid": {
Expand Down Expand Up @@ -81,8 +81,8 @@
"value": "[variables('aspNetCoreUrls')]"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[parameters('appInsightsInstrumentationKey')]"
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[parameters('applicationInsightsConnectionString')]"
}
],
"webSocketsEnabled": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ApplicationInsightsTracingTests()
this.configuration = new TelemetryConfiguration
{
TelemetryChannel = this.stubTelemetryChannel,
InstrumentationKey = Guid.NewGuid().ToString(),
ConnectionString = $"InstrumentationKey={Guid.NewGuid()};IngestionEndpoint=https://westeurope-2.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/",
TelemetryInitializers = { new OperationCorrelationTelemetryInitializer() }
};
}
Expand Down