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

Add ReplacementOptions to filter telemetry events #93

Merged
merged 2 commits into from
Apr 5, 2022

Conversation

aeisenberg
Copy link
Contributor

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.

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.
@aeisenberg
Copy link
Contributor Author

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.

@lramos15
Copy link
Member

lramos15 commented Apr 4, 2022

Thanks for looking into this.

Note that this only adds replacements for node clients as I did not
see an easy way to implement the same in web clients.

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.

However, I do not know how to regenerate the typings appropriately.

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

it is necessary to add this to the windows client

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.
@aeisenberg
Copy link
Contributor Author

New commit addresses your questions and concerns.

Do you mean web client here?

Uh...yes. :)

Copy link
Member

@lramos15 lramos15 left a 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 :)

@aeisenberg
Copy link
Contributor Author

Thanks @lramos15 for helping with redesigning the feature.

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.

Add option to remove location data from telemetry events
2 participants