Skip to content

Add CfgSync documentation#2721

Open
Copilot wants to merge 3 commits intomainfrom
copilot/add-documentation-for-cfgsync
Open

Add CfgSync documentation#2721
Copilot wants to merge 3 commits intomainfrom
copilot/add-documentation-for-cfgsync

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

The CfgSync plugin lacked getting-started documentation.

Documentation

  • extensions/applicationinsights-cfgsync-js/README.md: Added "Getting Started" section with install instructions, usage examples for all three sync modes (Broadcast, Receive, CDN fetch), and a Plugin API method reference table. Fixed typo ("mutiple" → "multiple").
  • examples/README.md: Added CfgSync example to the examples index.

Example: Broadcast + Receive setup (now documented)

// Broadcaster
const broadcaster = new CfgSyncPlugin();
new ApplicationInsights({
    config: {
        connectionString: "InstrumentationKey=MAIN",
        extensions: [broadcaster],
        extensionConfig: {
            [broadcaster.identifier]: { syncMode: ICfgSyncMode.Broadcast } as ICfgSyncConfig
        }
    }
}).loadAppInsights();

// Receiver — protects its own connection string from being overwritten
const receiver = new CfgSyncPlugin();
new ApplicationInsights({
    config: {
        connectionString: "InstrumentationKey=LISTENER",
        extensions: [receiver],
        extensionConfig: {
            [receiver.identifier]: {
                syncMode: ICfgSyncMode.Receive,
                nonOverrideConfigs: { connectionString: true, instrumentationKey: true, endpointUrl: true }
            } as ICfgSyncConfig
        }
    }
}).loadAppInsights();

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

- Remove private npm packages from examples/cfgSync/package.json that
  are not publicly available (@microsoft/applicationinsights-rollup-plugin-uglify3-js
  and @microsoft/ai-test-framework)
- Update examples/cfgSync/rollup.config.js to remove the uglify import
  and unused production build code that relied on the private package
- Add cfgSync example link to examples/README.md
- Enhance extensions/applicationinsights-cfgsync-js/README.md with
  Getting Started section, installation instructions, usage examples
  for all sync modes, and Plugin API reference table

Agent-Logs-Url: https://github.com/microsoft/ApplicationInsights-JS/sessions/bdf4fd03-d85c-4946-9b0c-d93f9be312a2

Co-authored-by: MSNev <54870357+MSNev@users.noreply.github.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI changed the title [WIP] Add documentation for CFGSync and fix example project Add CfgSync documentation and fix example build with private npm deps Apr 8, 2026
Copilot AI requested a review from MSNev April 8, 2026 19:30
Copilot finished work on behalf of MSNev April 8, 2026 19:30
"license": "MIT",
"sideEffects": false,
"devDependencies": {
"@microsoft/ai-test-framework": "0.0.1",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot leave the build pipeline alone as there are downstream (non-visible) release pipelines that require these to exist

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in e944413package.json and rollup.config.js are restored to their original state.

})
}

const browserRollupConfigFactory = (name, isProduction, format = "umd", extension = "") => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot leave the build pipeline alone as there are downstream (non-visible) release pipelines that require these to exist

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in e944413 — both build pipeline files are restored to their original state.

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI changed the title Add CfgSync documentation and fix example build with private npm deps Add CfgSync documentation Apr 8, 2026
Copilot finished work on behalf of MSNev April 8, 2026 21:08
Copilot AI requested a review from MSNev April 8, 2026 21:08
@MSNev MSNev marked this pull request as ready for review April 8, 2026 21:42
@MSNev MSNev requested a review from a team as a code owner April 8, 2026 21:42
Copilot AI review requested due to automatic review settings April 8, 2026 21:42
@MSNev MSNev enabled auto-merge (squash) April 8, 2026 21:42
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

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 getting-started documentation for the CfgSync plugin and links the new example from the examples index.

Changes:

  • Added installation + usage docs (Broadcast, Receive, CDN fetch) and a Plugin API reference table to the CfgSync README
  • Fixed documentation typos/wording in the CfgSync README
  • Added CfgSync example link to the examples index

Reviewed changes

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

File Description
extensions/applicationinsights-cfgsync-js/README.md Adds “Getting Started” guidance and an API reference section for CfgSync
examples/README.md Adds CfgSync entry to the examples list

Comment on lines +109 to +116
| Method | Description |
|--------|-------------|
| `getCfg()` | Returns the current configuration of this instance. |
| `setCfg(config)` | Manually sets the configuration of this instance. Returns `true` on success. |
| `sync(customDetails?)` | Manually broadcasts the current configuration to all listener instances. Returns `true` on success. |
| `pause()` | Pauses the scheduled CDN fetch timer. |
| `resume()` | Resumes the scheduled CDN fetch timer. |
| `updateEventListenerName(eventName?)` | Updates the custom event name used to broadcast/receive configuration changes. |
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The Plugin API markdown table uses || at the start of each row, which GitHub Markdown interprets as an extra empty column (or can render incorrectly). Please switch this to standard table formatting (single leading pipe, or no leading/trailing pipes consistently), e.g. | Method | Description | with | --- | --- |.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +25
The CfgSync Plugin supports three synchronization modes:

- **Broadcast** (default): The instance broadcasts its configuration changes to other instances.
- **Receive**: The instance only receives configuration changes from broadcasting instances.
- **None**: The instance neither broadcasts nor receives configuration changes.
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

This section documents three modes including None, but the rest of the Getting Started examples only demonstrate Broadcast/Receive/CDN fetch. To avoid leaving readers without guidance, either add a short snippet showing how to configure syncMode: ICfgSyncMode.None, or remove the None bullet from this introductory list.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No documentation on CFGSync and example can't be built

3 participants