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
11 changes: 11 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@
"matchCurrentValue": "^\\[[^,]+,\\)$",
"enabled": false
},
{
"extends": ["monorepo:aws-sdk-net"],
"description": ["Only update the AWS SDK once a week"],
"schedule": ["* 5-21 * * MON"]
},
{
"extends": ["monorepo:aws-sdk-net"],
"description": ["Disable major version updates for the AWS SDK"],
"matchUpdateTypes": ["major"],
"enabled": false
},
{
"extends": ["monorepo:dotnet"],
"description": "Disable major version updates for .NET",
Expand Down
9 changes: 9 additions & 0 deletions docker/docker-compose-aspnetcore/docker-compose.oats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ services:
context: ../..
dockerfile: examples/net8.0/aspnetcore/Dockerfile
environment:
- AWS_ACCESS_KEY_ID=localstack
- AWS_SECRET_ACCESS_KEY=localstack
- AWS_REGION=us-east-1
- AWS_ENDPOINT_URL_S3=http://localstack:4566
- OTEL_EXPORTER_OTLP_ENDPOINT=http://lgtm:4317
ports:
- "5000:8080"
Expand All @@ -28,3 +32,8 @@ services:
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=Password12345%%
localstack:
image: localstack/localstack:4.5.0@sha256:9d4253786e0effe974d77fe3c390358391a56090a4fff83b4600d8a64404d95d
ports:
- "4510-4559:4510-4559"
- "4566:4566"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ services:
DOTNET_PUBLISH_ARGS: "--self-contained true /p:PublishSingleFile=true"
entrypoint: ./aspnetcore
environment:
- AWS_ACCESS_KEY_ID=localstack
- AWS_SECRET_ACCESS_KEY=localstack
- AWS_REGION=us-east-1
- AWS_ENDPOINT_URL_S3=http://localstack:4566
- OTEL_EXPORTER_OTLP_ENDPOINT=http://lgtm:4317
ports:
- "5000:8080"
Expand All @@ -31,3 +35,8 @@ services:
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=Password12345%%
localstack:
image: localstack/localstack:4.5.0@sha256:9d4253786e0effe974d77fe3c390358391a56090a4fff83b4600d8a64404d95d
ports:
- "4510-4559:4510-4559"
- "4566:4566"
10 changes: 10 additions & 0 deletions docker/docker-compose-aspnetcore/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ services:
- mssql
ports:
- "8080:8080" # for OATs
environment:
- AWS_ACCESS_KEY_ID=localstack
- AWS_SECRET_ACCESS_KEY=localstack
- AWS_REGION=us-east-1
- AWS_ENDPOINT_URL_S3=http://localstack:4566
redis:
image: redis:8.0@sha256:1b835e5a8d5db58e8b718850bf43a68ef5a576fc68301fd08a789b20b4eecb61
ports:
Expand All @@ -20,3 +25,8 @@ services:
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=Password12345%%
localstack:
image: localstack/localstack:4.5.0@sha256:9d4253786e0effe974d77fe3c390358391a56090a4fff83b4600d8a64404d95d
ports:
- "4510-4559:4510-4559"
- "4566:4566"
10 changes: 10 additions & 0 deletions docker/docker-compose-aspnetcore/oats.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include:
- ./oats-template.yml
input:
- path: /api/Aws/ListBuckets
- path: /api/HttpClient/Get
- path: /api/HttpClient/GetError
- path: /api/MsSql/ServerInfo
Expand Down Expand Up @@ -80,3 +81,12 @@ expected:
db.name: main
peer.service: /app/App_Data/TodoApp.db
otel.library.name: OpenTelemetry.Instrumentation.EntityFrameworkCore
- traceql: '{ span.http.route =~ "api/Aws/ListBuckets" }'
spans:
- name: 'S3.ListBuckets'
attributes:
aws.request_id: regex:.+
otel.library.name: AWSSDK.S3
rpc.method: ListBuckets
rpc.service: S3
rpc.system: aws-api
26 changes: 26 additions & 0 deletions examples/net8.0/aspnetcore/Controllers/AwsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright Grafana Labs
// SPDX-License-Identifier: Apache-2.0
//

using Amazon.S3;
using Microsoft.AspNetCore.Mvc;

namespace aspnetcore.Controllers;

[Route("api/[controller]/[action]")]
[ApiController]
public class AwsController(IAmazonS3 client, ILogger<AwsController> logger) : ControllerBase
{
[HttpGet]
public async Task<ActionResult<string[]>> ListBuckets()
{
var response = await client.ListBucketsAsync();

var buckets = response.Buckets.Select(o => o.BucketName).ToArray();

logger.LogInformation("Found {Count} buckets.", buckets.Length);

return this.Ok(buckets);
}
}
4 changes: 4 additions & 0 deletions examples/net8.0/aspnetcore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: Apache-2.0
//

using Amazon.S3;
using aspnetcore;
using Grafana.OpenTelemetry;
using Microsoft.Data.SqlClient;
Expand All @@ -29,6 +30,9 @@
return new SqlConnection(connectionString);
});

// AWS SDKs
builder.Services.AddSingleton<IAmazonS3>((_) => new AmazonS3Client(new AmazonS3Config() { ForcePathStyle = true }));

builder.Services.AddHttpClient();

builder.Services.AddControllers();
Expand Down
1 change: 1 addition & 0 deletions examples/net8.0/aspnetcore/aspnetcore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.7.418.2" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.17" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
Expand Down
Loading