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

fetchDevices() and update banner telemetry #519

Merged
merged 9 commits into from
Jul 29, 2022
Merged

fetchDevices() and update banner telemetry #519

merged 9 commits into from
Jul 29, 2022

Conversation

shahm5
Copy link
Member

@shahm5 shahm5 commented Jul 28, 2022

Added logging to collect data on the fetchDevices() server call and whether people interact with the update version banner

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Thank you for contributing to the Azure IoT Explorer!

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • If introducing new functionality or modified behavior, are they backed by unit tests?
  • Have all unit tests passed locally? (by running npm run test command)
  • Have you updated the README.md with new screenshots if significant changes have been made?
  • Have you update the package version if the current version in package.json is not higher than the version released?

@shahm5 shahm5 requested a review from YingXue July 28, 2022 23:29
Comment on lines +201 to +209
try {
const response = await request(DATAPLANE_CONTROLLER_ENDPOINT, dataPlaneRequest);
AppInsightsClient.getInstance()?.trackEvent({name: TELEMETRY_EVENTS.FETCH_DEVICES}, {status: response.status.toString(), statusText: response.statusText});
const result = await dataPlaneResponseHelper(response);
return result;
} catch (e) {
AppInsightsClient.getInstance()?.trackEvent({name: TELEMETRY_EVENTS.FETCH_DEVICES}, {status: 'N/A', statusText: e.toString()});
throw (e);
}
Copy link
Member

@c-ryan-k c-ryan-k Jul 28, 2022

Choose a reason for hiding this comment

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

Just a thought for the future -

Seems like this method has use outside of just fetching devices (even though that's the only place it's used for now). Possibly in a future PR we could abstract this to a helper function that takes an endpoint, request, and telemetry type;
export const fetchWithTelemetry(endpoint: string, request: any, telemetryType: {enum_or_telemetry_type_TBD})

Copy link
Member

@YingXue YingXue left a comment

Choose a reason for hiding this comment

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

LGTM. Let's tackle Ryan's comment once we start to add more telemetry in this area which has us from the duplicate imports and implementations.
Also, I am assuming the 'init' event is just for internal use not going to be displayed on any dashboard correct?

@shahm5
Copy link
Member Author

shahm5 commented Jul 29, 2022

Yes, I was originally using the init event to tell when my app refreshed within the log but I'm likely going to repurpose it for some actual one-time logging in the future

@shahm5 shahm5 merged commit 4f17b8e into Azure:main Jul 29, 2022
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.

3 participants