Skip to content
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

Added customTelemetry subcapability under copilot #2654

Merged
merged 16 commits into from
Jan 9, 2025
Merged

Added customTelemetry subcapability under copilot #2654

merged 16 commits into from
Jan 9, 2025

Conversation

ndangudubiyyam
Copy link
Contributor

For more information about how to contribute to this repo, visit this page.

Description

Enable the Copilot app to send custom telemetry data to host apps for tracking UI element loads within Biz Chat.

If this Pull Request should close/resolve any issues when merged, use the special syntax for that here.

Main changes in the PR:

  1. Added a sub capability under copilot called customTelemetry.sendCustomTelemetryData()
  2. Export the above capability in copilot.ts file.

Validation

Validation performed:

  1. Added Unit tests
  2. Added UI validation to test app

Unit Tests added:

Unit tests are required for all changes. If no unit tests were added as part of this change, please explain why they aren't necessary.

<Yes/No>

End-to-end tests added:

No

Additional Requirements

Change file added: Yes

  • Item 1
  • Item 2

Screenshots:

Remove this section if n/a

Before After
< image1 > < image2 >

@ndangudubiyyam ndangudubiyyam requested a review from a team as a code owner December 10, 2024 08:58
Copy link
Contributor

This pull request contains changes to the runtime.ts file. If you, as the author of this PR, have made changes to the Runtime interface please review RUNTIME.md to determine if a new runtime version is required. Please reply to this comment stating what changes, if any, were made to the runtime object and whether a new runtime version was required.

@ndangudubiyyam ndangudubiyyam changed the title Add customTelemetryData sub capability under copilot Added customTelemetry subcapability under copilot Dec 10, 2024
…e.json

Co-authored-by: Erin <erinha@microsoft.com>
* @beta
*/
export function sendCustomTelemetryData(
name: Stage = Stage.STAGE_E,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer that this was a UUID instead of an enum for a few reasons:

  • If we use an enum, any time a new stage is added the enum will have to be updated
  • If they want to gather telemetry for something that is not stage related, we will need to update this

A UUID will allow them to pass in any UUID they want and define what it means for themselves. It also ensures that they don't inadvertently pass personal information that can't be added to telemetry in because we will validate that the UUID is a UUID and not an arbitrary string.

Copy link
Contributor

@erinha erinha Dec 11, 2024

Choose a reason for hiding this comment

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

I could be misunderstanding, but Copilot and the host would communicate which UUID means what so they can correlate it and understand what the timestamp represents.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the meaning of the name isn't strictly relevant to the SDK, this allows the app and host to work together to define well-understood values that they can use to correlate any type of timestamp data in a meaningful way, without having to make SDK updates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TrevorJoelHarris I have updated the PR with the changes. Please take a look and let me know if that is the correct way.

erinha
erinha previously approved these changes Jan 8, 2025
@erinha erinha dismissed their stale review January 8, 2025 16:39

Approved too early. I'm still waiting for a reply to one of my comments.

@@ -1,2 +1,3 @@
export * from './private/index';
export * from './public/index';
export { UUID } from './internal/uuidObject';
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't exporting this internal function defeat the purpose of it being internal? Should we consider moving this function to public instead?

@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added `customTelemetry` capability under `copilot` to send app loading data to the host. The capability is still awaiting support in one or most host applications. To track availability of this capability across different hosts see https://aka.ms/capmatrix",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"comment": "Added `customTelemetry` capability under `copilot` to send app loading data to the host. The capability is still awaiting support in one or most host applications. To track availability of this capability across different hosts see https://aka.ms/capmatrix",
"comment": "Added `customTelemetry` capability under `copilot` to send app loading data to the host",

@AE-MS
Copy link
Contributor

AE-MS commented Jan 8, 2025

Can you say more about why we need this as the default export? Is exporting the class above enough?

Default exports are generally a bad idea in JavaScript and using them has caused bugs in the host SDK.


Refers to: packages/teams-js/src/internal/uuidObject.ts:33 in 90ca82b. [](commit_id = 90ca82b, deletion_comment = False)

Copy link
Contributor

@AE-MS AE-MS left a comment

Choose a reason for hiding this comment

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

🕐

@erinha
Copy link
Contributor

erinha commented Jan 8, 2025

Moving the uuidObject.ts file to the public folder in this PR: #2671

So we can use it in this PR correctly.

@erinha
Copy link
Contributor

erinha commented Jan 8, 2025

Can you say more about why we need this as the default export? Is exporting the class above enough?

Default exports are generally a bad idea in JavaScript and using them has caused bugs in the host SDK.

Refers to: packages/teams-js/src/internal/uuidObject.ts:33 in 90ca82b. [](commit_id = 90ca82b, deletion_comment = False)

Looks like the default export line can be removed and it will still compile fine.

Copy link
Contributor

@AE-MS AE-MS left a comment

Choose a reason for hiding this comment

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

:shipit:

@AE-MS AE-MS merged commit 9d97f75 into main Jan 9, 2025
40 checks passed
@AE-MS AE-MS deleted the niha/stageE branch January 9, 2025 16:24
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.

6 participants