Skip to content

Commit 5a40fa1

Browse files
[Infra] .NET 10 preparation
Cherry-pick various changes from open-telemetry#2822: - Fix incorrect version comment on CodeQL actions. - Explicitly disable use of pre-release .NET SDK versions. - Fix incorrect comment. - Make System.Text.Json package reference conditional to avoid explicit dependency when the package in "in-box". - Fix typo in test name. - Add support for a maximum version for routing test cases. - Allow the metric path for routing test cases to diverge from the activity path.
1 parent 8452d88 commit 5a40fa1

File tree

12 files changed

+22
-12
lines changed

12 files changed

+22
-12
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ jobs:
4141
show-progress: false
4242

4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@d3678e237b9c32a6c9bffb3315c335f976f3549f # v3.29.5
44+
uses: github/codeql-action/init@d3678e237b9c32a6c9bffb3315c335f976f3549f # v3.30.2
4545
with:
4646
build-mode: none
4747
languages: ${{ matrix.language }}
4848

4949
- name: Perform CodeQL Analysis
50-
uses: github/codeql-action/analyze@d3678e237b9c32a6c9bffb3315c335f976f3549f # v3.29.5
50+
uses: github/codeql-action/analyze@d3678e237b9c32a6c9bffb3315c335f976f3549f # v3.30.2
5151
with:
5252
category: '/language:${{ matrix.language }}'
5353

.github/workflows/ossf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
# Upload the results to GitHub's code scanning dashboard (optional).
4343
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
4444
- name: "Upload to code-scanning"
45-
uses: github/codeql-action/upload-sarif@d3678e237b9c32a6c9bffb3315c335f976f3549f # v3.29.5
45+
uses: github/codeql-action/upload-sarif@d3678e237b9c32a6c9bffb3315c335f976f3549f # v3.30.2
4646
with:
4747
sarif_file: results.sarif

global.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"sdk": {
33
"rollForward": "latestFeature",
4+
"allowPrerelease": false,
45
"version": "9.0.304"
56
}
67
}

src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</ItemGroup>
2323

2424
<ItemGroup>
25-
<!-- Note: Only include LinuxTracepoints-Net files for net8.0+ targets -->
25+
<!-- Note: Only include LinuxTracepoints-Net files for netfx targets -->
2626
<Compile Remove="External\LinuxTracepoints-Net\**" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
2727
</ItemGroup>
2828

test/OpenTelemetry.Contrib.Shared.Tests/OpenTelemetry.Contrib.Shared.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<ItemGroup>
1010
<PackageReference Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftExtensionsConfigurationPkgVer)" />
1111
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
12-
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonLatestNet8OutOfBandPkgVer)" />
12+
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonLatestNet8OutOfBandPkgVer)" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))" />
1313
</ItemGroup>
1414

1515
<ItemGroup>

test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ void ConfigureTestServices(IServiceCollection services)
12141214

12151215
// note: this is always passing on Net9 or lower, because AddAspNetCoreInstrumentation only adds the subscription in Net10 or higher.
12161216
[Fact]
1217-
public async Task RazorComponentsActivitesCanBeDisabled()
1217+
public async Task RazorComponentsActivitiesCanBeDisabled()
12181218
{
12191219
var exportedItems = new List<Activity>();
12201220
void ConfigureTestServices(IServiceCollection services)
@@ -1239,7 +1239,7 @@ void ConfigureTestServices(IServiceCollection services)
12391239
{
12401240
activity.Start();
12411241
activity.SetTag("aspnetcore.components.type", "BasicTests");
1242-
activity.SetTag("aspnetcore.components.method", "BlazorActivitesCanBeDisabled");
1242+
activity.SetTag("aspnetcore.components.method", "BlazorActivitiesCanBeDisabled");
12431243
activity.Stop();
12441244
}
12451245

test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/RoutingTestCases.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ public static IEnumerable<object[]> GetTestCases()
2727
private static List<object[]> GetArgumentsFromTestCaseObject(IEnumerable<TestCase> input)
2828
{
2929
var result = new List<object[]>();
30+
var dotnetVersion = Environment.Version.Major;
3031

3132
foreach (var testCase in input)
3233
{
33-
if (testCase.MinimumDotnetVersion.HasValue && Environment.Version.Major < testCase.MinimumDotnetVersion.Value)
34+
if ((testCase.MinimumDotnetVersion.HasValue && dotnetVersion < testCase.MinimumDotnetVersion.Value) ||
35+
(testCase.MaximumDotnetVersion.HasValue && dotnetVersion > testCase.MaximumDotnetVersion.Value))
3436
{
3537
continue;
3638
}

test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/RoutingTestCases.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
{
129129
"name": "Root path",
130130
"testApplicationScenario": "RazorPages",
131+
"maximumDotnetVersion": 9,
131132
"httpMethod": "GET",
132133
"path": "/",
133134
"expectedStatusCode": 200,

test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/RoutingTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ public async Task TestHttpRoute(TestCase testCase)
7474
Assert.Equal(testCase.HttpMethod, activityHttpMethod);
7575
Assert.Equal(testCase.HttpMethod, metricHttpMethod);
7676

77-
// TODO: The CurrentHttpRoute property will go away. It They only serve to capture status quo.
77+
// TODO: The CurrentHttpRoute property will go away. They only serve to capture status quo.
7878
// If CurrentHttpRoute is null, then that means we already conform to the correct behavior.
7979
var expectedHttpRoute = testCase.CurrentHttpRoute ?? testCase.ExpectedHttpRoute;
8080
Assert.Equal(expectedHttpRoute, activityHttpRoute);
81-
Assert.Equal(expectedHttpRoute, metricHttpRoute);
81+
82+
var expectedMetricRoute = testCase.ExpectedMetricRoute ?? expectedHttpRoute;
83+
Assert.Equal(expectedMetricRoute, metricHttpRoute);
8284

8385
// Activity.DisplayName should be a combination of http.method + http.route attributes, see:
8486
// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#name

test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestCase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class TestCase
1111

1212
public int? MinimumDotnetVersion { get; set; }
1313

14+
public int? MaximumDotnetVersion { get; set; }
15+
1416
public TestApplicationScenario TestApplicationScenario { get; set; }
1517

1618
public string? HttpMethod { get; set; }
@@ -23,6 +25,8 @@ public class TestCase
2325

2426
public string? CurrentHttpRoute { get; set; }
2527

28+
public string? ExpectedMetricRoute { get; set; }
29+
2630
public override string ToString()
2731
{
2832
// This is used by Visual Studio's test runner to identify the test case.

0 commit comments

Comments
 (0)