-
Notifications
You must be signed in to change notification settings - Fork 46
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 ReplacementOptions to filter telemetry events #93
Conversation
For node application insights clients, there is a new constructor parameter that allows users to pass a list of replacement options. Each option includes a lookup regular expression and a replacement string. For each key in the base data or the envelope that matches the lookup, the value will be replaced with the associated string. If the value is undefined, then the key will be deleted. Note that this only adds replacements for node clients as I did not see an easy way to implement the same in web clients.
Please let me know if you think it is necessary to add this to the windows client and I can look deeper on how to do it, but I do not have an application that uses the windows client, so it will be hard for me to test. |
Thanks for looking into this.
Even if we cannot add a telemetry processor we should be able to do the replacement within the custom data that everyone sends through the web client. We definitely want parity of both clients because extensions depend on the module without knowledge of being in the web or not.
Due to the small amount of typings they're all handwritten at the moment for the module. So just updating the .d.ts file should be enough
Do you mean web client here? |
Uses the same mechanism as implemented for node. This change also moves the shared logic to `utils.ts` and the shared interface to `baseTelemetryReporter.ts`. It updates the typings file appropriately.
New commit addresses your questions and concerns.
Uh...yes. :) |
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.
This looks great 👍 , glad we could finally get your feature request in after 2 years :)
Thanks @lramos15 for helping with redesigning the feature. |
For node application insights clients, there is a new constructor
parameter that allows users to pass a list of replacement options.
Each option includes a lookup regular expression and a replacement
string.
For each key in the base data or the envelope that matches the
lookup, the value will be replaced with the associated string. If
the value is undefined, then the key will be deleted.
Note that this only adds replacements for node clients as I did not
see an easy way to implement the same in web clients.
Fixes #55
I have tested this in my own application and it is behaving as expected. However, I do not know how to regenerate the typings appropriately. Also, I still need to update some documentation to describe the new behaviour.