Add OpenTelemetry tracing to EditorServiceManager and formatting#104
Add OpenTelemetry tracing to EditorServiceManager and formatting#104davo-canva wants to merge 2 commits intodprint:mainfrom
Conversation
Extended EditorServiceManager and related classes with OpenTelemetry spans to track performance and debug issues effectively. Applied spans to key methods, such as service initialization, formatting, and cache priming, to capture execution details and errors comprehensively.
| ) { | ||
| private var formattingIds = mutableListOf<Int>() | ||
| private var isCancelled = false | ||
| private val tracer: Tracer = TelemetryManager.getInstance().getTracer(DprintScope.FormatterScope) |
There was a problem hiding this comment.
TelemetryManager is technically annotated as internal API, but AFAICT the API hasn't really changed 🤷
There was a problem hiding this comment.
It should be fine and there is a IJ verify gradle task that makes sure it works with the configured IJ versions in the verifier
There was a problem hiding this comment.
Looking at the build, this blows up.
| } else { | ||
| mutableListOf( | ||
| TextRange(0, content.length), | ||
| val rootSpan = |
There was a problem hiding this comment.
Just as an FYI this class is only run for the replacement of the default IJ formatter. So when you run shift+cmd+option+L or whatever it is.
You probably want to have something that wraps the lower level activities that are shared between this and the code which runs if the user has configured format on save through the dprint config window. I believe that is the EditorServiceManager or the Process depending on what you want to capture in OTEL.
This is pretty gnarly, but chucking this up to get feedback. This uses IntelliJ's OpenTelemetry tracing support. The hard yards was authored by JetBrains AI Assistant with Claude 3.7 Sonnet.
You'll probably want to review this with "hide whitespace changes" on.
Happy to rename the spans if anyone has good suggestions.
The below description was generated by JetBrains AI Assistant:
Extended EditorServiceManager and related classes with OpenTelemetry spans to track performance and debug issues effectively. Applied spans to key methods, such as service initialization, formatting, and cache priming, to capture execution details and errors comprehensively.