Skip to content
Draft
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
55 changes: 55 additions & 0 deletions tracer/build/_build/Build.SupportedIntegrationsTable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.IO;
using CodeGenerators;
using Nuke.Common;
using Nuke.Common.IO;
using static Nuke.Common.IO.FileSystemTasks;
using Logger = Serilog.Log;

partial class Build
{
AbsolutePath SupportedVersionsJson => TracerDirectory / "build" / "supported_versions.json";
AbsolutePath SupportedIntegrationsOutputDirectory => TracerDirectory / "build" / "integrations";

Target GenerateSupportedIntegrationsCsv => _ => _
.Description("Generates CSV files with supported integrations CSVs")
.Executes(() =>
{
// all information / data is just pulled from the supported_versions.json file and just rendered into CSV files
if (!File.Exists(SupportedVersionsJson))
{
Logger.Error("supported_versions.json not found at {Path}", SupportedVersionsJson);
throw new FileNotFoundException($"Could not find supported_versions.json at {SupportedVersionsJson}");
}

Logger.Information("Generating supported integrations CSV files");

EnsureExistingDirectory(SupportedIntegrationsOutputDirectory);

SupportedIntegrationsTableGenerator.GenerateCsvFiles(SupportedVersionsJson, SupportedIntegrationsOutputDirectory);

// Also copy to artifacts directory if it exists
if (Directory.Exists(ArtifactsDirectory))
{
var netCoreCsv = SupportedIntegrationsOutputDirectory / "supported_integrations_netcore.csv";
var netFxCsv = SupportedIntegrationsOutputDirectory / "supported_integrations_netfx.csv";
var allCsv = SupportedIntegrationsOutputDirectory / "supported_integrations.csv";

if (File.Exists(netCoreCsv))
{
CopyFile(netCoreCsv, ArtifactsDirectory / "supported_integrations_netcore.csv", FileExistsPolicy.Overwrite);
}

if (File.Exists(netFxCsv))
{
CopyFile(netFxCsv, ArtifactsDirectory / "supported_integrations_netfx.csv", FileExistsPolicy.Overwrite);
}

if (File.Exists(allCsv))
{
CopyFile(allCsv, ArtifactsDirectory / "supported_integrations.csv", FileExistsPolicy.Overwrite);
}
}

Logger.Information("Supported Integrations CSV files generated.");
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using Nuke.Common.IO;
using static Nuke.Common.IO.FileSystemTasks;
using Logger = Serilog.Log;

namespace CodeGenerators
{
/// <summary>
/// Generates CSV files containing information about supported integrations from the supported_versions.json file.
/// </summary>
public static class SupportedIntegrationsTableGenerator
{
public class SupportedVersion
{
public string IntegrationName { get; set; }
public string AssemblyName { get; set; }
public string MinAssemblyVersionInclusive { get; set; }
public string MaxAssemblyVersionInclusive { get; set; }
public List<Package> Packages { get; set; }
}

public class Package
{
public string Name { get; set; }
public string MinVersionAvailableInclusive { get; set; }
public string MinVersionSupportedInclusive { get; set; }
public string MinVersionTestedInclusive { get; set; }
public string MaxVersionSupportedInclusive { get; set; }
public string MaxVersionAvailableInclusive { get; set; }
public string MaxVersionTestedInclusive { get; set; }
}

public class IntegrationInfo
{
public string IntegrationName { get; set; }
public string PackageName { get; set; }
public string MinVersion { get; set; }
public string MaxVersion { get; set; }
public bool IsNetCore { get; set; }
public bool IsNetFramework { get; set; }
}

// skip these integrations as they are helpers/utilities, not real integrations
// Well OpenTelemetry is a real integration, but unsure how to present that
private static readonly HashSet<string> HelperIntegrations = new()
{
"CallTargetNativeTest",
"ServiceRemoting",
"OpenTelemetry",
"AssemblyResolve"
};

// not 100% sure on these TBH would have to check
private static readonly HashSet<string> NetCoreOnlyIntegrations = new()
{
"AspNetCore",
"Grpc",
"HotChocolate"
};

private static readonly HashSet<string> NetFrameworkOnlyIntegrations = new()
{
"AspNet",
"AspNetMvc",
"AspNetWebApi2",
"Msmq",
"Owin",
"Remoting",
"Wcf"
};

/// <summary>
/// Generates CSV files containing supported integrations information.
/// </summary>
/// <param name="supportedVersionsPath">Path to the supported_versions.json file</param>
/// <param name="outputDirectory">Directory where CSV files will be saved</param>
public static void GenerateCsvFiles(AbsolutePath supportedVersionsPath, AbsolutePath outputDirectory)
{
Logger.Information("Reading supported versions from {Path}", supportedVersionsPath);

var supportedVersions = ReadSupportedVersions(supportedVersionsPath);
var integrations = ProcessIntegrations(supportedVersions);

GenerateOutputFiles(integrations, outputDirectory);
}

private static List<SupportedVersion> ReadSupportedVersions(AbsolutePath supportedVersionsPath)
{
var json = File.ReadAllText(supportedVersionsPath);
return JsonSerializer.Deserialize<List<SupportedVersion>>(json, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
});
}

private static void GenerateOutputFiles(List<IntegrationInfo> integrations, AbsolutePath outputDirectory)
{
// Generate .NET Core/.NET CSV
GenerateCsv(
integrations.Where(i => i.IsNetCore).OrderBy(i => i.IntegrationName).ThenBy(i => i.PackageName),
outputDirectory / "supported_integrations_netcore.csv",
".NET Core / .NET");

// Generate .NET Framework CSV
GenerateCsv(
integrations.Where(i => i.IsNetFramework).OrderBy(i => i.IntegrationName).ThenBy(i => i.PackageName),
outputDirectory / "supported_integrations_netfx.csv",
".NET Framework");

// Generate combined CSV
GenerateCsv(
integrations.OrderBy(i => i.IntegrationName).ThenBy(i => i.PackageName),
outputDirectory / "supported_integrations.csv",
"All Frameworks");
}

private static List<IntegrationInfo> ProcessIntegrations(List<SupportedVersion> supportedVersions)
{
var integrations = new List<IntegrationInfo>();

foreach (var version in supportedVersions)
{
if (IsHelperIntegration(version.IntegrationName))
continue;

if (version.Packages != null && version.Packages.Any())
{
foreach (var package in version.Packages)
{
var info = CreateIntegrationInfo(version, package);
integrations.Add(info);
}
}
else
{
var info = CreateIntegrationInfoFromAssembly(version);
integrations.Add(info);
}
}

return integrations;
}

private static IntegrationInfo CreateIntegrationInfo(SupportedVersion version, Package package)
{
// For packages with NuGet packages, use minVersionTestedInclusive as min
// and the floating major version of maxVersionTestedInclusive as max
var minVersion = package.MinVersionTestedInclusive ?? package.MinVersionSupportedInclusive ?? version.MinAssemblyVersionInclusive;
var maxVersion = package.MaxVersionTestedInclusive ?? package.MaxVersionSupportedInclusive ?? version.MaxAssemblyVersionInclusive;

return new IntegrationInfo
{
IntegrationName = version.IntegrationName,
PackageName = package.Name,
MinVersion = minVersion,
MaxVersion = GetFloatingMajorVersion(maxVersion), // Use floating version for max
IsNetCore = !NetFrameworkOnlyIntegrations.Contains(version.IntegrationName),
IsNetFramework = !NetCoreOnlyIntegrations.Contains(version.IntegrationName)
};
}

private static IntegrationInfo CreateIntegrationInfoFromAssembly(SupportedVersion version)
{
// For assemblies without NuGet packages, use minAssemblyVersionInclusive as min
// and the floating version of maxAssemblyVersionInclusive as max
return new IntegrationInfo
{
IntegrationName = version.IntegrationName,
PackageName = version.AssemblyName, // Use assembly name as package name
MinVersion = version.MinAssemblyVersionInclusive,
MaxVersion = GetFloatingMajorVersion(version.MaxAssemblyVersionInclusive), // Use floating version for max
IsNetCore = !NetFrameworkOnlyIntegrations.Contains(version.IntegrationName),
IsNetFramework = !NetCoreOnlyIntegrations.Contains(version.IntegrationName)
};
}

private static bool IsHelperIntegration(string integrationName)
{
return HelperIntegrations.Contains(integrationName);
}

private static string GetFloatingMajorVersion(string version)
{
if (string.IsNullOrEmpty(version))
return "N/A";

// Parse the version string to get the major version
var parts = version.Split('.');
if (parts.Length > 0)
{
// Return major version with .x suffix
return parts[0] + ".x";
}

return version;
}

private static void GenerateCsv(IEnumerable<IntegrationInfo> integrations, AbsolutePath outputPath, string framework)
{
var sb = new StringBuilder();
// Simple 4-column CSV format
sb.AppendLine("integration,package,min_version,max_version");

foreach (var integration in integrations)
{
sb.AppendLine($"{integration.IntegrationName},{integration.PackageName},{integration.MinVersion},{integration.MaxVersion}");
}

EnsureExistingDirectory(outputPath.Parent);
File.WriteAllText(outputPath, sb.ToString());

Logger.Information("Generated {Framework} supported integrations CSV: {Path}", framework, outputPath);
Logger.Information("Total integrations: {Count}", integrations.Count());
}
}
}
97 changes: 97 additions & 0 deletions tracer/build/integrations/supported_integrations.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
integration,package,min_version,max_version
AdoNet,netstandard,2.0.0,2.x
AdoNet,System.Data.Common,4.0.0,4.x
AdoNet,System.Data.SqlClient,4.1.0,4.x
Aerospike,Aerospike.Client,4.0.3,8.x
AspNet,System.Web,4.0.0,4.x
AspNetCore,Microsoft.AspNetCore.Authentication.Abstractions,2.0.0,2.x
AspNetCore,Microsoft.AspNetCore.Http,2.0.0,9.x
AspNetCore,Microsoft.AspNetCore.Http.Abstractions,2.2.0,2.x
AspNetCore,Microsoft.AspNetCore.Identity,2.0.0,2.x
AspNetCore,Microsoft.AspNetCore.Mvc.Core,2.0.0,2.x
AspNetCore,Microsoft.AspNetCore.Server.IIS,2.2.0,2.x
AspNetCore,Microsoft.AspNetCore.Server.Kestrel.Core,2.0.0,2.x
AspNetCore,Microsoft.AspNetCore.Session,2.0.0,2.x
AspNetCore,Microsoft.AspNetCore.StaticFiles,2.0.0,2.x
AspNetCore,Microsoft.Extensions.Identity.Core,2.0.0,9.x
AspNetMvc,Microsoft.AspNet.Mvc,4.0.20505,5.x
AspNetWebApi2,System.Web.Http,5.1.0,5.x
AwsDynamoDb,AWSSDK.DynamoDBv2,3.1.5.3,4.x
AwsEventBridge,AWSSDK.EventBridge,3.3.102.16,4.x
AwsKinesis,AWSSDK.Kinesis,3.1.3.5,4.x
AwsLambda,Amazon.Lambda.RuntimeSupport,1.13.1,1.x
AwsS3,AWSSDK.S3,3.3.113.2,4.x
AwsSdk,AWSSDK.Core,3.1.11,4.x
AwsSns,AWSSDK.SimpleNotificationService,3.1.2.1,4.x
AwsSqs,AWSSDK.SQS,3.1.0.13,4.x
AwsStepFunctions,AWSSDK.StepFunctions,3.3.104.87,4.x
AzureFunctions,Microsoft.Azure.Functions.Worker.Core,1.4.0,2.x
AzureFunctions,Microsoft.Azure.WebJobs,3.0.0,3.x
AzureFunctions,Microsoft.Azure.WebJobs.Script.Grpc,4.0.0,4.x
AzureFunctions,Microsoft.Azure.WebJobs.Script.WebHost,3.0.0,4.x
AzureServiceBus,Azure.Messaging.ServiceBus,7.4.0,7.x
CosmosDb,Microsoft.Azure.Cosmos,3.6.0,3.x
Couchbase,CouchbaseNetClient,2.4.8,3.x
DatadogTraceManual,Datadog.Trace.Manual,3.0.0,3.x
DatadogTraceManual,Datadog.Trace.OpenTracing,3.0.0,3.x
DotnetTest,coverlet.core,3.0.0,6.x
DotnetTest,dotnet,2.0.0,9.x
DotnetTest,Microsoft.VisualStudio.TraceDataCollector,15.0.0,15.x
DotnetTest,vstest.console,15.0.0,15.x
DotnetTest,vstest.console.arm64,15.0.0,15.x
ElasticsearchNet,Elasticsearch.Net,5.3.1,7.x
GraphQL,GraphQL,4.1.0,8.x
GraphQL,GraphQL.SystemReactive,4.0.0,4.x
Grpc,Google.Protobuf,3.12.4,3.x
Grpc,Grpc,2.29.0,2.x
Grpc,Grpc.AspNetCore,2.29.0,2.x
Grpc,Grpc.AspNetCore,2.29.0,2.x
HashAlgorithm,System.Security.Cryptography,7.0.0,9.x
HashAlgorithm,System.Security.Cryptography.Primitives,1.0.0,6.x
HotChocolate,HotChocolate.AspNetCore,11.3.8,15.x
HttpMessageHandler,System.Net.Http,4.0.0,4.x
HttpMessageHandler,System.Net.Http.WinHttpHandler,4.0.0,9.x
HttpMessageHandler,Yarp.ReverseProxy,1.0.1,2.x
IbmMq,IBMMQDotnetClient,9.1.4,9.x
ILogger,Microsoft.Extensions.Logging,2.0.0,9.x
ILogger,Microsoft.Extensions.Logging.Abstractions,2.0.0,9.x
ILogger,Microsoft.Extensions.Telemetry,8.10.0,9.x
Kafka,Confluent.Kafka,1.4.4,2.x
Log4Net,log4net,1.2.11,3.x
MongoDb,MongoDB.Driver,2.0.2,3.x
MongoDb,MongoDB.Driver,2.0.2,3.x
MongoDb,MongoDB.Driver.Core,2.1.0,2.x
Msmq,System.Messaging,4.0.0,4.x
MsTestV2,Microsoft.TestPlatform.CrossPlatEngine,14.0.0,15.x
MsTestV2,Microsoft.VisualStudio.TestPlatform,14.0.0,14.x
MsTestV2,MSTest.TestAdapter,1.1.11,3.x
MsTestV2,MSTest.TestAdapter,1.1.11,3.x
MySql,MySql.Data,6.7.9,9.x
MySql,MySqlConnector,0.61.0,2.x
NLog,NLog,1.0.0.505,6.x
Npgsql,Npgsql,4.1.14,9.x
NUnit,NUnit,3.6.1,4.x
Oracle,Oracle.DataAccess,4.122.0,4.x
Oracle,Oracle.ManagedDataAccess,12.1.21,23.x
Process,System,1.0.0,9.x
Process,System.Diagnostics.Process,1.0.0,9.x
RabbitMQ,RabbitMQ.Client,3.6.9,7.x
Remoting,System.Runtime.Remoting,4.0.0,4.x
Selenium,Selenium.WebDriver,4.0.1,4.x
Serilog,Serilog,1.4.214,4.x
ServiceStackRedis,ServiceStack.Redis,4.5.14,8.x
SqlClient,Microsoft.Data.SqlClient,1.1.4,6.x
SqlClient,Microsoft.Data.Sqlite,2.3.0,9.x
SqlClient,System.Data.SqlClient,4.1.0,4.x
SqlClient,System.Data.SQLite,1.0.66.1,1.x
Ssrf,RestSharp,104.0.0,112.x
StackExchangeRedis,StackExchange.Redis,1.0.488,2.x
StackExchangeRedis,StackExchange.Redis.StrongName,1.0.312,1.x
StackTraceLeak,Microsoft.AspNetCore.Diagnostics,2.0.0,2.x
TestPlatformAssemblyResolver,Microsoft.TestPlatform.PlatformAbstractions,15.0.0,15.x
Wcf,System.ServiceModel.Http,4.0.0,4.x
WebRequest,System.Net.Requests,4.0.0,4.x
Xss,Microsoft.AspNetCore.Html.Abstractions,1.0.0,2.x
XUnit,xunit,2.2.0,2.x
XUnit,xunit.extensibility.execution,2.2.0,2.x
XUnit,xunit.v3,2.0.3,3.x
Loading
Loading