Rename internal Statsbeat symbols to SdkStats (cleanup)#152
Rename internal Statsbeat symbols to SdkStats (cleanup)#152JacksonWeber wants to merge 3 commits into
Conversation
Replaces the bare word `statsbeat` in comments/docs/strings that were added by PR microsoft#145. External API identifiers (AzureMonitorStatsbeatExporter, StatsbeatFeature, AZURE_MONITOR_STATSBEAT_FEATURES, APPLICATIONINSIGHTS_STATSBEAT_DISABLED_ALL, NetworkStatsbeatMetrics, StatsbeatCounter, module paths, `setStatsbeatFeatures`) are preserved as they reference real symbols from @azure/monitor-opentelemetry-exporter and ../utils/statsbeat.js. Pre-existing `statsbeat` references on main are left untouched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Renames internal-only Statsbeat* enums, interfaces, classes, files, and identifiers to SdkStats* / SDKStats / SDK Stats for naming consistency. External API references are preserved: - AZURE_MONITOR_STATSBEAT_FEATURES / APPLICATIONINSIGHTS_STATSBEAT_DISABLED_ALL env var names - AzureMonitorStatsbeatExporter, NetworkStatsbeatMetrics, StatsbeatCounter (from @azure/monitor-opentelemetry-exporter) - isStatsbeatExporter flag - @azure/monitor-opentelemetry-exporter/dist/.../statsbeat/... module paths Build + 857 tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| import { getInstance } from "../../../src/utils/statsbeat.js"; | ||
| import { AZURE_MONITOR_STATSBEAT_FEATURES, StatsbeatFeature } from "../../../src/types.js"; | ||
| import { getInstance } from "../../../src/utils/sdkStats.js"; | ||
| import { AZURE_MONITOR_STATSBEAT_FEATURES, SdkStatsFeature } from "../../../src/types.js"; |
There was a problem hiding this comment.
We use this to encode a JSON payload with the feature and instrumentation bitmaps. It was originally introduced for the App Insights shim to calculate and send Instrumentations/Features detected at that level to the Az Mon Exporter to be emitted as SDK stats.
There was a problem hiding this comment.
Pull request overview
This PR renames internal “Statsbeat” symbols and file paths to “SdkStats” across the distro for naming consistency, while preserving the external Azure Monitor statsbeat contracts (env var names, exporter symbols, and subpath imports).
Changes:
- Renamed internal types/enums/maps (e.g.,
StatsbeatFeature→SdkStatsFeature) and updated call sites throughout the distro and tests. - Renamed statsbeat singleton/config implementation from
src/utils/statsbeat.tstosrc/utils/sdkStats.tsand updated imports/exports. - Updated Azure Monitor helper naming (
getAzureMonitorStatsbeatFeatures→getAzureMonitorSdkStatsFeatures) and refreshed related docs/comments/test descriptions.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/internal/unit/sdkstats/state.test.ts | Updates tests to use SdkStatsFeature/SdkStatsInstrumentation enums. |
| test/internal/unit/sdkstats/metrics.test.ts | Updates SDKStats metrics tests to renamed enums/constants. |
| test/internal/unit/sdkStats.test.ts | Updates configuration tests to call setSdkStatsFeatures and use SdkStatsFeature. |
| test/internal/unit/main.test.ts | Updates main integration-ish unit tests to renamed SDKStats types/maps and updated strings. |
| test/internal/unit/azureMonitor/getAzureMonitorSdkStatsFeatures.test.ts | Renames and updates tests for the Azure Monitor SDKStats feature derivation helper. |
| test/internal/unit/a365/agent365NetworkStats.test.ts | Updates test description wording to “SDKStats”. |
| src/utils/statsbeat.ts | Removes old statsbeat singleton implementation (file rename). |
| src/utils/sdkStats.ts | Adds renamed singleton implementation and method setSdkStatsFeatures. |
| src/utils/opentelemetryInstrumentationPatcher.ts | Renames env-var update logic to use SdkStats* types/maps and updates log message/comment. |
| src/utils/index.ts | Updates utils barrel export to point to sdkStats. |
| src/types.ts | Renames internal Statsbeat interfaces/enums/maps to SdkStats* equivalents. |
| src/sdkstats/state.ts | Updates SDKStats state to use renamed enums and refreshed docs. |
| src/sdkstats/otlpWrapper.ts | Updates docs/comments to “SDKStats” naming. |
| src/sdkstats/networkStats.ts | Updates docs/comments to “SDKStats” naming. |
| src/sdkstats/metrics.ts | Renames internal constants/comments to “SDKStats” terminology. |
| src/sdkstats/manager.ts | Updates docs and internal variable naming to align with “SDKStats”. |
| src/distro/distro.ts | Updates distro initialization to call renamed SDKStats helper/singleton methods and types. |
| src/azureMonitor/metrics/quickpulse/liveMetrics.ts | Updates live metrics to call setSdkStatsFeatures and renames internal flag variable. |
| src/azureMonitor/index.ts | Renames Azure Monitor helper to getAzureMonitorSdkStatsFeatures and updates docs/types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const originalModuleDefinition = autoLoaderUtils.enableInstrumentations; | ||
|
|
||
| // Parses the enabled instrumentations and then ammends the statsbeat instrumentation environment variable | ||
| // Parses the enabled instrumentations and then ammends the SDK Stats instrumentation environment variable |
Renames internal-only
Statsbeat*enums, interfaces, classes, files, and identifiers toSdkStats*/SDKStats/SDK Statsfor naming consistency throughout the distro. No behavior changes.Renames (internal symbols)
StatsbeatFeature→SdkStatsFeatureStatsbeatInstrumentation→SdkStatsInstrumentationStatsbeatFeatures/StatsbeatFeaturesMap→SdkStatsFeatures/SdkStatsFeaturesMapStatsbeatInstrumentations/StatsbeatInstrumentationMap→SdkStatsInstrumentations/SdkStatsInstrumentationMapStatsbeatOption→SdkStatsOptionStatsbeatEnvironmentConfig→SdkStatsEnvironmentConfigStatsbeatConfiguration(singleton class) →SdkStatsConfigurationsetStatsbeatFeatures→setSdkStatsFeaturesgetAzureMonitorStatsbeatFeatures→getAzureMonitorSdkStatsFeaturesSTATSBEAT_LANGUAGE→SDKSTATS_LANGUAGEstatsbeatExporterModule,statsbeatTypesModule,statsbeatRaw,statsbeatOptionsUpdatedFile renames
src/utils/statsbeat.ts→src/utils/sdkStats.tstest/internal/unit/statsbeat.test.ts→test/internal/unit/sdkStats.test.tstest/internal/unit/azureMonitor/getAzureMonitorStatsbeatFeatures.test.ts→getAzureMonitorSdkStatsFeatures.test.tsComments, JSDoc, and
it(...)descriptions referencingstatsbeatwere updated toSDK Stats/SDKStats.Preserved (external API contracts)
AZURE_MONITOR_STATSBEAT_FEATURES,APPLICATIONINSIGHTS_STATSBEAT_DISABLED_ALL@azure/monitor-opentelemetry-exporter:AzureMonitorStatsbeatExporter,NetworkStatsbeatMetrics,StatsbeatCounter@azure/monitor-opentelemetry-exporter/dist/.../statsbeat/...isStatsbeatExporterexporter flagCHANGELOG.mdhistorical entries left untouchedValidation
npm run build✓npm test✓ (857 passed, 5 todo, 1 skipped)All
Statsbeat*symbols renamed were@internaland not re-exported fromsrc/index.ts, so no public API surface changes.