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

Ersuo/adding send status telemetry #4631

Merged
merged 13 commits into from
Feb 13, 2023

Conversation

Erli-ms
Copy link
Contributor

@Erli-ms Erli-ms commented Feb 1, 2023

Related to #4500.

Changelog Entry

  • Added function to emit status change telemetry event for activities, by @Erli-ms, in PR #4631

Description

Added an ActivityStatusTelemetryComposer inside of ActivitySendStatusComposer. Whenever the activity status changes, the ActivityStatusTelemetryComposer collects the map of concerned activities and triggers trackEvent to emit the event. Consumers of the events can react accordingly. This feature is requested by D365 OmniChannel team.

Design

Added a new provider to look at send status of every activity. Whenever send status of any activities changed, it will call onTelemetry event to fire its changes.

Specific Changes

  • packages/api/src/providers/ActivitySendStatusTelemetry/ActivitySendStatusTelemetryComposer.tsx
    • creating a new composer triggered whenever the control got re-rendered.
    • collect the activities which status changed
    • invoke trackEvent to emit the event to the telemetry logger
    • { status, prevStatus, ClientActivityID, type, hasAttachment, key} is emitted to the telemetry logger
  • packages/api/src/hooks/Composer.tsx
    • added the ActivitySendStatusTelemetryComposer as a children component to ActivitySendStatusComposer
  • tests/html/activityStatusTelemetry.sendingToSendFailed.html
    • added test to verify expected event been emitted with the activity status changed from 'sending' to 'send failed'
  • tests/html/activityStatusTelemetry.sendingToSendFailedToSent.html
    • added test to verify expected event been emitted with the activity status changed from 'sending' to 'send failed' and from 'send failed' to 'sent'
  • tests/html/activityStatusTelemetry.sendingToSent.html
    • added test to verify expected event been emitted with the activity status changed from 'sending' to 'sent'
  • tests/html/activityStatusTelemetry.sendFiles.attachmentUrl.sendingToSent.html
    • added test to verify expected event been emitted with when attachment activity status changed from 'sending' to 'sent'
  • tests/html/activityStatusTelemetry.ignoreStatusChange.incomingActivity.html
    • added test to verify incoming activity does not emit any status change event

-

  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Copy link
Contributor

@compulim compulim left a comment

Choose a reason for hiding this comment

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

Notes:

  • Think if we need these in another PR:
    • In addition to TelemetryPayload.type: 'event' | 'message' | ..., should we also have something to tell if this is a ImBack/PostBack/MessageBack?
    • We should export the type, via botframework-webchat-api/index.ts so others know and can expect what we are sending out
      • We have 2-3 events that is already in Web Chat today, we will also need to type them out too... so in another PR or I can do it

@compulim
Copy link
Contributor

I ran tests locally/manually. Everything looks good.

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.

2 participants