W-20917380 B2C MCP Telemetry#68
Conversation
|
We should move telemetry to under b2c-tooling-sdk so that it can be shared in other packages. telemetry.ts will need to be refactored to move to SDK. Such as:
We also need to think about how to provide the config.json that the caller b2c-dx-mcp need to provide. We probably can generated it during CI/CD under packages/b2c-dx-mcp/config.json |
ef7a38b to
873e507
Compare
|
@allison-grady Please update the PR description to have detailed information and test steps to give review more context and easy to understand the PR. You could reference other PRs such as #63 |
70f5f27 to
79a8874
Compare
67df815 to
895791b
Compare
There was a problem hiding this comment.
Hi @allison-grady I've got some ideas on how we should support this across all packages in this project. I worked this out as a claude plan and given the size I put it in this this gist: https://gist.github.com/clavery/5afe869ccfbfd9d8df34958f7ded07d1
can you @yhsieh1 review that? Happy to talk through it as well. I incorporated some of the smaller comments I made here into it.
Basically I want to pull this back as far as possible:
- Support initialize using our shared BaseCommand
- Leverage oclifs configuration in package.json for package specifics (connection string, etc). This also gives a convenient location if we do want to replace in CI/CD or other places
- Use oclif CLI dataDir function instead of a non-standard directory
- track command life cycle and exceptions in the spot where we are already doing that.
@clavery @allison-grady The gist looks good but I wonder how to prevent local development pollute the production telemetry data? One approach is to disable it by default on local development. We can set SFCC_DISABLE_TELEMETRY=true either in package.json script or override it in dev.js. |
Just set it in dev.js like Allison had (but use our env vars not NODE_ENV; that was my only complaint about that) You can set it in tests/e2e tests as well if it happens to trigger there |
To clarify, this will look like: |
de559f6 to
594ad50
Compare
yhsieh1
left a comment
There was a problem hiding this comment.
It looks good. Thank you!
Summary
Sends telemetry data to verify that tool usage is correctly captured. Modifies the B2C MCP package to send telemetry data to Azure App Insights. Modifies the B2C Tooling package with a reusable telemetry tool.
SDK Operations (b2c-tooling-sdk)
Telemetry Operations:
createTelemetry()- Creates a telemetry instance to allow sending telemetry data logs to Microsoft AzureKey Features
Technical Implementation
Documentation
Testing
Unit Tests
Manual Testing
SFCC_DISABLE_TELEMETRY=false SFCC_APP_INSIGHTS_KEY="{InstrumentationKey=...}" node ./packages/b2c-dx-mcp/bin/dev.js --toolsets SCAPI --allow-non-ga-toolsthen starting and stopping b2c-dx via the Cursor Settings. confirmed events appeared in Azure Application Insights portal
pnpm test)pnpm run format)