Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/push_to_live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set lowercase image name
run: echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Ensure Application Insights exists
id: appinsights
run: |
CONN_STR=$(az monitor app-insights component show \
--app bottomly-live \
--resource-group ${{ secrets.RESOURCE_GROUP }} \
--query connectionString \
--output tsv 2>/dev/null || \
az monitor app-insights component create \
--app bottomly-live \
--resource-group ${{ secrets.RESOURCE_GROUP }} \
--location "uk south" \
--kind web \
--application-type other \
--query connectionString \
--output tsv)
echo "connection_string=$CONN_STR" >> $GITHUB_OUTPUT
- name: Deploy to Azure Container Instances
uses: azure/aci-deploy@v1
with:
Expand All @@ -49,3 +66,4 @@ jobs:
bottomly_env=${{ secrets.ENV }}
ConnectionStrings__mongodb=${{ secrets.MONGO_CONN_STR }}
bottomly_github_token=${{ secrets.RELEASE_HISTORY_TOKEN }}
APPLICATIONINSIGHTS_CONNECTION_STRING=${{ steps.appinsights.outputs.connection_string }}
1 change: 1 addition & 0 deletions Bottomly.ServiceDefaults/Bottomly.ServiceDefaults.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.14.0"/>
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.14.0"/>
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.14.0"/>
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.3.0"/>
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions Bottomly.ServiceDefaults/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Azure.Monitor.OpenTelemetry.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -88,12 +89,11 @@ private static TBuilder AddOpenTelemetryExporters<TBuilder>(this TBuilder builde
builder.Services.AddOpenTelemetry().UseOtlpExporter();
}

// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
//{
// builder.Services.AddOpenTelemetry()
// .UseAzureMonitor();
//}
if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
{
builder.Services.AddOpenTelemetry()
.UseAzureMonitor();
}

return builder;
}
Expand Down
Loading