Skip to content

[perf-automation] Add Go language support#15807

Open
bhattmanish98 wants to merge 1 commit into
Azure:mainfrom
bhattmanish98:feat/go-sdk-integration
Open

[perf-automation] Add Go language support#15807
bhattmanish98 wants to merge 1 commit into
Azure:mainfrom
bhattmanish98:feat/go-sdk-integration

Conversation

@bhattmanish98
Copy link
Copy Markdown

Summary

Adds Go as a supported language to the perf-automation tool, enabling automated performance runs against azure-sdk-for-go packages in the same way other language SDKs (.NET, Java, JS, Python, C++) are already driven.

Changes

  • Models/Language.cs — Add Go to the Language enum.
  • Program.cs — Register the new Go runner so --language go is recognized and dispatched.
  • Go.cs (new)LanguageBase implementation for Go:
    • SetupAsync: backs up go.mod / go.sum, drops stale replace directives for requested packages, then either pins published versions via go get <pkg>@<version> or wires local source via go mod edit -replace, followed by go mod tidy.
    • RunAsync: invokes go run . <test> <args> from the project directory, captures stdout/stderr, and parses throughput via a regex matching the standard (<value> ops/s, ...) perf line (handles comma-grouped numbers, invariant culture).
    • CleanupAsync: restores go.mod / go.sum from backup and best-effort go mod tidy to leave the module graph consistent.
    • FilterRuntimePackageVersions: keeps github.com/Azure/*, golang.org/x/*, and the go runtime entry from go list -m all.
    • ResolveSourcePath: maps a github.com/Azure/azure-sdk-for-go/... import path to a local directory under WorkingDirectory.
  • Azure.Sdk.Tools.PerfAutomation.Tests/GoTests.cs (new) — NUnit coverage for ParseOpsPerSecond (valid / comma-formatted / missing), FilterRuntimePackageVersions, and ResolveSourcePath (Azure path + non-Azure rejection).
  • tests.yml — Add Go perf test definitions/templates consumed by the runner.
  • README.md — Document Go usage, prerequisites, and example invocation.

Validation

  • Built locally with dotnet build.

  • New NUnit tests pass (dotnet test).

  • Manual end-to-end run against azure-sdk-for-go storage/azblob perf tests:

    bash dotnet run -- run \ --language go --language-version 1.22 \ --repo-root <path>/azure-sdk-for-go \ --tests-file <path>/sdk/storage/azblob/testdata/perf/perfautomation-tests.yml \ --package-versions '.*' --tests '.*' --arguments '.*' --iterations 1 ​

Notes / Compatibility

  • No changes to existing language runners; Go is purely additive.
  • go.mod / go.sum are restored on cleanup to avoid mutating the consumer repo state.
  • Only github.com/Azure/azure-sdk-for-go/... packages can be resolved to a local source path; other packages must use a published version.

Copilot AI review requested due to automatic review settings June 1, 2026 14:54
@github-actions github-actions Bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jun 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Thank you for your contribution @bhattmanish98! We will review the pull request and get back to you soon.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Go as a supported language for the perf-automation runner and pipeline so Go SDK perf tests can be executed and results printed alongside existing languages.

Changes:

  • Added Go parameters, repo resource, perf job, and result-printing steps to tests.yml.
  • Implemented Go runner (Go.cs) and enabled Language.Go in the CLI.
  • Updated documentation and added NUnit coverage for Go parsing/path logic.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tools/perf-automation/tests.yml Adds Go pipeline parameters, repo resource, perf job template invocation, and result printing
tools/perf-automation/README.md Documents Go usage and lists supported languages
tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Program.cs Registers Go language handler and enforces sync-only behavior
tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Models/Language.cs Extends language enum with Go
tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Go.cs Implements Go setup/run/cleanup and throughput parsing
tools/perf-automation/Azure.Sdk.Tools.PerfAutomation.Tests/GoTests.cs Adds unit tests for Go parsing and helper behaviors

Comment on lines +101 to +103
// Capture combined output for parsing and return.
var combinedOutput = (processResult.StandardOutput ?? string.Empty) + Environment.NewLine + (processResult.StandardError ?? string.Empty);
var opsPerSecond = ParseOpsPerSecond(combinedOutput);
Comment on lines +199 to +205
var module = parts[0];
var version = parts[1];

if (parts.Length > 2 && parts[2] == "=>")
{
version = string.Join(" ", parts.Skip(1));
}
Comment on lines +148 to +152
- repository: azure-sdk-for-go
type: github
endpoint: Azure
name: Azure/azure-sdk-for-go
ref: main
Comment on lines +429 to +434
- ${{ if parameters.IncludeGo }}:
- pwsh: |
write-host results-Go-Linux/results.txt
get-content results-Go-Linux/results.txt
workingDirectory: $(Pipeline.Workspace)
displayName: Go
Comment on lines +25 to +33
| Language | `--language` value | Example `--language-version` |
| -------- | ------------------ | ---------------------------- |
| .NET | `Net` | `8` |
| Java | `Java` | `17` |
| JS | `JS` | `18` |
| Python | `Python` | `3.11` |
| Cpp | `Cpp` | `N/A` |
| Rust | `Rust` | `N/A` |
| Go | `Go` | `1.25` |
public void ResolveSourcePath_AzurePackage_ReturnsExpectedPath()
{
var go = new Go();
go.WorkingDirectory = Path.Combine(Path.DirectorySeparatorChar.ToString(), "tmp", "azure-sdk-for-go");
public void ResolveSourcePath_NonAzurePackage_Throws()
{
var go = new Go();
go.WorkingDirectory = Path.Combine(Path.DirectorySeparatorChar.ToString(), "tmp", "azure-sdk-for-go");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants