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 PredefinedCode{Fix,Refactor}ProviderNames to CodeAction.CustomTags to identify analyzers\fixers for telemetry #4919

Closed
srivatsn opened this issue Sep 1, 2015 · 11 comments · Fixed by #60480
Assignees
Milestone

Comments

@srivatsn
Copy link
Contributor

srivatsn commented Sep 1, 2015

We currently create a separate code action for every fixer to identify the fixer for telemetry. We need a different mechanism so that people can just use CodeAction.Create

@heejaechang
Copy link
Contributor

right now there is nothing that can be used to distinguish code actions except type name. unless we want to add a public field for it, not sure what we can do.

@heejaechang
Copy link
Contributor

we need design change. there is no info we can use right now. moving it out of update 1

@heejaechang heejaechang modified the milestones: 1.1, Unknown Sep 16, 2015
@heejaechang
Copy link
Contributor

one idea from @mavasani

we can log fixer's type name + equivalence key (if there is one)

this actually change semantic of what we log - basically rather than which code action, it will log which fixer has invoked. also, if equivalence key is different for same code action based on which context, then what we log is not which codeaction but codeaction + context.

so, this does change semantic slightly, but we can get rid of those wrapper type just to get type name of code action.

@ghost ghost added this to the Unknown milestone Sep 21, 2015
@heejaechang
Copy link
Contributor

@kuhlenh I am thinking changing id we report for fixer, will that be a problem? @olegtk are you guys ready on new API reporting data as string if its our LB?

@kuhlenh
Copy link

kuhlenh commented Mar 6, 2017

@heejaechang if we can report it as a string and use the actual name, I am 100% on board with any changes.

fyi @CyrusNajmabadi

@olegtk
Copy link
Contributor

olegtk commented Mar 7, 2017

We were meant to file a bug on that, but I'd suggest you do so as partner team request weighs more.

@heejaechang
Copy link
Contributor

@olegtk what is the path to file a bug?

@olegtk
Copy link
Contributor

olegtk commented Mar 7, 2017

DevDiv\VS Platform\VS IDE\Editor\LightBulb

@mavasani
Copy link
Contributor

@heejaechang @olegtk Is this implemented? Can you please share the external bug ID? We would like to clean up the fixers in roslyn-analyzers repo once this is done.

@nschuessler
Copy link
Contributor

@heejaechang where can the logs for the fixers be found?

@TanayParikh
Copy link
Contributor

Re-purposing this issue to cover the discussed solution (Add PredefinedCode{Fix,Refactor}ProviderNames to CodeAction.CustomTags). Thanks @mavasani

@TanayParikh TanayParikh changed the title Dont use type names to identify analyzers\fixers for telemetry Add PredefinedCode{Fix,Refactor}ProviderNames to CodeAction.CustomTags to identify analyzers\fixers for telemetry Jan 5, 2021
mavasani added a commit to mavasani/roslyn that referenced this issue Mar 30, 2022
…ted through CodeAction.Create factory methods

Fixes dotnet#4919
Currently, we always use the CodeAction's full type name to generate the telemetry ID to log for applied code actions. This is reasonable for special CodeActions that sub-type the CodeAction type and have custom logic. However, majority of fixers and refactorings do not need special CodeAction sub-type and can/should use the CodeAction.Create factory methods to create the code actions to register. Until now, these providers were forced to create a dummy nested type (generally named MyCodeAction) and use it to allow telemetry to capture the outer type's full type name.

With this change, we now keep track of whether a CodeAction was created with a factory method or not. If it was created with a factory method, then we use the registering fixer/refactoring provider's full type name for telemetry. Otherwise, we use the CodeAction's full type name. Additionally, we also append the EquivalenceKey in the telemetry ID in both the cases, which should allow multiple code actions registered by the same fixer/refactoring to be differentiated.

NOTE: I will create a follow-up PRs in both Roslyn and Roslyn-Analyzers repos to delete all the stub MyCodeAction types once this goes in.
mavasani added a commit to mavasani/roslyn that referenced this issue Mar 30, 2022
…ted through CodeAction.Create factory methods

Fixes dotnet#4919
Currently, we always use the CodeAction's full type name to generate the telemetry ID to log for applied code actions. This is reasonable for special CodeActions that sub-type the CodeAction type and have custom logic. However, majority of fixers and refactorings do not need special CodeAction sub-type and can/should use the CodeAction.Create factory methods to create the code actions to register. Until now, these providers were forced to create a dummy nested type (generally named MyCodeAction) and use it to allow telemetry to capture the outer type's full type name.

With this change, we now keep track of whether a CodeAction was created with a factory method or not. If it was created with a factory method, then we use the registering fixer/refactoring provider's full type name for telemetry. Otherwise, we use the CodeAction's full type name. Additionally, we also append the EquivalenceKey in the telemetry ID in both the cases, which should allow multiple code actions registered by the same fixer/refactoring to be differentiated.

NOTE: I will create a follow-up PRs in both Roslyn and Roslyn-Analyzers repos to delete all the stub MyCodeAction types once this goes in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants