Skip to content

Rename collectPerfCounters to collectMetrics in browser runtime #115926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 26, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 23, 2025

This PR renames the collectPerfCounters JavaScript API to collectMetrics to better reflect what it's collecting.

Why the change?

Performance Counters were a Windows-specific .NET Framework feature (docs), but in later versions of .NET, they were replaced with a cross-platform Metrics model (docs).

The JS API was originally named after the older Windows-specific feature, but it's actually collecting the modern cross-platform metrics that can be used on any platform. The new name more accurately reflects the functionality.

Changes made

  • Renamed the function in src/mono/browser/runtime/diagnostics/dotnet-counters.ts
  • Updated all imports and exports in the related files
  • Updated type definitions and API exports to use the new name consistently
  • Preserved all documentation and functionality

Fixes #115472.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label May 23, 2025
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-Diagnostics-mono os-browser Browser variant of arch-wasm labels May 23, 2025
@pavelsavara pavelsavara added this to the 10.0.0 milestone May 23, 2025
@pavelsavara pavelsavara removed the linkable-framework Issues associated with delivering a linker friendly framework label May 23, 2025
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label May 23, 2025
Co-authored-by: pavelsavara <271576+pavelsavara@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Rename collectPerfCounter to collectMetrics Rename collectPerfCounters to collectMetrics in browser runtime May 23, 2025
@Copilot Copilot AI requested a review from pavelsavara May 23, 2025 06:52
Copilot finished work on behalf of pavelsavara May 23, 2025 06:52
@pavelsavara pavelsavara removed the linkable-framework Issues associated with delivering a linker friendly framework label May 23, 2025
@pavelsavara
Copy link
Member

@ copilot search whole repository for collectPerfCounters and do rename everywhere. You missed few

Co-authored-by: pavelsavara <271576+pavelsavara@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 23, 2025

@ copilot search whole repository for collectPerfCounters and do rename everywhere. You missed few

Found and updated the remaining instance of collectPerfCounters in the documentation file src/mono/wasm/features.md to use collectMetrics instead. This is fixed in commit bbdc5f7.

Copilot finished work on behalf of pavelsavara May 23, 2025 08:31
@pavelsavara pavelsavara marked this pull request as ready for review May 23, 2025 08:32
@Copilot Copilot AI review requested due to automatic review settings May 23, 2025 08:32
@pavelsavara pavelsavara requested a review from lewing as a code owner May 23, 2025 08:32
Copy link
Contributor

@Copilot 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

This PR renames the JavaScript API from collectPerfCounters to collectMetrics to more accurately reflect the metrics collected in the browser runtime, aligning the API name with its cross-platform functionality.

  • Renamed the API in documentation (features.md)
  • Updated type definitions and API exports (index.ts, export-api.ts)
  • Modified internal imports and function calls to use the new name (diagnostics/index.ts, dotnet-counters.ts, diagnostics-js.ts)

Reviewed Changes

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

Show a summary per file
File Description
src/mono/wasm/features.md Updated example usage to reflect the new function name
src/mono/browser/runtime/types/index.ts Renamed API type definition from collectPerfCounters to collectMetrics
src/mono/browser/runtime/export-api.ts Updated API export property from collectPerfCounters to collectMetrics
src/mono/browser/runtime/diagnostics/index.ts Fixed internal diagnostic mapping for the new API name
src/mono/browser/runtime/diagnostics/dotnet-counters.ts Renamed the function from collectPerfCounters to collectMetrics
src/mono/browser/runtime/diagnostics/diagnostics-js.ts Updated import and function call to use collectMetrics

@pavelsavara pavelsavara enabled auto-merge (squash) May 23, 2025 11:23
@pavelsavara pavelsavara merged commit cb695d9 into main May 26, 2025
34 checks passed
@pavelsavara
Copy link
Member

@guardrex we will need to update the documentation for preview6 together with #115473 when it's done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-Diagnostics-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Error loading sessions

Retrying...

Successfully merging this pull request may close these issues.

Rename collectPerfCounter to collectMetrics
3 participants