-
Notifications
You must be signed in to change notification settings - Fork 535
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
Add app insights #23303
base: main
Are you sure you want to change the base?
Add app insights #23303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can do this in the repo, some of the new deps are not publicly available so it becomes impossible for external contributors to work on docs/. I don't see how we would do this as extra steps in internal pipelines, though 🤔 .
Shoot good point, the wcp-consent code would need to be abstracted. I think the App Insights code can stay though |
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
@@ -85,7 +85,9 @@ function FooterSocialLinks(): JSX.Element { | |||
function FooterPrivacyLinks(): JSX.Element { | |||
return ( | |||
<div className="ffcom-footer-privacy"> | |||
<LinkItem targetUrl="https://privacy.microsoft.com/privacystatement">Privacy</LinkItem> | |||
<LinkItem targetUrl="https://privacy.microsoft.com/privacystatement"> | |||
Privacy and cookies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : 'Privacy Policy' is the common term used for these kinds of links
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saw this requirement in the Privacy review, will confirm with Jade!
docs/src/pages/index.tsx
Outdated
@@ -14,6 +31,7 @@ import { Homepage } from "@site/src/components/home"; | |||
export default function Home(): React.ReactElement { | |||
return ( | |||
<Layout> | |||
<Suspense fallback={<div />}></Suspense> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any loading element we can use here other than just an empty div?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we only expect this to appear during local development, leaving an explicit notice with more details sounds like a good idea to me.
"InstrumentationKey=8bce9107-e3f7-445c-be87-153f7ecbbe47;IngestionEndpoint=https://centralus-2.in.applicationinsights.azure.com/;LiveEndpoint=https://centralus.livediagnostics.monitor.azure.com/;ApplicationId=11a3a32b-28c1-4f28-97fb-4b113a61c1e9", | ||
enableAutoRouteTracking: true, | ||
enableDebug: true, | ||
extensions: [reactPlugin], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the react plugin here looks to give you component level tracking but it looks like you need to use a higher order component for it to work, for example export default withAITracking(reactPlugin, MyComponent);
(see https://www.npmjs.com/package/@microsoft/applicationinsights-react-js)
I'm not sure if enabling this plugin does anything without the use of this higher order component?
@@ -4,3 +4,13 @@ strict-peer-dependencies=true | |||
|
|||
# Disable pnpm update notifications since we use corepack to install package managers | |||
update-notifier=false | |||
|
|||
@wcp:registry=https://1essharedassets.pkgs.visualstudio.com/1esPkgs/_packaging/WebCompliance/npm/registry/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if a user tries to install without the necessary environment variables set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does process.env.<value>
even work here? I thought this was more of a static file, not something that gets executed in a node context. If that's true, what we need is probably docs saying "in order to work with @wcp/wcp-consent
you need to add to your .npmrc
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I didn't know you could do that.
docs/package.json
Outdated
@@ -104,5 +105,12 @@ | |||
"packageManager": "[email protected]+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392", | |||
"engines": { | |||
"node": ">=18.0" | |||
}, | |||
"dependencies": { | |||
"@microsoft/applicationinsights-react-js": "^17.3.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should move under devDependencies
(since this doesn't get published as a library, all of the deps can be dev).
docs/README.md
Outdated
## Optional Packages | ||
|
||
If you would like to include consent management functionality in your local development environment, | ||
you can install the `@wcp/wcp-consent` package. This package is used for handling user consent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend linking to documentation for this library, and then note that it's MS-internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think I'd write all this from the perspective of "This bit is related to the production deployment of the site; if you're doing local development it's probably not relevant to you. If you're a Microsoft engineer who needs to work on this, refer to our internal documentation."
On related topics, using optional-dependencies does seem to work. If our pipelines set up the appropriate npm registries and credentials, the package will get installed when running there, and it'll just be ignored when installing the deps locally.
e4c9cf1
to
346e8b3
Compare
Description
This PR adds user telemetry to the website through the integration of AppInsights
Changes include: