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

Send telemetry event when opening a file #1066

Closed
fbricon opened this issue Jun 23, 2021 · 3 comments
Closed

Send telemetry event when opening a file #1066

fbricon opened this issue Jun 23, 2021 · 3 comments
Assignees
Milestone

Comments

@fbricon
Copy link
Contributor

fbricon commented Jun 23, 2021

When a file is opened, a telemetry event should be sent with

  • file extension (.xml, .xsd, .classpath, ...)
  • associated grammar:
    * none/xsd/dtd
    * local/remote
    * schema/grammar URL, if remote

we should be able to understand the popular content. If some schemas are used often that would give us some guidance on priorities.

@rgrunber
Copy link
Contributor

rgrunber commented Jul 23, 2021

Entry point would probably be https://github.com/eclipse/lemminx/blob/master/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLTextDocumentService.java#L531 . From there, one can access the DOMDocument of the document being opened. It already has helper methods.

Would probably need to create a separate (but similar) method since triggerValidation is called for both didOpen & didChange.

@angelozerr
Copy link
Contributor

@mauri-sfdc why are you confused? As @fbricon said, our goal is to give us some guidance on priorities. For instance if we see that :

  • there are a lot of xsl file which is opened, we could improve our basic XSL support.
  • there are a lot of dtd file which is opened, we could improve syntax coloration for DTD and improve DTD support again.
  • there are a lot of XML bound with RelaxNG files, we could start to implement RelaxNG support.

The telemetry will give us those relevant informations.

@angelozerr
Copy link
Contributor

angelozerr commented Jul 29, 2021

To know the referenced grammars, we should get list of ReferencedGrammarInfo from the opened, closed, etc DOM document.

Set<ReferencedGrammarInfo> referencedGrammarInfos = contentModelManager.getReferencedGrammarInfos(document);

See sample at https://github.com/eclipse/lemminx/blob/81298daf1d6aab4a5fd06fab3675affbf8fbff5d/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/participants/ContentModelSymbolsProviderParticipant.java#L73

You can see content of list of ReferencedGrammarInfo in Outline. With list of ReferencedGrammarInfo you will know the list of bound XSD, DTD and for each binding you will know the binding type (catalog, files associations, xsi, doctype, etc) I think binding type is a relevant information too.

As ReferencedGrammarInfo belongs to the contentmodel extension (and not the core), the telemetry which will use ReferencedGrammarInfo must be done in the contentmodel extension.

To track didOpen, didClose, etc in an extension, you can do that with a lifecycle document participant. I created a PR for that in (once #1091

Once this PR will be merged, this issue could be done.

@angelozerr angelozerr added this to the 0.18.0 milestone Jul 29, 2021
rgrunber added a commit to rgrunber/lemminx that referenced this issue Jul 30, 2021
- Resolves eclipse-lemminx#1066
- Report file extensions for didOpen & didClose

Signed-off-by: Roland Grunberg <[email protected]>
rgrunber added a commit to rgrunber/lemminx that referenced this issue Aug 5, 2021
- Resolves eclipse-lemminx#1066
- Report file extensions for didOpen

Signed-off-by: Roland Grunberg <[email protected]>
rgrunber added a commit to rgrunber/lemminx that referenced this issue Aug 6, 2021
- Resolves eclipse-lemminx#1066
- Report file extensions, grammar type, identifier URI, and resolver
  used for didOpen

Signed-off-by: Roland Grunberg <[email protected]>
rgrunber added a commit to rgrunber/lemminx that referenced this issue Aug 9, 2021
- Resolves eclipse-lemminx#1066
- Report file extensions, grammar type, and resolver used for didOpen

Signed-off-by: Roland Grunberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants