Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

feat(model-apps): enable custom Application Insights telemetry (#879)

Tony Nguyen3a017729c414
diff --git a/plugins/model-apps/AGENTS.md b/plugins/model-apps/AGENTS.md
index e88b7e4fb..5279dbc2d 100644
--- a/plugins/model-apps/AGENTS.md
+++ b/plugins/model-apps/AGENTS.md
@@ -4544,7 +4544,7 @@ Connector authoring no longer has a feature flag (the feature itself is in publi
neither does Custom API support: `custom-api` shipped ON in 2.18.0 and 2.19.0 with its platform
dependencies live in every region, so it was removed — Custom API discovery, authoring and upload
are always available, and `GENPAGE_ENABLE_CUSTOM_API` is ignored. The remaining flags are
-`custom-telemetry` (**OFF**) and `dataverse-operations` (**OFF**).
+`custom-telemetry` (**ON**) and `dataverse-operations` (**OFF**).
- **Source of truth:** `feature-flags.json` (e.g. `{ "dataverse-operations": false }`). Flip a
flag to `true` in a one-line PR once its dependencies are GA in PROD, then remove
@@ -4586,7 +4586,7 @@ only the per-feature specifics are tabled below:
| | `custom-telemetry` | `dataverse-operations` |
|---|---|---|
-| **Committed default** | OFF | OFF (`GENPAGE_ENABLE_DATAVERSE_OPERATIONS=1` opts in) |
+| **Committed default** | ON (`GENPAGE_ENABLE_CUSTOM_TELEMETRY=0` opts out) | OFF (`GENPAGE_ENABLE_DATAVERSE_OPERATIONS=1` opts in) |
| **Owner agent** | none — codegen-only | `genpage-customapi-builder` (the same one writer of `actions.json`) |
| **Plan section** | none — driven by the maker request, not the plan | `## Dataverse Operations` — OPTIONAL; absent means no new built-in operation |
| **Gated scripts** | none | `list-dataverse-operations.js` |
@@ -4623,7 +4623,7 @@ Feature dependencies remain separate from their committed defaults:
live in every region, which is why the `custom-api` flag was removed.
Note the maker-facing name is "Custom API" while the shipped wire contract stays
`actionBindings` / `executeAction` (see `references/custom-api.md`).
-- **`custom-telemetry` (OFF)** — the page telemetry facade in the UCI host runtime, the GenUX
+- **`custom-telemetry` (ON)** — the page telemetry facade in the UCI host runtime, the GenUX
authoring control, the AIBuilder CoderAgent telemetry prompt, and the
`GenUxEnableCustomTelemetry` ECS setting (see `references/page-telemetry.md`).
- **`dataverse-operations` (OFF)** — a host runtime that implements `executeFunction`, the page
diff --git a/plugins/model-apps/CHANGELOG.md b/plugins/model-apps/CHANGELOG.md
index 64fd449c0..b063933e4 100644
--- a/plugins/model-apps/CHANGELOG.md
+++ b/plugins/model-apps/CHANGELOG.md
@@ -5,6 +5,10 @@ All notable changes to the **model-apps** plugin.
Entries are deliberately short: what changed and why it matters to you. The reasoning,
evidence and trade-offs behind a change live in its PR, in `docs/`, or in the linked issue.
+## [Unreleased]
+
+- **Custom page telemetry enabled by default:** `/genpage` can instrument pages with Application Insights when you explicitly ask to measure or track something. Set `GENPAGE_ENABLE_CUSTOM_TELEMETRY=0` to disable it for a run; plugin usage telemetry is unchanged.
+
## [2.28.0]
- **Default configuration creates are sent once (#807):** new configuration rows, children included, have individual requests at stable ids; after a lost answer, builds stop until recovery settles it; teardown and build applies of an app cannot overlap within one workspace.
diff --git a/plugins/model-apps/README.md b/plugins/model-apps/README.md
index 2de44e5a0..81c343be0 100644
--- a/plugins/model-apps/README.md
+++ b/plugins/model-apps/README.md
@@ -41,13 +41,15 @@ no timeout setting, for pages.
## Feature flags (defaults and overrides)
Some capabilities ship **OFF by default** while their cross-repo dependencies roll
-out to production: custom telemetry and built-in Dataverse operation authoring are OFF.
+out to production: built-in Dataverse operation authoring remains OFF. Custom telemetry
+is ON by default, but pages are instrumented only when the maker explicitly asks to
+measure or track something. Set `GENPAGE_ENABLE_CUSTOM_TELEMETRY=0` to disable it for a run.
Flags are catalogued (with lifecycle status) in `scripts/lib/feature-flags.js`; their on/off
value lives in `feature-flags.json` at the plugin root.
| Flag | Status | Default | Enables | Depends on |
|---|---|---|---|---|
-| `custom-telemetry` | in-progress | OFF | A generated page reporting its own events, metrics, traces and exceptions to your Application Insights resource via `props.appInsights` | the page telemetry facade in the UCI host runtime, the GenUX authoring control, the AIBuilder telemetry prompt, and the `GenUxEnableCustomTelemetry` setting — all live in PROD |
+| `custom-telemetry` | in-progress | ON | A generated page reporting its own events, metrics, traces and exceptions to your Application Insights resource via `props.appInsights` | the page telemetry facade in the UCI host runtime, the GenUX authoring control, the AIBuilder telemetry prompt, and the `GenUxEnableCustomTelemetry` setting — all live in PROD |
| `dataverse-operations` | experimental | OFF | Offering two reviewed built-in Dataverse Functions, WhoAmI and RetrieveVersion, as explicitly selected, button-only page calls (`executeFunction`); `scripts/list-dataverse-operations.js` lists them without contacting the environment | a host runtime that implements `executeFunction`, the page `actionBindings` the plugin writes, and the `GenUxPluginActionAllowList` setting; the environment, the page player and the signed-in user's permissions are not checked — see [the built-in operations reference](references/dataverse-operations.md) |
Connector authoring is in **public preview** and no longer has a feature flag. Connector discovery, binding, deploy, and ALM packaging are always available when the required PAC and host capabilities are present.
diff --git a/plugins/model-apps/feature-flags.json b/plugins/model-apps/feature-flags.json
index 878863559..94399a6a9 100644
--- a/plugins/model-apps/feature-flags.json
+++ b/plugins/model-apps/feature-flags.json
@@ -1,5 +1,5 @@
{
- "_comment": "Feature flags for the /genpage skill. Custom telemetry and built-in Dataverse operation authoring are off. Custom API support has no flag: it is always available. Environment overrides take precedence and unknown or missing flags fail closed.",
- "custom-telemetry": false,
+ "_comment": "Feature flags for the /genpage skill. Custom telemetry is on; built-in Dataverse operation authoring is off. Custom API support has no flag: it is always available. Environment overrides take precedence and unknown or missing flags fail closed.",
+ "custom-telemetry": true,
"dataverse-operations": false
}
diff --git a/plugins/model-apps/references/page-telemetry.md b/plugins/model-apps/references/page-telemetry.md
index e8eeffad6..9fcf5d3ef 100644
--- a/plugins/model-apps/references/page-telemetry.md
+++ b/plugins/model-apps/references/page-telemetry.md
@@ -8,7 +8,8 @@ Application Insights resource.
> plugin's `skill_started` usage telemetry (`/model-apps:telemetry`), which
> measures the authoring tool rather than the page.
-**Gated by the default-OFF `custom-telemetry` feature flag.** `genpage-page-builder`
+**Gated by the default-ON `custom-telemetry` feature flag.** Set
+`GENPAGE_ENABLE_CUSTOM_TELEMETRY=0` to disable it for a run. `genpage-page-builder`
reads this file only when its dispatch says `Telemetry: enabled`. With the flag OFF
a generated page contains no telemetry calls at all, exactly as before the feature
existed.
diff --git a/plugins/model-apps/scripts/tests/dataverse-operations-docs.test.js b/plugins/model-apps/scripts/tests/dataverse-operations-docs.test.js
index 8d02452c5..c322eb9c0 100644
--- a/plugins/model-apps/scripts/tests/dataverse-operations-docs.test.js
+++ b/plugins/model-apps/scripts/tests/dataverse-operations-docs.test.js
@@ -115,7 +115,7 @@ test('the page builder emits a button-only call from the reference, only for the
test('AGENTS.md lists the flags left — dataverse-operations OFF with its owner, plan section, gated script and deploy phase — and says Custom API support has none', () => {
const agents = squash(read('AGENTS.md'));
- has(agents, /The remaining flags are `custom-telemetry` \(\*\*OFF\*\*\) and `dataverse-operations` \(\*\*OFF\*\*\)\./);
+ has(agents, /The remaining flags are `custom-telemetry` \(\*\*ON\*\*\) and `dataverse-operations` \(\*\*OFF\*\*\)\./);
has(agents, /neither does Custom API support: `custom-api` shipped ON in 2\.18\.0 and 2\.19\.0 with its platform dependencies live in every region, so it was removed — Custom API discovery, authoring and upload are always available, and `GENPAGE_ENABLE_CUSTOM_API` is ignored\./);
has(agents, /\| \| `custom-telemetry` \| `dataverse-operations` \|/);
assert.ok(!/\| `custom-api` \|/.test(agents), 'the flag table has no custom-api column');
diff --git a/plugins/model-apps/scripts/tests/feature-flags.test.js b/plugins/model-apps/scripts/tests/feature-flags.test.js
index d5489bba9..eb86a3975 100644
--- a/plugins/model-apps/scripts/tests/feature-flags.test.js
+++ b/plugins/model-apps/scripts/tests/feature-flags.test.js
@@ -228,10 +228,10 @@ test('the custom-api flag scan finds a caller planted in any root — a pcf scri
assert.equal(visited.has('plugins/pcf/node_modules/some-package/index.js'), false, 'installed packages are not read');
});
-test('custom-telemetry flag is OFF by default (no env override)', () => {
+test('custom-telemetry flag is ON by default (no env override)', () => {
// custom-telemetry has no helper of its own (it gates code generation, not scripts), so
// the generic probe is the contract the skill markdown actually calls.
- assert.equal(isEnabled('custom-telemetry', { env: {} }), false);
+ assert.equal(isEnabled('custom-telemetry', { env: {} }), true);
});
test('unknown flags are OFF (fail-closed)', () => {
@@ -287,15 +287,26 @@ test('parseBool recognizes common truthy/falsey tokens, defers otherwise', () =>
// --- Committed config keeps each feature's own default ---------------------
-test('committed feature-flags.json ships custom-telemetry: false', () => {
+test('committed feature-flags.json ships custom-telemetry: true', () => {
const json = JSON.parse(
fs.readFileSync(path.join(__dirname, '..', '..', 'feature-flags.json'), 'utf8')
);
- assert.equal(json['custom-telemetry'], false);
+ assert.equal(json['custom-telemetry'], true);
});
// --- CLI probe (deterministic gate for the skill markdown) ------------------
+test('CLI prints "enabled" and exits 0 by default without an env override', () => {
+ const env = { ...process.env };
+ delete env.GENPAGE_ENABLE_CUSTOM_TELEMETRY;
+ const res = spawnSync(process.execPath, [libPath, 'custom-telemetry'], {
+ encoding: 'utf8',
+ env,
+ });
+ assert.equal(res.status, 0, res.stderr);
+ assert.equal(res.stdout, 'enabled\n');
+});
+
test('CLI prints "disabled" and exits 1 for an explicit opt-out', () => {
const res = spawnSync(process.execPath, [libPath, 'custom-telemetry'], {
encoding: 'utf8',