From 1717e12ce423f4fea7ce18a5ebe3a6353ec7572a Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 31 Jan 2022 23:32:10 -0500 Subject: [PATCH 001/115] protocol update --- .../sourcemarker/status/LogStatusBar.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index 9773078d1..bd77a3853 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -25,7 +25,6 @@ import spp.jetbrains.sourcemarker.service.log.LogHitColumnInfo; import spp.jetbrains.sourcemarker.settings.LiveLogConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; -import spp.protocol.SourceMarkerServices; import spp.protocol.artifact.log.Log; import spp.protocol.instrument.InstrumentThrottle; import spp.protocol.instrument.LiveInstrument; @@ -34,7 +33,6 @@ import spp.protocol.instrument.ThrottleStep; import spp.protocol.instrument.log.LiveLog; import spp.protocol.instrument.log.event.LiveLogRemoved; -import spp.protocol.service.live.LiveInstrumentService; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -58,7 +56,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; @@ -67,7 +64,6 @@ import java.util.stream.Collectors; import static spp.jetbrains.marker.SourceMarker.conditionParser; -import static spp.jetbrains.sourcemarker.PluginUI.BGND_FOCUS_COLOR; import static spp.jetbrains.sourcemarker.PluginUI.CNFG_PANEL_BGND_COLOR; import static spp.jetbrains.sourcemarker.PluginUI.CNFG_PANEL_FOCUS_COLOR; import static spp.jetbrains.sourcemarker.PluginUI.COMPLETE_COLOR_PURPLE; @@ -77,6 +73,7 @@ import static spp.jetbrains.sourcemarker.PluginUI.STATUS_BAR_TXT_BG_COLOR; import static spp.jetbrains.sourcemarker.PluginUI.DFLT_BGND_COLOR; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; import static spp.protocol.instrument.LiveInstrumentEventType.LOG_HIT; import static spp.protocol.instrument.LiveInstrumentEventType.LOG_REMOVED; @@ -195,7 +192,7 @@ public void setLatestLog(Instant time, Log latestLog) { this.latestLog = latestLog; String formattedTime = time.atZone(ZoneId.systemDefault()).format(TIME_FORMATTER); - String formattedMessage = latestLog.getFormattedMessage(); + String formattedMessage = latestLog.toFormattedMessage(); if (!timeLabel.getText().equals(formattedTime) || !liveLogTextField.getText().equals(formattedMessage)) { SwingUtilities.invokeLater(() -> { if (liveLogTextField.getEditMode()) { @@ -562,7 +559,7 @@ private void saveLiveLog() { latestTime = null; latestLog = null; - SourceMarkerServices.Instance.INSTANCE.getLiveInstrument().removeLiveInstrument(oldLiveLog.getId(), it -> { + INSTANCE.getLiveInstrument().removeLiveInstrument(oldLiveLog.getId()).onComplete(it -> { if (it.succeeded()) { LiveStatusManager.INSTANCE.removeActiveLiveInstrument(oldLiveLog); } else { @@ -598,7 +595,6 @@ private void saveLiveLog() { HashMap meta = new HashMap<>(); meta.put("original_source_mark", inlayMark.getId()); - LiveInstrumentService instrumentService = Objects.requireNonNull(SourceMarkerServices.Instance.INSTANCE.getLiveInstrument()); LiveLog instrument = new LiveLog( finalLogPattern, resp.second.stream().map(it -> it.substring(1)).collect(Collectors.toList()), @@ -621,7 +617,7 @@ private void saveLiveLog() { displayTimeField(); wrapper.grabFocus(); - instrumentService.addLiveInstrument(instrument, it -> { + INSTANCE.getLiveInstrument().addLiveInstrument(instrument).onComplete(it -> { if (it.succeeded()) { liveLog = (LiveLog) it.result(); inlayMark.putUserData(SourceMarkKeys.INSTANCE.getLOG_ID(), it.result().getId()); @@ -646,7 +642,7 @@ private void dispose() { inlayMark.dispose(true); if (liveLog != null) { - SourceMarkerServices.Instance.INSTANCE.getLiveInstrument().removeLiveInstrument(liveLog.getId(), it -> { + INSTANCE.getLiveInstrument().removeLiveInstrument(liveLog.getId()).onComplete(it -> { if (it.succeeded()) { LiveStatusManager.INSTANCE.removeActiveLiveInstrument(liveLog); } else { From 426b2c3991f0fef815d4e78da04420184d10cce9 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 31 Jan 2022 23:37:46 -0500 Subject: [PATCH 002/115] bump --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a54f33148..72a6882c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official pluginGroup = spp.jetbrains pluginName = Source++ -projectVersion=0.3.0 +projectVersion=0.3.1 pluginSinceBuild = 202.4357 # Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl # See https://jb.gg/intellij-platform-builds-list for available build versions From 2309c7d777b16db12d4dd90ea04087d16882e836 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 00:23:42 -0500 Subject: [PATCH 003/115] refactor --- .../sourcemarker/discover/TCPServiceDiscoveryBackend.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 77accb813..367ba3b99 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -42,11 +42,10 @@ import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.settings.isSsl import spp.jetbrains.sourcemarker.settings.serviceHostNormalized -import spp.protocol.SourceMarkerServices import spp.protocol.SourceMarkerServices.Utilize import spp.protocol.extend.TCPServiceFrameParser import spp.protocol.platform.PlatformAddress -import spp.protocol.status.MarkerConnection +import spp.protocol.status.InstanceConnection import java.util.* /** @@ -123,12 +122,11 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { setupHandler(vertx, Utilize.LIVE_SERVICE) setupHandler(vertx, Utilize.LIVE_INSTRUMENT) setupHandler(vertx, Utilize.LIVE_VIEW) - setupHandler(vertx, Utilize.LOCAL_TRACING) setupHandler(vertx, Utilize.LOG_COUNT_INDICATOR) //setup connection val replyAddress = UUID.randomUUID().toString() - val pc = MarkerConnection(SourceMarkerPlugin.INSTANCE_ID, System.currentTimeMillis()) + val pc = InstanceConnection(SourceMarkerPlugin.INSTANCE_ID, System.currentTimeMillis()) val consumer: MessageConsumer = vertx.eventBus().localConsumer("local.$replyAddress") val promise = Promise.promise() From 97c9f98c1e630c39b4f75600e9bd2781754e8dd5 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 10:47:04 -0500 Subject: [PATCH 004/115] refactor --- .../command/ControlBarController.kt | 33 ++++++++++++++----- .../command/LiveControlCommand.kt | 6 ++++ .../service/LiveInstrumentManager.kt | 2 +- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt index 7dc1ebdea..2b8a2fc0c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt @@ -21,7 +21,6 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.editor.Editor import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiDocumentManager -import io.vertx.core.Promise import io.vertx.kotlin.coroutines.await import kotlinx.coroutines.runBlocking import org.slf4j.LoggerFactory @@ -41,7 +40,7 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.SetCurrentPage import spp.protocol.SourceMarkerServices -import spp.protocol.developer.SelfInfo +import spp.protocol.instrument.LiveInstrumentType.* import spp.protocol.portal.PageType import java.awt.BorderLayout import javax.swing.JComponent @@ -59,9 +58,7 @@ object ControlBarController { private var previousControlBar: InlayMark? = null private val availableCommands by lazy { runBlocking { - val future = Promise.promise() - SourceMarkerServices.Instance.liveService!!.getSelf(future) - val selfInfo = future.future().await() + val selfInfo = SourceMarkerServices.Instance.liveService!!.getSelf().await() LiveControlCommand.values().toList().filter { @Suppress("UselessCallOnCollection") //unknown enums are null selfInfo.permissions.filterNotNull().map { it.name }.contains(it.name) @@ -119,7 +116,7 @@ object ControlBarController { previousControlBar!!.dispose() previousControlBar = null - SourceMarkerServices.Instance.liveInstrument!!.clearLiveBreakpoints { + SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(BREAKPOINT).onComplete { if (it.failed()) { log.error("Failed to clear live breakpoints", it.cause()) } @@ -129,17 +126,37 @@ object ControlBarController { previousControlBar!!.dispose() previousControlBar = null - SourceMarkerServices.Instance.liveInstrument!!.clearLiveLogs { + SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(LOG).onComplete { if (it.failed()) { log.error("Failed to clear live logs", it.cause()) } } } + CLEAR_LIVE_METERS.command -> { + previousControlBar!!.dispose() + previousControlBar = null + + SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(METER).onComplete { + if (it.failed()) { + log.error("Failed to clear live meters", it.cause()) + } + } + } + CLEAR_LIVE_SPANS.command -> { + previousControlBar!!.dispose() + previousControlBar = null + + SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(SPAN).onComplete { + if (it.failed()) { + log.error("Failed to clear live spans", it.cause()) + } + } + } CLEAR_LIVE_INSTRUMENTS.command -> { previousControlBar!!.dispose() previousControlBar = null - SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments { + SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(null).onComplete { if (it.failed()) { log.error("Failed to clear live instruments", it.cause()) } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt index 70682babf..e24fc939b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt @@ -107,6 +107,12 @@ enum class LiveControlCommand( "Clear all self-created live meters", PluginIcons.Command.clearInstrumentSelected, PluginIcons.Command.clearInstrumentUnSelected + ), + CLEAR_LIVE_SPANS( + "Clear Spans", + "Clear all self-created live spans", + PluginIcons.Command.clearInstrumentSelected, + PluginIcons.Command.clearInstrumentUnSelected ); override fun getText(): String { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 7371c8674..8b7ab2005 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -87,7 +87,7 @@ class LiveInstrumentManager(private val project: Project) : CoroutineVerticle() ) //show live status bars - Instance.liveInstrument!!.getLiveInstruments { + Instance.liveInstrument!!.getLiveInstruments(null).onComplete { if (it.succeeded()) { log.info("Found {} active live status bars", it.result().size) LiveStatusManager.addActiveLiveInstruments(it.result()) From cf5bd2813d5a3849dc9079c953d0998b10cd12cf Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 11:18:51 -0500 Subject: [PATCH 005/115] refactor --- .../marker/jvm/psi/PluginSqlProducerSearch.kt | 136 --------------- .../jvm/psi/sqlsource/SpringDataSqlSource.kt | 76 -------- .../settings/PluginConfigurationPanel.java | 2 +- .../status/BreakpointStatusBar.java | 9 +- .../status/LiveMeterStatusPanel.java | 4 +- .../sourcemarker/status/MeterStatusBar.java | 8 +- .../sourcemarker/status/SpanStatusBar.java | 8 +- .../sourcemarker/SourceMarkerPlugin.kt | 16 -- .../sourcemarker/icons/SourceMarkerIcons.kt | 11 -- .../listeners/ArtifactAdviceListener.kt | 123 ------------- .../PluginSourceMarkEventListener.kt | 2 - .../listeners/PortalEventListener.kt | 65 +------ .../mark/SourceMarkConstructor.kt | 162 ------------------ .../sourcemarker/mark/SourceMarkKeys.kt | 2 - .../service/LogCountIndicators.kt | 2 +- .../service/log/LogHitColumnInfo.kt | 2 +- .../sourcemarker/status/LiveStatusManager.kt | 9 +- .../jetbrains/StandaloneActivityLiveView.kt | 11 +- 18 files changed, 28 insertions(+), 620 deletions(-) delete mode 100644 marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/PluginSqlProducerSearch.kt delete mode 100644 marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/sqlsource/SpringDataSqlSource.kt delete mode 100644 plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/ArtifactAdviceListener.kt delete mode 100644 plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkConstructor.kt diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/PluginSqlProducerSearch.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/PluginSqlProducerSearch.kt deleted file mode 100644 index 50904504c..000000000 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/PluginSqlProducerSearch.kt +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.marker.jvm.psi - -import com.intellij.openapi.application.ApplicationManager -import com.intellij.psi.PsiMethod -import com.intellij.psi.impl.compiled.ClsMethodImpl -import com.intellij.psi.search.searches.OverridingMethodsSearch -import spp.jetbrains.marker.jvm.ArtifactSearch -import spp.jetbrains.marker.source.JVMMarkerUtils -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import spp.protocol.extend.SqlProducerSearch -import spp.jetbrains.marker.jvm.psi.sqlsource.SpringDataSqlSource -import io.vertx.core.Promise -import io.vertx.core.Vertx -import io.vertx.kotlin.coroutines.await -import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import org.jetbrains.uast.UCallExpression -import org.jetbrains.uast.UMethod -import org.jetbrains.uast.toUElementOfType -import org.jetbrains.uast.visitor.AbstractUastVisitor -import org.jooq.Query -import org.slf4j.LoggerFactory -import java.util.* - -/** - * todo: description. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -class PluginSqlProducerSearch(val vertx: Vertx) : SqlProducerSearch { - - companion object { - private val log = LoggerFactory.getLogger(PluginSqlProducerSearch::class.java) - } - - private val detectorSet = setOf( - SpringDataSqlSource() - ) - - val possibleRegressionSources = mutableListOf() - - override suspend fun determineSource( - query: Query, - searchPoint: ArtifactQualifiedName - ): Optional { - val promise = Promise.promise>() - val searchArtifact = ArtifactSearch.findArtifact(vertx ,searchPoint) - if (searchArtifact == null) { - promise.fail("Could not determine search point artifact") - return promise.future().await() - } - - ApplicationManager.getApplication().runReadAction { - dependencySearch(searchArtifact.toUElementOfType()!!) - - GlobalScope.launch(vertx.dispatcher()) { - var keepSearching = true - for (method in possibleRegressionSources) { //todo: fix dupes - for (detector in detectorSet) { - try { - if (detector.isSqlSource(query, method)) { - promise.complete(Optional.of(JVMMarkerUtils.getFullyQualifiedName(method.method))) - keepSearching = false - } - } catch (throwable: Throwable) { - promise.fail(throwable) - } - if (!keepSearching) break - } - if (!keepSearching) break - } - promise.tryComplete(Optional.empty()) - } - } - return promise.future().await() - } - - private fun dependencySearch(method: UMethod) { - method.accept(object : AbstractUastVisitor() { - override fun visitCallExpression(node: UCallExpression): Boolean { - val calledMethod = node.resolve() - if (calledMethod != null) { - if (calledMethod.body == null) { - possibleRegressionSources.add(CalledMethod(node, calledMethod)) - - if (calledMethod !is ClsMethodImpl) { - //interface/abstract method; search implementations - val implMethods = OverridingMethodsSearch.search(calledMethod).toList() - implMethods.forEach { - dependencySearch(it.toUElementOfType()!!) - } - } - } - } else { - log.warn("Failed to resolve: $node") - } - return super.visitCallExpression(node) - } - }) - } - - /** - * todo: description. - */ - interface SqlSourceDeterminer { - fun isSqlSource(query: Query, calledMethod: CalledMethod): Boolean - } - - /** - * todo: description. - */ - data class CalledMethod( - val call: UCallExpression, - val method: PsiMethod - ) -} diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/sqlsource/SpringDataSqlSource.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/sqlsource/SpringDataSqlSource.kt deleted file mode 100644 index 9233d5d26..000000000 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/sqlsource/SpringDataSqlSource.kt +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.marker.jvm.psi.sqlsource - -import com.intellij.psi.impl.compiled.ClsMethodImpl -import com.intellij.psi.util.PsiUtil -import spp.jetbrains.marker.jvm.psi.PluginSqlProducerSearch -import spp.jetbrains.marker.jvm.psi.PluginSqlProducerSearch.CalledMethod -import org.jooq.Query - -/** - * todo: description. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -class SpringDataSqlSource : PluginSqlProducerSearch.SqlSourceDeterminer { - - private val findAll = "org.springframework.data.repository.CrudRepository.findAll" - - override fun isSqlSource(query: Query, calledMethod: CalledMethod): Boolean { - if (calledMethod.method is ClsMethodImpl) { - if (PsiUtil.getMemberQualifiedName(calledMethod.method) == findAll) { - //todo: more strict verification - //java.lang.Iterable - val iterableType = calledMethod.call.returnType!!.canonicalText - val queryType = iterableType.substring(0, iterableType.length - 1) - .replace("java.lang.Iterable<", "") - var tableName = queryType - if (tableName.contains(".")) { - tableName = tableName.substring(tableName.lastIndexOf(".") + 1).toUpperCase() - } - val tableNames = query.tableNames() - if (tableNames.size == 1) { - return tableNames[0] == tableName - } - return false - } else { - return false - } - } else { - return false - } - } - - //todo: remove when jooq offers public access to parsed queries - private fun Query.tableNames(): List { - val fromField = javaClass.getDeclaredField("from") - fromField.isAccessible = true - val fromTables = fromField.get(this) as List<*> - return fromTables.map { - val aliasField = it!!.javaClass.getDeclaredField("alias") - aliasField.isAccessible = true - val alias = aliasField.get(it) - val wrappedField = alias.javaClass.getDeclaredField("wrapped") - wrappedField.isAccessible = true - val wrapped = wrappedField.get(alias) - wrapped.toString() - } - } -} diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/PluginConfigurationPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/PluginConfigurationPanel.java index 9bf8acbd8..9a99bbc61 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/PluginConfigurationPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/PluginConfigurationPanel.java @@ -46,7 +46,7 @@ public PluginConfigurationPanel(SourceMarkerConfig config) { myGlobalSettingsPanel.setBorder(IdeBorderFactory.createTitledBorder(message("plugin_settings"))); if (INSTANCE.getLiveService() != null) { - INSTANCE.getLiveService().getServices(it -> { + INSTANCE.getLiveService().getServices().onComplete(it -> { if (it.succeeded()) { it.result().forEach(service -> serviceComboBox.addItem(service.getName())); diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index b70c3ca9a..ab3d1d9e6 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -25,7 +25,6 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService; import spp.jetbrains.sourcemarker.settings.LiveBreakpointConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; -import spp.protocol.SourceMarkerServices; import spp.protocol.instrument.InstrumentThrottle; import spp.protocol.instrument.LiveInstrument; import spp.protocol.instrument.LiveInstrumentEvent; @@ -34,7 +33,6 @@ import spp.protocol.instrument.breakpoint.LiveBreakpoint; import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit; import spp.protocol.instrument.breakpoint.event.LiveBreakpointRemoved; -import spp.protocol.service.live.LiveInstrumentService; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -53,7 +51,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Objects; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; @@ -62,6 +59,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; import static spp.protocol.instrument.LiveInstrumentEventType.BREAKPOINT_HIT; import static spp.protocol.instrument.LiveInstrumentEventType.BREAKPOINT_REMOVED; @@ -444,7 +442,6 @@ private void saveLiveBreakpoint() { HashMap meta = new HashMap<>(); meta.put("original_source_mark", inlayMark.getId()); - LiveInstrumentService instrumentService = Objects.requireNonNull(SourceMarkerServices.Instance.INSTANCE.getLiveInstrument()); LiveBreakpoint instrument = new LiveBreakpoint( sourceLocation, condition, @@ -457,7 +454,7 @@ private void saveLiveBreakpoint() { throttle, meta ); - instrumentService.addLiveInstrument(instrument, it -> { + INSTANCE.getLiveInstrument().addLiveInstrument(instrument).onComplete(it -> { if (it.succeeded()) { liveBreakpoint = (LiveBreakpoint) it.result(); inlayMark.putUserData(SourceMarkKeys.INSTANCE.getBREAKPOINT_ID(), liveBreakpoint.getId()); @@ -481,7 +478,7 @@ private void dispose() { if (groupedMarks != null) groupedMarks.forEach(SourceMark::dispose); if (liveBreakpoint != null) { - SourceMarkerServices.Instance.INSTANCE.getLiveInstrument().removeLiveInstrument(liveBreakpoint.getId(), it -> { + INSTANCE.getLiveInstrument().removeLiveInstrument(liveBreakpoint.getId()).onComplete(it -> { if (it.succeeded()) { LiveStatusManager.INSTANCE.removeActiveLiveInstrument(liveBreakpoint); } else { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java index 368dae66c..02c42d4e2 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java @@ -9,7 +9,6 @@ import spp.jetbrains.sourcemarker.service.InstrumentEventListener; import io.vertx.core.json.JsonObject; import org.jetbrains.annotations.NotNull; -import spp.protocol.SourceMarkerServices; import spp.protocol.instrument.LiveInstrumentEvent; import spp.protocol.instrument.meter.LiveMeter; import spp.protocol.instrument.meter.MeterType; @@ -23,6 +22,7 @@ import static spp.jetbrains.sourcemarker.PluginUI.LABEL_FOREGROUND_COLOR; import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_LIGHT_PLAIN_15; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; public class LiveMeterStatusPanel extends JPanel implements InstrumentEventListener { @@ -96,7 +96,7 @@ public void mouseMoved(MouseEvent e) { addRecursiveMouseListener(closeLabel, new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - SourceMarkerServices.Instance.INSTANCE.getLiveInstrument().removeLiveInstrument(liveMeter.getId(), it -> { + INSTANCE.getLiveInstrument().removeLiveInstrument(liveMeter.getId()).onComplete(it -> { if (it.succeeded()) { gutterMark.dispose(); LiveStatusManager.INSTANCE.removeActiveLiveInstrument(liveMeter); diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index ba2d19216..8718494f0 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -21,7 +21,6 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitColumnInfo; import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; -import spp.protocol.SourceMarkerServices; import spp.protocol.instrument.LiveInstrument; import spp.protocol.instrument.LiveSourceLocation; import spp.protocol.instrument.meter.LiveMeter; @@ -29,7 +28,6 @@ import spp.protocol.instrument.meter.MetricValue; import spp.protocol.instrument.meter.MetricValueType; import spp.protocol.instrument.meter.event.LiveMeterRemoved; -import spp.protocol.service.live.LiveInstrumentService; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -46,6 +44,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; import static spp.protocol.instrument.LiveInstrumentEventType.METER_REMOVED; public class MeterStatusBar extends JPanel implements StatusBar, VisibleAreaListener { @@ -357,7 +356,6 @@ private void saveLiveMeter() { HashMap meta = new HashMap<>(); meta.put("original_source_mark", inlayMark.getId()); - LiveInstrumentService instrumentService = Objects.requireNonNull(SourceMarkerServices.Instance.INSTANCE.getLiveInstrument()); LiveMeter instrument = new LiveMeter( meterNameField.getText(), MeterType.valueOf(meterTypeComboBox.getSelectedItem().toString().toUpperCase()), @@ -373,7 +371,7 @@ private void saveLiveMeter() { null, meta ); - instrumentService.addLiveInstrument(instrument, it -> { + INSTANCE.getLiveInstrument().addLiveInstrument(instrument).onComplete(it -> { if (it.succeeded()) { liveMeter = (LiveMeter) it.result(); LiveStatusManager.INSTANCE.addActiveLiveInstrument(liveMeter); @@ -404,7 +402,7 @@ private void dispose() { if (groupedMarks != null) groupedMarks.forEach(SourceMark::dispose); if (liveMeter != null) { - SourceMarkerServices.Instance.INSTANCE.getLiveInstrument().removeLiveInstrument(liveMeter.getId(), it -> { + INSTANCE.getLiveInstrument().removeLiveInstrument(liveMeter.getId()).onComplete(it -> { if (it.succeeded()) { LiveStatusManager.INSTANCE.removeActiveLiveInstrument(liveMeter); } else { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index cc33d8549..c656b0b47 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -21,12 +21,10 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitColumnInfo; import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; -import spp.protocol.SourceMarkerServices; import spp.protocol.instrument.LiveInstrument; import spp.protocol.instrument.LiveSourceLocation; import spp.protocol.instrument.meter.event.LiveMeterRemoved; import spp.protocol.instrument.span.LiveSpan; -import spp.protocol.service.live.LiveInstrumentService; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -43,6 +41,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; import static spp.protocol.instrument.LiveInstrumentEventType.METER_REMOVED; public class SpanStatusBar extends JPanel implements StatusBar, VisibleAreaListener { @@ -344,7 +343,6 @@ private void saveLiveSpan() { HashMap meta = new HashMap<>(); meta.put("original_source_mark", inlayMark.getId()); - LiveInstrumentService instrumentService = Objects.requireNonNull(SourceMarkerServices.Instance.INSTANCE.getLiveInstrument()); LiveSpan instrument = new LiveSpan( spanOperationNameField.getText(), sourceLocation, @@ -358,7 +356,7 @@ private void saveLiveSpan() { null, meta ); - instrumentService.addLiveInstrument(instrument, it -> { + INSTANCE.getLiveInstrument().addLiveInstrument(instrument).onComplete(it -> { if (it.succeeded()) { liveSpan = (LiveSpan) it.result(); LiveStatusManager.INSTANCE.addActiveLiveInstrument(liveSpan); @@ -385,7 +383,7 @@ private void dispose() { if (groupedMarks != null) groupedMarks.forEach(SourceMark::dispose); if (liveSpan != null) { - SourceMarkerServices.Instance.INSTANCE.getLiveInstrument().removeLiveInstrument(liveSpan.getId(), it -> { + INSTANCE.getLiveInstrument().removeLiveInstrument(liveSpan.getId()).onComplete(it -> { if (it.succeeded()) { LiveStatusManager.INSTANCE.removeActiveLiveInstrument(liveSpan); } else { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 5e256eaa0..6b1115902 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -110,7 +110,6 @@ import spp.protocol.service.LiveService import spp.protocol.service.live.LiveInstrumentService import spp.protocol.service.live.LiveViewService import spp.protocol.service.logging.LogCountIndicatorService -import spp.protocol.service.tracing.LocalTracingService import spp.protocol.util.KSerializers import spp.protocol.util.LocalMessageCodec import java.awt.Color @@ -374,21 +373,6 @@ object SourceMarkerPlugin { log.info("Live views disabled") } - //local tracing - if (hardcodedConfig.getJsonObject("services").getBoolean("local_tracing")) { - if (availableRecords.any { it.name == SourceMarkerServices.Utilize.LOCAL_TRACING }) { - log.info("Local tracing available") - Instance.localTracing = ServiceProxyBuilder(vertx) - .apply { config.serviceToken?.let { setToken(it) } } - .setAddress(SourceMarkerServices.Utilize.LOCAL_TRACING) - .build(LocalTracingService::class.java) - } else { - log.warn("Local tracing unavailable") - } - } else { - log.info("Local tracing disabled") - } - //log count indicator if (hardcodedConfig.getJsonObject("services").getBoolean("log_count_indicator")) { if (availableRecords.any { it.name == SourceMarkerServices.Utilize.LOG_COUNT_INDICATOR }) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/icons/SourceMarkerIcons.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/icons/SourceMarkerIcons.kt index 8c7987465..19ec2c364 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/icons/SourceMarkerIcons.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/icons/SourceMarkerIcons.kt @@ -21,9 +21,6 @@ import com.intellij.ui.scale.ScaleContext import com.intellij.util.SVGLoader import com.intellij.util.ui.JBImageIcon import spp.jetbrains.sourcemarker.PluginIcons -import spp.protocol.advice.ArtifactAdvice -import spp.protocol.advice.cautionary.RampDetectionAdvice -import spp.protocol.advice.informative.ActiveExceptionAdvice import java.io.ByteArrayInputStream import javax.swing.Icon @@ -47,14 +44,6 @@ object SourceMarkerIcons { val LIVE_BREAKPOINT_PENDING_ICON = PluginIcons.Breakpoint.pending val LIVE_BREAKPOINT_ERROR_ICON = PluginIcons.Breakpoint.error - fun getGutterMarkIcon(advice: ArtifactAdvice): Icon? { - return when (advice) { - is ActiveExceptionAdvice -> exclamationTriangle - is RampDetectionAdvice -> performanceRamp - else -> null - } - } - fun getNumericGutterMarkIcon(value: Int, color: String = "#182d34"): Icon { return JBImageIcon( SVGLoader.loadHiDPI( diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/ArtifactAdviceListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/ArtifactAdviceListener.kt deleted file mode 100644 index 99eda0ff4..000000000 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/ArtifactAdviceListener.kt +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.sourcemarker.listeners - -import com.intellij.openapi.application.ApplicationManager -import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.marker.source.mark.api.MethodSourceMark -import spp.jetbrains.marker.source.mark.api.SourceMark -import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent -import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode -import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventListener -import spp.protocol.advice.AdviceListener -import spp.protocol.advice.ArtifactAdvice -import spp.protocol.artifact.ArtifactType -import spp.jetbrains.sourcemarker.SourceMarkerPlugin -import spp.jetbrains.sourcemarker.mark.SourceMarkConstructor -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ARTIFACT_ADVICE -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.SOURCE_PORTAL -import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import org.slf4j.LoggerFactory - -/** - * todo: description. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -class ArtifactAdviceListener : AdviceListener, SourceMarkEventListener { - - companion object { - private val log = LoggerFactory.getLogger(ArtifactAdviceListener::class.java) - } - - private val pendingAdvice = mutableSetOf() - - override suspend fun advised(advice: ArtifactAdvice) { - when (advice.artifact.type) { - ArtifactType.ENDPOINT -> createEndpointAdvice(advice) - ArtifactType.STATEMENT -> ApplicationManager.getApplication() - .runReadAction { createExpressionAdvice(advice) } - else -> TODO("impl") - } - } - - override fun handleEvent(event: SourceMarkEvent) { - if (event.eventCode == SourceMarkEventCode.MARK_ADDED) { - GlobalScope.launch(SourceMarkerPlugin.vertx.dispatcher()) { - pendingAdvice.toList().forEach { - advised(it) - } - } - } - } - - private suspend fun createEndpointAdvice(advice: ArtifactAdvice) { - val operationName = advice.artifact.identifier - val sourceMark = SourceMarker.getSourceMarks() - .filterIsInstance() - .firstOrNull { it.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointName(it) == operationName } - if (sourceMark != null) { - SourceMarkConstructor.attachAdvice(sourceMark, advice) - addAdviceData(sourceMark, advice) - } else { - pendingAdvice.add(advice) - } - } - - private fun createExpressionAdvice(advice: ArtifactAdvice) { - val qualifiedClassName = advice.artifact.identifier - .substring(0, advice.artifact.identifier.lastIndexOf(".")) - val fileMarker = SourceMarker.getSourceFileMarker(qualifiedClassName) - if (fileMarker != null) { - val sourceMark = SourceMarkConstructor.getOrSetupSourceMark(fileMarker, advice) - if (sourceMark != null) { - addAdviceData(sourceMark, advice) - } - } else { - pendingAdvice.add(advice) - } - } - - private fun addAdviceData(sourceMark: SourceMark, advice: ArtifactAdvice) { - pendingAdvice.remove(advice) - if (sourceMark.getUserData(ARTIFACT_ADVICE) == null) { - sourceMark.putUserData(ARTIFACT_ADVICE, mutableListOf()) - } - - val activeAdvice = sourceMark.getUserData(ARTIFACT_ADVICE)!! - val updatedAdvice = activeAdvice.any { - if (it.isSameArtifactAdvice(advice)) { - it.updateArtifactAdvice(advice) - true - } else { - false - } - } - if (updatedAdvice) { - log.trace("Updated artifact advice: $advice") - } else { - activeAdvice.add(advice) - sourceMark.getUserData(SOURCE_PORTAL)?.advice?.add(advice) - log.debug("Added artifact advice: $advice") - } - } -} diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt index 9c51b6985..daf71cbb9 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt @@ -30,7 +30,6 @@ import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode import spp.jetbrains.marker.source.mark.api.event.SynchronousSourceMarkEventListener import spp.jetbrains.portal.SourcePortal import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx -import spp.jetbrains.sourcemarker.mark.SourceMarkConstructor import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.LOGGER_DETECTOR @@ -105,7 +104,6 @@ class PluginSourceMarkEventListener : SynchronousSourceMarkEventListener { sourceMark.putUserData(LOGGER_DETECTOR, loggerDetector) } else if (event.eventCode == SourceMarkEventCode.MARK_REMOVED) { event.sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!.close() - SourceMarkConstructor.tearDownSourceMark(event.sourceMark) } } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt index dd59396a6..fa0aa42e2 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt @@ -25,7 +25,6 @@ import com.intellij.psi.PsiNameIdentifierOwner import com.intellij.util.PsiNavigateUtil import io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND import io.vertx.core.eventbus.ReplyException -import io.vertx.core.eventbus.ReplyFailure import io.vertx.core.json.Json import io.vertx.core.json.JsonObject import io.vertx.kotlin.coroutines.CoroutineVerticle @@ -33,7 +32,6 @@ import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.datetime.Instant -import kotlinx.datetime.toKotlinInstant import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.SourceMarker.creationService @@ -92,7 +90,6 @@ import spp.protocol.artifact.metrics.ArtifactSummarizedResult import spp.protocol.artifact.metrics.MetricType import spp.protocol.artifact.trace.TraceResult import spp.protocol.artifact.trace.TraceSpan -import spp.protocol.error.AccessDenied import spp.protocol.instrument.LiveSourceLocation import spp.protocol.portal.PageType import spp.protocol.utils.ArtifactNameUtils @@ -268,7 +265,7 @@ class PortalEventListener( //update subscriptions if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions { + Instance.liveView!!.clearLiveViewSubscriptions().onComplete { if (it.succeeded()) { GlobalScope.launch(vertx.dispatcher()) { val sourceMark = SourceMarker.getSourceMark( @@ -284,14 +281,9 @@ class PortalEventListener( listOf(endpointName), portal.viewingArtifact, LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig( - "ACTIVITY", - false, - listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla"), - 0 - ) + LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) ) - ) { + ).onComplete { if (it.failed()) { log.error("Failed to add live view subscription", it.cause()) } @@ -312,7 +304,7 @@ class PortalEventListener( //update subscriptions if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions { + Instance.liveView!!.clearLiveViewSubscriptions().onComplete { if (it.succeeded()) { GlobalScope.launch(vertx.dispatcher()) { val sourceMark = SourceMarker.getSourceMark( @@ -328,14 +320,9 @@ class PortalEventListener( listOf(endpointName), portal.viewingArtifact, LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig( - "TRACES", - false, - listOf("endpoint_traces"), - 0 - ) + LiveViewConfig("TRACES", listOf("endpoint_traces")) ) - ) { + ).onComplete { if (it.failed()) { log.error("Failed to add live view subscription", it.cause()) } @@ -356,7 +343,7 @@ class PortalEventListener( //update subscriptions if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions { + Instance.liveView!!.clearLiveViewSubscriptions().onComplete { if (it.succeeded()) { GlobalScope.launch(vertx.dispatcher()) { val sourceMark = SourceMarker.getSourceMark( @@ -382,14 +369,9 @@ class PortalEventListener( logPatterns, portal.viewingArtifact, LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig( - "LOGS", - false, - listOf("endpoint_logs"), - 0 - ) + LiveViewConfig("LOGS", listOf("endpoint_logs")) ) - ) { + ).onComplete { if (it.failed()) { log.error("Failed to add live view subscription", it.cause()) } @@ -467,33 +449,6 @@ class PortalEventListener( handleTraceResult(traceResult, portal, portal.viewingArtifact) } - } else if (Instance.localTracing != null) { - portal.tracesView.localTracing = true - Instance.localTracing!!.getTraceResult( - artifactQualifiedName = portal.viewingArtifact, - start = ZonedDateTime.now().minusHours(24).toInstant().toKotlinInstant(), - stop = ZonedDateTime.now().toInstant().toKotlinInstant(), - orderType = portal.tracesView.orderType, - pageSize = portal.tracesView.viewTraceAmount, - pageNumber = portal.tracesView.pageNumber, - ) { - if (it.succeeded()) { - handleTraceResult(it.result(), portal, portal.viewingArtifact) - } else { - val replyException = it.cause() as ReplyException - if (replyException.failureType() == ReplyFailure.TIMEOUT) { - log.warn("Timed out getting local trace results") - } else { - val actualException = replyException.cause!! - if (actualException is AccessDenied) { - log.error("Access denied. Reason: " + actualException.reason) - } else { - it.cause().printStackTrace() - log.error("Failed to get local trace results", it.cause()) - } - } - } - } } } } @@ -679,8 +634,6 @@ class PortalEventListener( portal.configuration.visibleActivity = true portal.configuration.visibleTraces = true portal.configuration.visibleLogs = true //todo: can hide based on if there is logs - } else if (Instance.localTracing != null) { - portal.configuration.visibleTraces = true } else { //non-endpoint artifact; hide activity/traces till manually shown portal.configuration.visibleActivity = false diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkConstructor.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkConstructor.kt deleted file mode 100644 index 856dd8b14..000000000 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkConstructor.kt +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.sourcemarker.mark - -import com.intellij.psi.PsiElement -import spp.jetbrains.marker.SourceMarker.creationService -import spp.jetbrains.marker.source.SourceFileMarker -import spp.jetbrains.marker.source.mark.api.SourceMark -import spp.jetbrains.marker.source.mark.api.key.SourceKey -import spp.jetbrains.marker.source.mark.gutter.GutterMark -import spp.jetbrains.marker.source.mark.inlay.ExpressionInlayMark -import spp.jetbrains.marker.source.mark.inlay.InlayMark -import spp.jetbrains.marker.source.mark.inlay.config.InlayMarkVirtualText -import spp.protocol.advice.AdviceType -import spp.protocol.advice.ArtifactAdvice -import spp.protocol.advice.informative.ActiveExceptionAdvice -import spp.protocol.utils.toPrettyDuration -import spp.jetbrains.sourcemarker.PluginBundle.message -import spp.jetbrains.sourcemarker.SourceMarkerPlugin -import spp.jetbrains.sourcemarker.SourceMarkerPlugin.SOURCE_RED -import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons -import kotlinx.datetime.Clock -import org.slf4j.LoggerFactory - -/** - * Sets up the appropriate [SourceMark] display configuration based on [AdviceType]. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -object SourceMarkConstructor { - - private val log = LoggerFactory.getLogger(SourceMarkConstructor::class.java) - private val ADVICE_TIMER = SourceKey("ADVICE_TIMER") - - fun tearDownSourceMark(sourceMark: SourceMark) { - val artifactAdvice = sourceMark.getUserData(SourceMarkKeys.ARTIFACT_ADVICE) - if (artifactAdvice == null || artifactAdvice.isEmpty()) { - return - } - - artifactAdvice.forEach { - when (it.type) { - AdviceType.ActiveExceptionAdvice -> { - val timerId = sourceMark.getUserData(ADVICE_TIMER) - if (timerId != null) { - SourceMarkerPlugin.vertx.cancelTimer(timerId) - sourceMark.putUserData(ADVICE_TIMER, null) - } - } - else -> { - //no additional tear down necessary - } - } - } - artifactAdvice.clear() - } - - fun getOrSetupSourceMark(fileMarker: SourceFileMarker, advice: ArtifactAdvice): SourceMark? { - when (advice.type) { - AdviceType.RampDetectionAdvice -> { - val gutterMark = creationService.getOrCreateExpressionGutterMark(fileMarker, advice.artifact.lineNumber!!) - return if (gutterMark.isPresent) { - if (!fileMarker.containsSourceMark(gutterMark.get())) { - attachAdvice(gutterMark.get(), advice) - gutterMark.get().apply() - } - gutterMark.get() - } else { - log.warn("No detected expression at line {}. Gutter mark ignored", advice.artifact.lineNumber!!) - null - } - } - AdviceType.ActiveExceptionAdvice -> { - val inlayMark = creationService.getOrCreateExpressionInlayMark(fileMarker, advice.artifact.lineNumber!!) - return if (inlayMark.isPresent) { - if (!fileMarker.containsSourceMark(inlayMark.get())) { - attachAdvice(inlayMark.get(), advice) - inlayMark.get().apply() - } - inlayMark.get() - } else { - log.warn("No detected expression at line {}. Inlay mark ignored", advice.artifact.lineNumber!!) - null - } - } - } - } - - fun attachAdvice(sourceMark: SourceMark, advice: ArtifactAdvice) = when (sourceMark.type) { - SourceMark.Type.GUTTER -> attachAdvice(sourceMark as GutterMark, advice) - SourceMark.Type.INLAY -> attachAdvice(sourceMark as InlayMark, advice) - } - - private fun attachAdvice(gutterMark: GutterMark, advice: ArtifactAdvice) { - gutterMark.configuration.icon = SourceMarkerIcons.getGutterMarkIcon(advice) - gutterMark.setVisible(true) - gutterMark.sourceFileMarker.refresh() - } - - @Suppress("MagicNumber") - private fun attachAdvice(inlayMark: InlayMark, advice: ArtifactAdvice) { - when (advice) { - is ActiveExceptionAdvice -> { - val expressionMark = inlayMark as ExpressionInlayMark - val prettyTimeAgo = if (isThrows(expressionMark.getPsiExpression())) { - { - val occurred = (Clock.System.now() - .toEpochMilliseconds() - advice.occurredAt.toEpochMilliseconds()).toPrettyDuration() + - " " + message("ago") - " //${message("last_occurred")} $occurred " - } - } else { - { - val exceptionType = advice.stackTrace.exceptionType.substringAfterLast(".") - val occurred = (Clock.System.now() - .toEpochMilliseconds() - advice.occurredAt.toEpochMilliseconds()).toPrettyDuration() + - " " + message("ago") - " //${message("threw")} $exceptionType $occurred " - } - } - - inlayMark.configuration.virtualText = InlayMarkVirtualText(inlayMark, prettyTimeAgo.invoke()) - inlayMark.configuration.virtualText!!.textAttributes.foregroundColor = SOURCE_RED - inlayMark.configuration.virtualText!!.useInlinePresentation = true - inlayMark.configuration.activateOnMouseClick = false - - inlayMark.putUserData(ADVICE_TIMER, SourceMarkerPlugin.vertx.setPeriodic(1000) { - inlayMark.configuration.virtualText!!.updateVirtualText(prettyTimeAgo.invoke()) - }) - - //todo: shouldn't be creating gutter mark here - val gutterMark = creationService.getOrCreateExpressionGutterMark( - inlayMark.sourceFileMarker, advice.artifact.lineNumber!! - ).get() - if (!gutterMark.sourceFileMarker.containsSourceMark(gutterMark)) { - gutterMark.configuration.icon = SourceMarkerIcons.activeException - gutterMark.apply() - } - } - } - } - - private fun isThrows(psiExpression: PsiElement): Boolean { - TODO() - } -} diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt index b626086c6..c7e5b046c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt @@ -20,7 +20,6 @@ package spp.jetbrains.sourcemarker.mark import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.key.SourceKey import spp.jetbrains.portal.SourcePortal -import spp.protocol.advice.ArtifactAdvice import spp.jetbrains.marker.jvm.psi.EndpointDetector import spp.jetbrains.marker.jvm.psi.LoggerDetector import spp.jetbrains.sourcemarker.service.InstrumentEventListener @@ -36,7 +35,6 @@ object SourceMarkKeys { val SOURCE_PORTAL = SourceKey("SOURCE_PORTAL") val ENDPOINT_DETECTOR = SourceKey("ENDPOINT_DETECTOR") val LOGGER_DETECTOR = SourceKey("LOGGER_DETECTOR") - val ARTIFACT_ADVICE = SourceKey>("ARTIFACT_ADVICE") val BREAKPOINT_ID = SourceKey("BREAKPOINT_ID") val LOG_ID = SourceKey("LOG_ID") val METER_ID = SourceKey("METER_ID") diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt index fd7135e67..c4fe1cbb7 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt @@ -69,7 +69,7 @@ class LogCountIndicators : CoroutineVerticle() { Clock.System.now().minus(15, DateTimeUnit.MINUTE), Clock.System.now(), DurationStep.MINUTE - ) { + ).onComplete { if (it.succeeded()) { val occurrences = it.result() //log.info("Found ${occurrences} occurrences of log patterns") diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt index 8a2f4c129..4280952bb 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt @@ -62,7 +62,7 @@ class LogHitColumnInfo(name: String) : ColumnInfo(n if (event.eventType == LiveInstrumentEventType.LOG_HIT) { val item = Json.decodeValue(event.data, LiveLogHit::class.java) return when (name) { - "Message" -> item.logResult.logs.first().getFormattedMessage() + "Message" -> item.logResult.logs.first().toFormattedMessage() "Time" -> (Clock.System.now().toEpochMilliseconds() - item.occurredAt.toEpochMilliseconds()) .toPrettyDuration() + " " + message("ago") diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index 2f12a4b27..91debe3ae 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -406,14 +406,9 @@ object LiveStatusManager : SourceMarkEventListener { listOf(liveMeter.toMetricId()), ArtifactQualifiedName(liveMeter.location.source, type = ArtifactType.EXPRESSION), liveMeter.location, - LiveViewConfig( - "LIVE_METER", - true, - listOf("last_minute", "last_hour", "last_day"), - 0 - ) + LiveViewConfig("LIVE_METER", listOf("last_minute", "last_hour", "last_day")) ) - ) { + ).onComplete { if (it.failed()) { log.error("Failed to add live view subscription", it.cause()) } diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt index f41484b90..fbee19383 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt @@ -145,20 +145,15 @@ class StandaloneActivityLiveView : LightJavaCodeInsightFixtureTestCase() { val endpointName = sourceMark.getUserData( SourceMarkKeys.ENDPOINT_DETECTOR )?.getOrFindEndpointName(sourceMark) ?: return@launch - SourceMarkerServices.Instance.liveView?.addLiveViewSubscription( + SourceMarkerServices.Instance.liveView!!.addLiveViewSubscription( LiveViewSubscription( null, listOf(endpointName), sourceMark.artifactQualifiedName, LiveSourceLocation(sourceMark.artifactQualifiedName.identifier, -1), - LiveViewConfig( - "ACTIVITY", - false, - listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla"), - refreshRateLimit = 0 - ) + LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) ) - ) { + ).onComplete { if (it.succeeded()) { println(it) } else { From 1d72d630220237395e663df2994a09b5ef80322a Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 11:31:53 -0500 Subject: [PATCH 006/115] temp version --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index a723a9a54..e75f0d2e2 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") + implementation("com.github.sourceplusplus.protocol:protocol:a97325afb6") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 771343e68..60aafe845 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -28,7 +28,7 @@ repositories { dependencies { val intellijVersion = "213.6777.52" - compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") + compileOnly("com.github.sourceplusplus.protocol:protocol:a97325afb6") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 72cf7d187..f3727e2ef 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") + compileOnly("com.github.sourceplusplus.protocol:protocol:a97325afb6") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index a21bfac40..132166209 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") + compileOnly("com.github.sourceplusplus.protocol:protocol:a97325afb6") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 121018dfb..88fb6d7c3 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") + implementation("com.github.sourceplusplus.protocol:protocol:a97325afb6") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 26ec08648..b82b0006a 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -62,8 +62,8 @@ dependencies { implementation(project(":marker:jvm-marker")) implementation(project(":marker:py-marker")) implementation(project(":monitor")) - implementation("com.github.sourceplusplus.interface-portal:portal-jvm:$projectVersion") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") + implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } + implementation("com.github.sourceplusplus.protocol:protocol:a97325afb6") } implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion") From a42551be372d4afdba3f2ed39d0474612eaf4d14 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 13:53:44 -0500 Subject: [PATCH 007/115] refactor --- .../status/BreakpointStatusBar.java | 15 ++-------- .../status/LiveMeterStatusPanel.java | 6 ++-- .../sourcemarker/status/LogStatusBar.java | 28 +++---------------- .../sourcemarker/status/MeterStatusBar.java | 6 ++-- .../sourcemarker/status/SpanStatusBar.java | 6 ++-- .../service/LiveInstrumentManager.kt | 28 +++++++++---------- .../sourcemarker/status/LiveStatusManager.kt | 6 +--- 7 files changed, 32 insertions(+), 63 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index ab3d1d9e6..c00486a70 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -25,12 +25,7 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService; import spp.jetbrains.sourcemarker.settings.LiveBreakpointConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; -import spp.protocol.instrument.InstrumentThrottle; -import spp.protocol.instrument.LiveInstrument; -import spp.protocol.instrument.LiveInstrumentEvent; -import spp.protocol.instrument.LiveSourceLocation; -import spp.protocol.instrument.ThrottleStep; -import spp.protocol.instrument.breakpoint.LiveBreakpoint; +import spp.protocol.instrument.*; import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit; import spp.protocol.instrument.breakpoint.event.LiveBreakpointRemoved; @@ -40,13 +35,7 @@ import javax.swing.border.LineBorder; import javax.swing.event.DocumentEvent; import java.awt.*; -import java.awt.event.ComponentEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; +import java.awt.event.*; import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java index 02c42d4e2..911298af6 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java @@ -3,14 +3,14 @@ import com.intellij.util.ui.UIUtil; import com.jgoodies.forms.factories.FormFactory; import com.jgoodies.forms.layout.*; +import io.vertx.core.json.JsonObject; +import org.jetbrains.annotations.NotNull; import spp.jetbrains.marker.source.mark.gutter.GutterMark; import spp.jetbrains.sourcemarker.PluginIcons; import spp.jetbrains.sourcemarker.PluginUI; import spp.jetbrains.sourcemarker.service.InstrumentEventListener; -import io.vertx.core.json.JsonObject; -import org.jetbrains.annotations.NotNull; import spp.protocol.instrument.LiveInstrumentEvent; -import spp.protocol.instrument.meter.LiveMeter; +import spp.protocol.instrument.LiveMeter; import spp.protocol.instrument.meter.MeterType; import javax.swing.*; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index bd77a3853..505a5f21b 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -18,20 +18,15 @@ import spp.jetbrains.marker.source.mark.inlay.InlayMark; import spp.jetbrains.sourcemarker.PluginIcons; import spp.jetbrains.sourcemarker.PluginUI; -import spp.jetbrains.sourcemarker.service.log.VariableParser; import spp.jetbrains.sourcemarker.command.AutocompleteFieldRow; import spp.jetbrains.sourcemarker.mark.SourceMarkKeys; import spp.jetbrains.sourcemarker.service.InstrumentEventListener; import spp.jetbrains.sourcemarker.service.log.LogHitColumnInfo; +import spp.jetbrains.sourcemarker.service.log.VariableParser; import spp.jetbrains.sourcemarker.settings.LiveLogConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.artifact.log.Log; -import spp.protocol.instrument.InstrumentThrottle; -import spp.protocol.instrument.LiveInstrument; -import spp.protocol.instrument.LiveInstrumentEvent; -import spp.protocol.instrument.LiveSourceLocation; -import spp.protocol.instrument.ThrottleStep; -import spp.protocol.instrument.log.LiveLog; +import spp.protocol.instrument.*; import spp.protocol.instrument.log.event.LiveLogRemoved; import javax.swing.*; @@ -41,15 +36,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.text.StyleContext; import java.awt.*; -import java.awt.event.ComponentEvent; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; +import java.awt.event.*; import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; @@ -64,14 +51,7 @@ import java.util.stream.Collectors; import static spp.jetbrains.marker.SourceMarker.conditionParser; -import static spp.jetbrains.sourcemarker.PluginUI.CNFG_PANEL_BGND_COLOR; -import static spp.jetbrains.sourcemarker.PluginUI.CNFG_PANEL_FOCUS_COLOR; -import static spp.jetbrains.sourcemarker.PluginUI.COMPLETE_COLOR_PURPLE; -import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_LIGHT_PLAIN_14; -import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_LIGHT_PLAIN_17; -import static spp.jetbrains.sourcemarker.PluginUI.SELECT_COLOR_RED; -import static spp.jetbrains.sourcemarker.PluginUI.STATUS_BAR_TXT_BG_COLOR; -import static spp.jetbrains.sourcemarker.PluginUI.DFLT_BGND_COLOR; +import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; import static spp.protocol.instrument.LiveInstrumentEventType.LOG_HIT; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index 8718494f0..27dcc9157 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -22,8 +22,8 @@ import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveInstrument; +import spp.protocol.instrument.LiveMeter; import spp.protocol.instrument.LiveSourceLocation; -import spp.protocol.instrument.meter.LiveMeter; import spp.protocol.instrument.meter.MeterType; import spp.protocol.instrument.meter.MetricValue; import spp.protocol.instrument.meter.MetricValueType; @@ -37,8 +37,10 @@ import java.awt.*; import java.awt.event.*; import java.time.Instant; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.List; -import java.util.*; import java.util.concurrent.atomic.AtomicLong; import static spp.jetbrains.marker.SourceMarker.conditionParser; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index c656b0b47..0e585b384 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -23,8 +23,8 @@ import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveInstrument; import spp.protocol.instrument.LiveSourceLocation; +import spp.protocol.instrument.LiveSpan; import spp.protocol.instrument.meter.event.LiveMeterRemoved; -import spp.protocol.instrument.span.LiveSpan; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -34,8 +34,10 @@ import java.awt.*; import java.awt.event.*; import java.time.Instant; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.List; -import java.util.*; import java.util.concurrent.atomic.AtomicLong; import static spp.jetbrains.marker.SourceMarker.conditionParser; diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 8b7ab2005..7fa6392bf 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -21,30 +21,30 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.editor.EditorFactory import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectManager +import io.vertx.core.json.Json +import io.vertx.core.json.JsonObject +import io.vertx.ext.bridge.BridgeEventType +import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper +import io.vertx.kotlin.coroutines.CoroutineVerticle +import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker +import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys +import spp.jetbrains.sourcemarker.search.SourceMarkSearch +import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService +import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener +import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated import spp.protocol.SourceMarkerServices.Instance import spp.protocol.SourceMarkerServices.Provide +import spp.protocol.instrument.LiveBreakpoint import spp.protocol.instrument.LiveInstrumentEvent import spp.protocol.instrument.LiveInstrumentEventType -import spp.protocol.instrument.breakpoint.LiveBreakpoint +import spp.protocol.instrument.LiveLog import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit import spp.protocol.instrument.breakpoint.event.LiveBreakpointRemoved -import spp.protocol.instrument.log.LiveLog import spp.protocol.instrument.log.event.LiveLogHit import spp.protocol.instrument.log.event.LiveLogRemoved -import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys -import spp.jetbrains.sourcemarker.search.SourceMarkSearch -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener -import spp.jetbrains.sourcemarker.status.LiveStatusManager -import io.vertx.core.json.Json -import io.vertx.core.json.JsonObject -import io.vertx.ext.bridge.BridgeEventType -import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper -import io.vertx.kotlin.coroutines.CoroutineVerticle -import org.slf4j.LoggerFactory /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index 91debe3ae..bb8f46dca 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -50,11 +50,7 @@ import spp.protocol.SourceMarkerServices import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.log.LogResult -import spp.protocol.instrument.LiveInstrument -import spp.protocol.instrument.LiveSourceLocation -import spp.protocol.instrument.breakpoint.LiveBreakpoint -import spp.protocol.instrument.log.LiveLog -import spp.protocol.instrument.meter.LiveMeter +import spp.protocol.instrument.* import spp.protocol.instrument.meter.MeterType import spp.protocol.portal.PageType import spp.protocol.view.LiveViewConfig From 56e7adb3f176c165d957f14bfebb9c71af1ca496 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 15:54:52 -0500 Subject: [PATCH 008/115] refactor --- .../sourcemarker/status/BreakpointStatusBar.java | 3 +-- .../sourcemarker/status/LogStatusBar.java | 3 +-- .../sourcemarker/status/MeterStatusBar.java | 4 ++-- .../sourcemarker/status/SpanStatusBar.java | 4 ++-- .../sourcemarker/service/LiveInstrumentManager.kt | 15 +++++---------- .../service/breakpoint/BreakpointHitColumnInfo.kt | 8 ++++---- .../sourcemarker/service/log/LogHitColumnInfo.kt | 8 ++++---- 7 files changed, 19 insertions(+), 26 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index c00486a70..e2f4b56b2 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -27,7 +27,6 @@ import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.*; import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit; -import spp.protocol.instrument.breakpoint.event.LiveBreakpointRemoved; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -169,7 +168,7 @@ private void setupAsActive() { } else if (event.getEventType() == BREAKPOINT_REMOVED) { configLabel.setIcon(PluginIcons.eyeSlash); - LiveBreakpointRemoved removed = Json.decodeValue(event.getData(), LiveBreakpointRemoved.class); + LiveInstrumentRemoved removed = Json.decodeValue(event.getData(), LiveInstrumentRemoved.class); if (removed.getCause() == null) { statusPanel.setStatus("Complete", COMPLETE_COLOR_PURPLE); } else { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index 505a5f21b..f577abcd9 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -27,7 +27,6 @@ import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.artifact.log.Log; import spp.protocol.instrument.*; -import spp.protocol.instrument.log.event.LiveLogRemoved; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -223,7 +222,7 @@ public void accept(@NotNull LiveInstrumentEvent event) { } else if (event.getEventType() == LOG_REMOVED) { removed = true; - LiveLogRemoved removed = Json.decodeValue(event.getData(), LiveLogRemoved.class); + LiveInstrumentRemoved removed = Json.decodeValue(event.getData(), LiveInstrumentRemoved.class); if (removed.getCause() != null) { commandModel.insertRow(0, event); diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index 27dcc9157..61e66775c 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -22,12 +22,12 @@ import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveInstrument; +import spp.protocol.instrument.LiveInstrumentRemoved; import spp.protocol.instrument.LiveMeter; import spp.protocol.instrument.LiveSourceLocation; import spp.protocol.instrument.meter.MeterType; import spp.protocol.instrument.meter.MetricValue; import spp.protocol.instrument.meter.MetricValueType; -import spp.protocol.instrument.meter.event.LiveMeterRemoved; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -128,7 +128,7 @@ private void setupAsActive() { if (event.getEventType() == METER_REMOVED) { configLabel.setIcon(PluginIcons.eyeSlash); - LiveMeterRemoved removed = Json.decodeValue(event.getData(), LiveMeterRemoved.class); + LiveInstrumentRemoved removed = Json.decodeValue(event.getData(), LiveInstrumentRemoved.class); if (removed.getCause() == null) { statusPanel.setStatus("Complete", COMPLETE_COLOR_PURPLE); } else { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index 0e585b384..fc334a10b 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -22,9 +22,9 @@ import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveInstrument; +import spp.protocol.instrument.LiveInstrumentRemoved; import spp.protocol.instrument.LiveSourceLocation; import spp.protocol.instrument.LiveSpan; -import spp.protocol.instrument.meter.event.LiveMeterRemoved; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -125,7 +125,7 @@ private void setupAsActive() { if (event.getEventType() == METER_REMOVED) { configLabel.setIcon(PluginIcons.eyeSlash); - LiveMeterRemoved removed = Json.decodeValue(event.getData(), LiveMeterRemoved.class); + LiveInstrumentRemoved removed = Json.decodeValue(event.getData(), LiveInstrumentRemoved.class); if (removed.getCause() == null) { statusPanel.setStatus("Complete", COMPLETE_COLOR_PURPLE); } else { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 7fa6392bf..7fcda61bf 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -37,14 +37,9 @@ import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated import spp.protocol.SourceMarkerServices.Instance import spp.protocol.SourceMarkerServices.Provide -import spp.protocol.instrument.LiveBreakpoint -import spp.protocol.instrument.LiveInstrumentEvent -import spp.protocol.instrument.LiveInstrumentEventType -import spp.protocol.instrument.LiveLog +import spp.protocol.instrument.* import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit -import spp.protocol.instrument.breakpoint.event.LiveBreakpointRemoved import spp.protocol.instrument.log.event.LiveLogHit -import spp.protocol.instrument.log.event.LiveLogRemoved /** * todo: description. @@ -98,9 +93,9 @@ class LiveInstrumentManager(private val project: Project) : CoroutineVerticle() } private fun handleLogRemovedEvent(liveEvent: LiveInstrumentEvent) { - val logRemoved = Json.decodeValue(liveEvent.data, LiveLogRemoved::class.java) + val logRemoved = Json.decodeValue(liveEvent.data, LiveInstrumentRemoved::class.java) ApplicationManager.getApplication().invokeLater { - val inlayMark = SourceMarkSearch.findByLogId(logRemoved.logId) + val inlayMark = SourceMarkSearch.findByLogId(logRemoved.liveInstrument.id!!) if (inlayMark != null) { val eventListeners = inlayMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) if (eventListeners?.isNotEmpty() == true) { @@ -144,9 +139,9 @@ class LiveInstrumentManager(private val project: Project) : CoroutineVerticle() } private fun handleBreakpointRemovedEvent(liveEvent: LiveInstrumentEvent) { - val bpRemoved = Json.decodeValue(liveEvent.data, LiveBreakpointRemoved::class.java) + val bpRemoved = Json.decodeValue(liveEvent.data, LiveInstrumentRemoved::class.java) ApplicationManager.getApplication().invokeLater { - val inlayMark = SourceMarkSearch.findByBreakpointId(bpRemoved.breakpointId) + val inlayMark = SourceMarkSearch.findByBreakpointId(bpRemoved.liveInstrument.id!!) if (inlayMark != null) { val eventListeners = inlayMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) if (eventListeners?.isNotEmpty() == true) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt index f1ecf4bcf..8277afeab 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt @@ -21,11 +21,11 @@ import com.intellij.util.ui.ColumnInfo import spp.protocol.instrument.LiveInstrumentEvent import spp.protocol.instrument.LiveInstrumentEventType import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit -import spp.protocol.instrument.breakpoint.event.LiveBreakpointRemoved import spp.protocol.utils.toPrettyDuration import spp.jetbrains.sourcemarker.PluginBundle.message import io.vertx.core.json.Json import kotlinx.datetime.Clock +import spp.protocol.instrument.LiveInstrumentRemoved /** * todo: description. @@ -41,14 +41,14 @@ class BreakpointHitColumnInfo(name: String) : ColumnInfo item.toString() } } else { - val item = Json.decodeValue(event.data, LiveBreakpointRemoved::class.java) + val item = Json.decodeValue(event.data, LiveInstrumentRemoved::class.java) return when (name) { "Breakpoint Data" -> item.cause!!.message ?: item.cause!!.exceptionType "Time" -> (Clock.System.now().toEpochMilliseconds() - item.occurredAt.toEpochMilliseconds()) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt index 4280952bb..80dbce022 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt @@ -21,11 +21,11 @@ import com.intellij.util.ui.ColumnInfo import spp.protocol.instrument.LiveInstrumentEvent import spp.protocol.instrument.LiveInstrumentEventType import spp.protocol.instrument.log.event.LiveLogHit -import spp.protocol.instrument.log.event.LiveLogRemoved import spp.protocol.utils.toPrettyDuration import spp.jetbrains.sourcemarker.PluginBundle.message import io.vertx.core.json.Json import kotlinx.datetime.Clock +import spp.protocol.instrument.LiveInstrumentRemoved /** * todo: description. @@ -41,14 +41,14 @@ class LogHitColumnInfo(name: String) : ColumnInfo(n val obj1 = if (t.eventType == LiveInstrumentEventType.LOG_HIT) { Json.decodeValue(t.data, LiveLogHit::class.java) } else if (t.eventType == LiveInstrumentEventType.LOG_REMOVED) { - Json.decodeValue(t.data, LiveLogRemoved::class.java) + Json.decodeValue(t.data, LiveInstrumentRemoved::class.java) } else { throw IllegalArgumentException(t.eventType.name) } val obj2 = if (t2.eventType == LiveInstrumentEventType.LOG_HIT) { Json.decodeValue(t2.data, LiveLogHit::class.java) } else if (t2.eventType == LiveInstrumentEventType.LOG_REMOVED) { - Json.decodeValue(t2.data, LiveLogRemoved::class.java) + Json.decodeValue(t2.data, LiveInstrumentRemoved::class.java) } else { throw IllegalArgumentException(t2.eventType.name) } @@ -69,7 +69,7 @@ class LogHitColumnInfo(name: String) : ColumnInfo(n else -> item.toString() } } else { - val item = Json.decodeValue(event.data, LiveLogRemoved::class.java) + val item = Json.decodeValue(event.data, LiveInstrumentRemoved::class.java) return when (name) { "Message" -> item.cause!!.message ?: item.cause!!.exceptionType "Time" -> (Clock.System.now().toEpochMilliseconds() - item.occurredAt.toEpochMilliseconds()) From 13fb12763a39157eb73ccbca2e46bd0605cd93b6 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 16:29:44 -0500 Subject: [PATCH 009/115] refactor --- .../jetbrains/marker/jvm/JVMVariableSimpleNode.kt | 4 ++-- .../jetbrains/marker/py/PythonVariableRootNode.kt | 4 ++-- .../marker/py/PythonVariableSimpleNode.kt | 2 +- .../sourcemarker/status/BreakpointStatusBar.java | 14 ++++++++++---- .../sourcemarker/status/LiveMeterStatusPanel.java | 2 +- .../sourcemarker/status/LogStatusBar.java | 12 +++++++++--- .../sourcemarker/status/MeterStatusBar.java | 4 ++-- .../sourcemarker/status/SpanStatusBar.java | 4 ++-- .../service/InstrumentEventListener.kt | 2 +- .../sourcemarker/service/LiveInstrumentManager.kt | 6 +++--- .../sourcemarker/service/LiveViewManager.kt | 4 ++-- .../breakpoint/BreakpointEventColumnInfo.kt | 6 +++--- .../service/breakpoint/BreakpointHitColumnInfo.kt | 12 ++++++------ .../breakpoint/BreakpointHitWindowService.kt | 4 ++-- .../breakpoint/tree/VariableRootSimpleNode.kt | 2 +- .../service/breakpoint/ui/EventsTab.kt | 2 +- .../sourcemarker/service/log/LogHitColumnInfo.kt | 12 ++++++------ 17 files changed, 54 insertions(+), 42 deletions(-) diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt index fc45b7520..183ab6ef2 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt @@ -24,9 +24,9 @@ import com.intellij.ui.SimpleTextAttributes import com.intellij.ui.treeStructure.SimpleNode import com.intellij.xdebugger.impl.ui.DebuggerUIUtil import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants -import spp.protocol.instrument.LiveVariable -import spp.protocol.instrument.LiveVariableScope import org.apache.commons.lang3.EnumUtils +import spp.protocol.instrument.variable.LiveVariable +import spp.protocol.instrument.variable.LiveVariableScope /** * todo: description. diff --git a/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonVariableRootNode.kt b/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonVariableRootNode.kt index 5ec1babf1..4ed35a812 100644 --- a/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonVariableRootNode.kt +++ b/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonVariableRootNode.kt @@ -22,8 +22,8 @@ import com.intellij.openapi.editor.DefaultLanguageHighlighterColors import com.intellij.ui.SimpleTextAttributes import com.intellij.ui.treeStructure.SimpleNode import com.intellij.xdebugger.impl.ui.DebuggerUIUtil -import spp.protocol.instrument.LiveVariable -import spp.protocol.instrument.LiveVariableScope +import spp.protocol.instrument.variable.LiveVariable +import spp.protocol.instrument.variable.LiveVariableScope /** * todo: description. diff --git a/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonVariableSimpleNode.kt b/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonVariableSimpleNode.kt index 4b6f5bc7e..abe75d497 100644 --- a/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonVariableSimpleNode.kt +++ b/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonVariableSimpleNode.kt @@ -24,7 +24,7 @@ import com.intellij.ui.treeStructure.SimpleNode import com.intellij.xdebugger.impl.ui.DebuggerUIUtil import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants import io.vertx.core.json.JsonObject -import spp.protocol.instrument.LiveVariable +import spp.protocol.instrument.variable.LiveVariable /** * todo: description. diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index e2f4b56b2..cf84651b8 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -25,8 +25,14 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService; import spp.jetbrains.sourcemarker.settings.LiveBreakpointConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; -import spp.protocol.instrument.*; -import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit; +import spp.protocol.instrument.LiveBreakpoint; +import spp.protocol.instrument.LiveInstrument; +import spp.protocol.instrument.LiveSourceLocation; +import spp.protocol.instrument.event.LiveBreakpointHit; +import spp.protocol.instrument.event.LiveInstrumentEvent; +import spp.protocol.instrument.event.LiveInstrumentRemoved; +import spp.protocol.instrument.throttle.InstrumentThrottle; +import spp.protocol.instrument.throttle.ThrottleStep; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -48,8 +54,8 @@ import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; -import static spp.protocol.instrument.LiveInstrumentEventType.BREAKPOINT_HIT; -import static spp.protocol.instrument.LiveInstrumentEventType.BREAKPOINT_REMOVED; +import static spp.protocol.instrument.event.LiveInstrumentEventType.BREAKPOINT_HIT; +import static spp.protocol.instrument.event.LiveInstrumentEventType.BREAKPOINT_REMOVED; public class BreakpointStatusBar extends JPanel implements StatusBar, VisibleAreaListener { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java index 911298af6..297184afb 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java @@ -9,8 +9,8 @@ import spp.jetbrains.sourcemarker.PluginIcons; import spp.jetbrains.sourcemarker.PluginUI; import spp.jetbrains.sourcemarker.service.InstrumentEventListener; -import spp.protocol.instrument.LiveInstrumentEvent; import spp.protocol.instrument.LiveMeter; +import spp.protocol.instrument.event.LiveInstrumentEvent; import spp.protocol.instrument.meter.MeterType; import javax.swing.*; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index f577abcd9..867837bc5 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -26,7 +26,13 @@ import spp.jetbrains.sourcemarker.settings.LiveLogConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.artifact.log.Log; -import spp.protocol.instrument.*; +import spp.protocol.instrument.LiveInstrument; +import spp.protocol.instrument.LiveLog; +import spp.protocol.instrument.LiveSourceLocation; +import spp.protocol.instrument.event.LiveInstrumentEvent; +import spp.protocol.instrument.event.LiveInstrumentRemoved; +import spp.protocol.instrument.throttle.InstrumentThrottle; +import spp.protocol.instrument.throttle.ThrottleStep; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -53,8 +59,8 @@ import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; -import static spp.protocol.instrument.LiveInstrumentEventType.LOG_HIT; -import static spp.protocol.instrument.LiveInstrumentEventType.LOG_REMOVED; +import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_HIT; +import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_REMOVED; public class LogStatusBar extends JPanel implements StatusBar, VisibleAreaListener, InstrumentEventListener { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index 61e66775c..994dd56c0 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -22,9 +22,9 @@ import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveInstrument; -import spp.protocol.instrument.LiveInstrumentRemoved; import spp.protocol.instrument.LiveMeter; import spp.protocol.instrument.LiveSourceLocation; +import spp.protocol.instrument.event.LiveInstrumentRemoved; import spp.protocol.instrument.meter.MeterType; import spp.protocol.instrument.meter.MetricValue; import spp.protocol.instrument.meter.MetricValueType; @@ -47,7 +47,7 @@ import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; -import static spp.protocol.instrument.LiveInstrumentEventType.METER_REMOVED; +import static spp.protocol.instrument.event.LiveInstrumentEventType.METER_REMOVED; public class MeterStatusBar extends JPanel implements StatusBar, VisibleAreaListener { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index fc334a10b..9a5c1891f 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -22,9 +22,9 @@ import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveInstrument; -import spp.protocol.instrument.LiveInstrumentRemoved; import spp.protocol.instrument.LiveSourceLocation; import spp.protocol.instrument.LiveSpan; +import spp.protocol.instrument.event.LiveInstrumentRemoved; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -44,7 +44,7 @@ import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; -import static spp.protocol.instrument.LiveInstrumentEventType.METER_REMOVED; +import static spp.protocol.instrument.event.LiveInstrumentEventType.METER_REMOVED; public class SpanStatusBar extends JPanel implements StatusBar, VisibleAreaListener { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/InstrumentEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/InstrumentEventListener.kt index 80d469981..089e3fe85 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/InstrumentEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/InstrumentEventListener.kt @@ -17,7 +17,7 @@ */ package spp.jetbrains.sourcemarker.service -import spp.protocol.instrument.LiveInstrumentEvent +import spp.protocol.instrument.event.LiveInstrumentEvent /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 7fcda61bf..b8eb3bb01 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -37,9 +37,9 @@ import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated import spp.protocol.SourceMarkerServices.Instance import spp.protocol.SourceMarkerServices.Provide -import spp.protocol.instrument.* -import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit -import spp.protocol.instrument.log.event.LiveLogHit +import spp.protocol.instrument.LiveBreakpoint +import spp.protocol.instrument.LiveLog +import spp.protocol.instrument.event.* /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index 6dd1af2d7..52ebd5ef4 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -52,8 +52,8 @@ import spp.protocol.artifact.trace.Trace import spp.protocol.artifact.trace.TraceOrderType import spp.protocol.artifact.trace.TraceResult import spp.protocol.artifact.trace.TraceSpan -import spp.protocol.instrument.LiveInstrumentEvent -import spp.protocol.instrument.LiveInstrumentEventType.METER_UPDATED +import spp.protocol.instrument.event.LiveInstrumentEvent +import spp.protocol.instrument.event.LiveInstrumentEventType.METER_UPDATED import spp.protocol.instrument.meter.MeterType import spp.protocol.view.LiveViewEvent import java.net.URI diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointEventColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointEventColumnInfo.kt index 757ddba29..95f7a8ac4 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointEventColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointEventColumnInfo.kt @@ -19,13 +19,13 @@ package spp.jetbrains.sourcemarker.service.breakpoint import com.intellij.util.ui.ColumnInfo import com.intellij.util.ui.table.IconTableCellRenderer +import kotlinx.datetime.toJavaInstant +import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons import spp.protocol.artifact.exception.methodName import spp.protocol.artifact.exception.qualifiedClassName import spp.protocol.artifact.exception.shortQualifiedClassName import spp.protocol.artifact.exception.sourceAsLineNumber -import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit -import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons -import kotlinx.datetime.toJavaInstant +import spp.protocol.instrument.event.LiveBreakpointHit import java.time.ZoneId import java.time.format.DateTimeFormatter import javax.swing.Icon diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt index 8277afeab..ebd279b0d 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt @@ -18,14 +18,14 @@ package spp.jetbrains.sourcemarker.service.breakpoint import com.intellij.util.ui.ColumnInfo -import spp.protocol.instrument.LiveInstrumentEvent -import spp.protocol.instrument.LiveInstrumentEventType -import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit -import spp.protocol.utils.toPrettyDuration -import spp.jetbrains.sourcemarker.PluginBundle.message import io.vertx.core.json.Json import kotlinx.datetime.Clock -import spp.protocol.instrument.LiveInstrumentRemoved +import spp.jetbrains.sourcemarker.PluginBundle.message +import spp.protocol.instrument.event.LiveBreakpointHit +import spp.protocol.instrument.event.LiveInstrumentEvent +import spp.protocol.instrument.event.LiveInstrumentEventType +import spp.protocol.instrument.event.LiveInstrumentRemoved +import spp.protocol.utils.toPrettyDuration /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt index 29834a73d..5c6e01d7a 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt @@ -30,12 +30,12 @@ import com.intellij.ui.content.ContentManager import com.intellij.ui.content.ContentManagerEvent import com.intellij.ui.content.ContentManagerListener import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter -import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit +import org.slf4j.LoggerFactory import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_BREAKPOINT_DISABLED_ICON import spp.jetbrains.sourcemarker.service.breakpoint.LiveBreakpointConstants.LIVE_BREAKPOINT_NAME import spp.jetbrains.sourcemarker.service.breakpoint.ui.BreakpointHitWindow import spp.jetbrains.sourcemarker.service.breakpoint.ui.EventsWindow -import org.slf4j.LoggerFactory +import spp.protocol.instrument.event.LiveBreakpointHit /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableRootSimpleNode.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableRootSimpleNode.kt index fa0665105..82f7cf57d 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableRootSimpleNode.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableRootSimpleNode.kt @@ -24,7 +24,7 @@ import spp.jetbrains.marker.jvm.JVMVariableSimpleNode import spp.jetbrains.marker.py.PythonVariableRootNode import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.PYCHARM_PRODUCT_CODES import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager -import spp.protocol.instrument.LiveVariableScope +import spp.protocol.instrument.variable.LiveVariableScope /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsTab.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsTab.kt index 41266d07b..dc5aa5cae 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsTab.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsTab.kt @@ -29,7 +29,7 @@ import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_BREAKPOINT_ACTIVE_ICON import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointEventColumnInfo import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService -import spp.protocol.instrument.breakpoint.event.LiveBreakpointHit +import spp.protocol.instrument.event.LiveBreakpointHit import java.awt.BorderLayout import java.awt.Point import java.awt.event.MouseAdapter diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt index 80dbce022..5e0535459 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt @@ -18,14 +18,14 @@ package spp.jetbrains.sourcemarker.service.log import com.intellij.util.ui.ColumnInfo -import spp.protocol.instrument.LiveInstrumentEvent -import spp.protocol.instrument.LiveInstrumentEventType -import spp.protocol.instrument.log.event.LiveLogHit -import spp.protocol.utils.toPrettyDuration -import spp.jetbrains.sourcemarker.PluginBundle.message import io.vertx.core.json.Json import kotlinx.datetime.Clock -import spp.protocol.instrument.LiveInstrumentRemoved +import spp.jetbrains.sourcemarker.PluginBundle.message +import spp.protocol.instrument.event.LiveInstrumentEvent +import spp.protocol.instrument.event.LiveInstrumentEventType +import spp.protocol.instrument.event.LiveInstrumentRemoved +import spp.protocol.instrument.event.LiveLogHit +import spp.protocol.utils.toPrettyDuration /** * todo: description. From d0f9347150685f39dfada47b68f1579522606b55 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 16:36:55 -0500 Subject: [PATCH 010/115] clean --- .../spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt index 5f23fdbbc..e94cec454 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt @@ -31,7 +31,6 @@ import monitor.skywalking.protocol.trace.QueryTraceQuery import monitor.skywalking.protocol.type.QueryOrder import monitor.skywalking.protocol.type.TraceState import spp.protocol.artifact.ArtifactQualifiedName -import java.math.BigDecimal fun toProtocol( artifactQualifiedName: ArtifactQualifiedName, From 3fac954c7d9661e146ea274217df92fd39b2bae5 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 16:44:13 -0500 Subject: [PATCH 011/115] organize imports --- .../mapper/api/impl/SourceMapperImpl.kt | 2 +- .../mapper/vcs/git/GitRepositoryMapper.kt | 2 +- .../mapper/vcs/git/LogFollowCommand.kt | 8 +++---- .../integration/GroovyModificationTest.kt | 10 ++++----- .../integration/JavaModificationTest.kt | 10 ++++----- .../integration/KotlinModificationTest.kt | 10 ++++----- .../jetbrains/marker/jvm/ArtifactSearch.kt | 8 +++---- .../marker/jvm/JVMArtifactNamingService.kt | 4 ++-- .../marker/jvm/JVMSourceInlayHintProvider.kt | 10 ++++----- .../marker/jvm/psi/EndpointDetector.kt | 12 +++++------ .../marker/jvm/psi/LoggerDetector.kt | 8 +++---- .../psi/endpoint/SkywalkingTraceEndpoint.kt | 4 ++-- .../jvm/psi/endpoint/SpringMVCEndpoint.kt | 4 ++-- .../marker/py/PythonLineMarkerProvider.kt | 2 +- .../marker/plugin/SourceLineMarkerProvider.kt | 2 +- .../marker/source/SourceFileMarker.kt | 2 +- .../source/mark/SourceMarkPopupAction.kt | 4 ++-- .../monitor/skywalking/SkywalkingClient.kt | 7 +++---- .../skywalking/SkywalkingExtensions.kt | 12 +++++------ .../skywalking/bridge/EndpointBridge.kt | 2 +- .../bridge/EndpointMetricsBridge.kt | 6 +++--- .../skywalking/bridge/EndpointTracesBridge.kt | 12 +++++------ .../monitor/skywalking/bridge/LogsBridge.kt | 12 +++++------ .../skywalking/bridge/ServiceBridge.kt | 4 ++-- .../bridge/ServiceInstanceBridge.kt | 4 ++-- .../skywalking/model/GetEndpointMetrics.kt | 2 +- .../model/GetMultipleEndpointMetrics.kt | 2 +- .../monitor/skywalking/model/ZonedDuration.kt | 2 +- .../jetbrains/sourcemarker/ControlBar.java | 5 +---- .../element/LiveControlBarRow.java | 21 ++++--------------- .../LiveBreakpointConfigurationPanel.java | 3 +-- .../settings/LiveLogConfigurationPanel.java | 9 ++++---- .../status/LiveBreakpointStatusPanel.java | 12 ++--------- .../PluginSourceMarkerStartupActivity.kt | 6 +++--- .../console/SourceMarkerToolWindowFactory.kt | 2 +- .../sourcemarker/mark/SourceMarkKeys.kt | 4 ++-- .../sourcemarker/reporting/error-report.kt | 4 ++-- .../breakpoint/ExecutionPointManager.kt | 2 +- .../painter/VariableEditorLinePainter.kt | 1 - .../breakpoint/ui/BreakpointHitWindow.kt | 6 +++--- .../service/breakpoint/ui/EventsWindow.kt | 2 +- .../service/breakpoint/ui/FramesTab.kt | 4 ++-- .../settings/SourceMarkerConfigurable.kt | 4 ++-- .../status/util/AutocompleteField.kt | 2 +- .../spp/jetbrains/StandaloneLogsLiveView.kt | 14 ++++++------- .../spp/jetbrains/StandaloneTracesLiveView.kt | 14 ++++++------- .../mapper/vcs/git/GitRepositoryMapperTest.kt | 2 +- .../mapper/vcs/git/MethodRenameTest.kt | 10 ++++----- .../portal/display/views/ActivityViewTest.kt | 12 +++++------ .../endpoint/GroovyEndpointDetectorTest.kt | 4 ++-- .../psi/endpoint/JavaEndpointDetectorTest.kt | 4 ++-- .../endpoint/KotlinEndpointDetectorTest.kt | 4 ++-- .../endpoint/ScalaEndpointNameDetectorTest.kt | 4 ++-- .../InstrumentConditionParserTest.kt | 4 ++-- 54 files changed, 149 insertions(+), 177 deletions(-) diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/api/impl/SourceMapperImpl.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/api/impl/SourceMapperImpl.kt index 3274951d9..edf50d779 100644 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/api/impl/SourceMapperImpl.kt +++ b/mapper/src/main/kotlin/spp/jetbrains/mapper/api/impl/SourceMapperImpl.kt @@ -17,12 +17,12 @@ */ package spp.jetbrains.mapper.api.impl +import org.slf4j.LoggerFactory import spp.jetbrains.mapper.api.SourceMapper import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper import spp.jetbrains.mapper.vcs.git.LogFollowCommand import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.LocalArtifact -import org.slf4j.LoggerFactory import java.util.* /** diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapper.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapper.kt index 2aa24aa02..550ad7483 100644 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapper.kt +++ b/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapper.kt @@ -18,7 +18,6 @@ package spp.jetbrains.mapper.vcs.git import com.google.common.base.Preconditions -import spp.jetbrains.mapper.extend.SourceCodeTokenizer import jp.ac.titech.c.se.stein.PorcelainAPI import jp.ac.titech.c.se.stein.core.Context import jp.ac.titech.c.se.stein.core.EntrySet @@ -29,6 +28,7 @@ import org.eclipse.jgit.api.Git import org.eclipse.jgit.internal.storage.file.FileRepository import org.eclipse.jgit.lib.Repository import org.slf4j.LoggerFactory +import spp.jetbrains.mapper.extend.SourceCodeTokenizer import java.io.File import java.nio.charset.StandardCharsets import java.util.* diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/LogFollowCommand.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/LogFollowCommand.kt index 4a33d2b2f..72ee91365 100644 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/LogFollowCommand.kt +++ b/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/LogFollowCommand.kt @@ -17,10 +17,6 @@ */ package spp.jetbrains.mapper.vcs.git -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import spp.protocol.artifact.LocalArtifact import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.errors.GitAPIException import org.eclipse.jgit.diff.DiffEntry @@ -33,6 +29,10 @@ import org.eclipse.jgit.lib.Repository import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.treewalk.TreeWalk import org.slf4j.LoggerFactory +import spp.jetbrains.mapper.api.impl.SourceMapperImpl +import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType +import spp.protocol.artifact.LocalArtifact import java.io.IOException /** diff --git a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/GroovyModificationTest.kt b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/GroovyModificationTest.kt index 9966e013c..69d914876 100644 --- a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/GroovyModificationTest.kt +++ b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/GroovyModificationTest.kt @@ -17,11 +17,6 @@ */ package spp.jetbrains.mapper.integration -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.jetbrains.mapper.extend.SourceCodeTokenizer -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType import org.eclipse.jgit.api.Git import org.eclipse.jgit.internal.storage.file.FileRepository import org.eclipse.jgit.lib.Constants @@ -29,6 +24,11 @@ import org.intellij.lang.annotations.Language import org.junit.Assert.* import org.junit.Ignore import org.junit.Test +import spp.jetbrains.mapper.api.impl.SourceMapperImpl +import spp.jetbrains.mapper.extend.SourceCodeTokenizer +import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper +import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType import java.io.File import java.nio.file.Files import java.util.* diff --git a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/JavaModificationTest.kt b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/JavaModificationTest.kt index 2fbacf4a5..94eddf0a2 100644 --- a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/JavaModificationTest.kt +++ b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/JavaModificationTest.kt @@ -17,11 +17,6 @@ */ package spp.jetbrains.mapper.integration -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.jetbrains.mapper.extend.SourceCodeTokenizer -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType import org.eclipse.jgit.api.Git import org.eclipse.jgit.internal.storage.file.FileRepository import org.eclipse.jgit.lib.Constants @@ -29,6 +24,11 @@ import org.intellij.lang.annotations.Language import org.junit.Assert.* import org.junit.Ignore import org.junit.Test +import spp.jetbrains.mapper.api.impl.SourceMapperImpl +import spp.jetbrains.mapper.extend.SourceCodeTokenizer +import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper +import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType import java.io.File import java.nio.file.Files import java.util.* diff --git a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/KotlinModificationTest.kt b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/KotlinModificationTest.kt index ee9ac3caf..33faa1d71 100644 --- a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/KotlinModificationTest.kt +++ b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/KotlinModificationTest.kt @@ -17,11 +17,6 @@ */ package spp.jetbrains.mapper.integration -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.jetbrains.mapper.extend.SourceCodeTokenizer -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType import org.eclipse.jgit.api.Git import org.eclipse.jgit.internal.storage.file.FileRepository import org.eclipse.jgit.lib.Constants @@ -29,6 +24,11 @@ import org.intellij.lang.annotations.Language import org.junit.Assert.* import org.junit.Ignore import org.junit.Test +import spp.jetbrains.mapper.api.impl.SourceMapperImpl +import spp.jetbrains.mapper.extend.SourceCodeTokenizer +import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper +import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType import java.io.File import java.nio.file.Files import java.util.* diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt index 5f10d7f9c..155fe27eb 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt @@ -26,10 +26,6 @@ import com.intellij.psi.* import com.intellij.psi.search.FileTypeIndex import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.ProjectScope -import spp.jetbrains.marker.jvm.psi.EndpointDetector -import spp.jetbrains.marker.source.JVMMarkerUtils -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType import io.vertx.core.Promise import io.vertx.core.Vertx import io.vertx.kotlin.coroutines.await @@ -42,6 +38,10 @@ import org.jetbrains.uast.UMethod import org.jetbrains.uast.toUElement import org.jetbrains.uast.toUElementOfType import org.slf4j.LoggerFactory +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.marker.source.JVMMarkerUtils +import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType import spp.protocol.utils.ArtifactNameUtils import java.util.* diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMArtifactNamingService.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMArtifactNamingService.kt index b7d661c21..cad9a12fa 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMArtifactNamingService.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMArtifactNamingService.kt @@ -20,12 +20,12 @@ package spp.jetbrains.marker.jvm import com.intellij.psi.PsiClassOwner import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile -import spp.jetbrains.marker.ArtifactNamingService -import spp.jetbrains.marker.source.JVMMarkerUtils import org.jetbrains.uast.UClass import org.jetbrains.uast.UExpression import org.jetbrains.uast.UMethod import org.jetbrains.uast.toUElement +import spp.jetbrains.marker.ArtifactNamingService +import spp.jetbrains.marker.source.JVMMarkerUtils import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMSourceInlayHintProvider.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMSourceInlayHintProvider.kt index e7a33320e..92bbec284 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMSourceInlayHintProvider.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMSourceInlayHintProvider.kt @@ -23,17 +23,17 @@ import com.intellij.openapi.editor.BlockInlayPriority import com.intellij.psi.PsiElement import com.intellij.psi.PsiMethod import com.intellij.psi.PsiStatement -import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.marker.plugin.SourceInlayHintProvider -import spp.jetbrains.marker.source.JVMMarkerUtils -import spp.jetbrains.marker.source.mark.inlay.InlayMark -import spp.jetbrains.marker.source.mark.inlay.config.InlayMarkVirtualText import org.jetbrains.kotlin.psi.KtNamedFunction import org.jetbrains.kotlin.psi.psiUtil.getParentOfType import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod import org.jetbrains.uast.UExpression import org.jetbrains.uast.UMethod import org.jetbrains.uast.toUElement +import spp.jetbrains.marker.SourceMarker +import spp.jetbrains.marker.plugin.SourceInlayHintProvider +import spp.jetbrains.marker.source.JVMMarkerUtils +import spp.jetbrains.marker.source.mark.inlay.InlayMark +import spp.jetbrains.marker.source.mark.inlay.config.InlayMarkVirtualText /** * todo: description. diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt index 78c36de21..41bd2b306 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt @@ -19,12 +19,6 @@ package spp.jetbrains.marker.jvm.psi import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.util.Computable -import spp.jetbrains.marker.jvm.psi.endpoint.SkywalkingTraceEndpoint -import spp.jetbrains.marker.jvm.psi.endpoint.SpringMVCEndpoint -import spp.jetbrains.marker.source.mark.api.MethodSourceMark -import spp.jetbrains.marker.source.mark.api.SourceMark -import spp.jetbrains.marker.source.mark.api.key.SourceKey -import spp.jetbrains.monitor.skywalking.bridge.EndpointBridge import io.vertx.core.Future import io.vertx.core.Promise import io.vertx.core.Vertx @@ -39,6 +33,12 @@ import kotlinx.coroutines.withContext import org.jetbrains.uast.UMethod import org.jetbrains.uast.toUElement import org.slf4j.LoggerFactory +import spp.jetbrains.marker.jvm.psi.endpoint.SkywalkingTraceEndpoint +import spp.jetbrains.marker.jvm.psi.endpoint.SpringMVCEndpoint +import spp.jetbrains.marker.source.mark.api.MethodSourceMark +import spp.jetbrains.marker.source.mark.api.SourceMark +import spp.jetbrains.marker.source.mark.api.key.SourceKey +import spp.jetbrains.monitor.skywalking.bridge.EndpointBridge import java.util.* /** diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/LoggerDetector.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/LoggerDetector.kt index 197065958..3cc3f5d50 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/LoggerDetector.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/LoggerDetector.kt @@ -27,10 +27,6 @@ import com.intellij.psi.PsiElement import com.intellij.psi.PsiMethodCallExpression import com.intellij.refactoring.suggested.endOffset import com.intellij.refactoring.suggested.startOffset -import spp.jetbrains.marker.source.SourceFileMarker -import spp.jetbrains.marker.source.mark.api.MethodSourceMark -import spp.jetbrains.marker.source.mark.api.key.SourceKey -import spp.jetbrains.marker.source.mark.inlay.InlayMark import io.vertx.core.Future import io.vertx.core.Promise import io.vertx.core.Vertx @@ -43,6 +39,10 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.stringValue import org.jetbrains.uast.UMethod import org.jetbrains.uast.toUElement import org.slf4j.LoggerFactory +import spp.jetbrains.marker.source.SourceFileMarker +import spp.jetbrains.marker.source.mark.api.MethodSourceMark +import spp.jetbrains.marker.source.mark.api.key.SourceKey +import spp.jetbrains.marker.source.mark.inlay.InlayMark /** * Detects the presence of log statements within methods and saves log patterns. diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/endpoint/SkywalkingTraceEndpoint.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/endpoint/SkywalkingTraceEndpoint.kt index 0bfc78f64..8b5a905c1 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/endpoint/SkywalkingTraceEndpoint.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/endpoint/SkywalkingTraceEndpoint.kt @@ -18,12 +18,12 @@ package spp.jetbrains.marker.jvm.psi.endpoint import com.intellij.openapi.application.ApplicationManager -import spp.jetbrains.marker.jvm.psi.EndpointDetector -import spp.jetbrains.marker.jvm.psi.EndpointDetector.DetectedEndpoint import io.vertx.core.Future import io.vertx.core.Promise import org.jetbrains.uast.UMethod import org.jetbrains.uast.expressions.UInjectionHost +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.marker.jvm.psi.EndpointDetector.DetectedEndpoint import java.util.* /** diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/endpoint/SpringMVCEndpoint.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/endpoint/SpringMVCEndpoint.kt index 1a504bd27..f219ee4a0 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/endpoint/SpringMVCEndpoint.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/endpoint/SpringMVCEndpoint.kt @@ -19,8 +19,6 @@ package spp.jetbrains.marker.jvm.psi.endpoint import com.intellij.lang.Language import com.intellij.openapi.application.ApplicationManager -import spp.jetbrains.marker.jvm.psi.EndpointDetector -import spp.jetbrains.marker.jvm.psi.EndpointDetector.DetectedEndpoint import io.vertx.core.Future import io.vertx.core.Promise import org.jetbrains.plugins.groovy.lang.psi.uast.GrUReferenceExpression @@ -31,6 +29,8 @@ import org.jetbrains.uast.kotlin.KotlinStringULiteralExpression import org.jetbrains.uast.kotlin.KotlinUQualifiedReferenceExpression import org.jetbrains.uast.kotlin.KotlinUSimpleReferenceExpression import org.jetbrains.uast.kotlin.expressions.KotlinUCollectionLiteralExpression +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.marker.jvm.psi.EndpointDetector.DetectedEndpoint import java.util.* /** diff --git a/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonLineMarkerProvider.kt b/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonLineMarkerProvider.kt index e0b4ae34e..f62219db5 100644 --- a/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonLineMarkerProvider.kt +++ b/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonLineMarkerProvider.kt @@ -20,11 +20,11 @@ package spp.jetbrains.marker.py import com.intellij.codeInsight.daemon.LineMarkerInfo import com.intellij.psi.PsiElement import com.jetbrains.python.psi.PyFile +import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.plugin.SourceLineMarkerProvider import spp.jetbrains.marker.source.SourceFileMarker import spp.jetbrains.marker.source.mark.gutter.GutterMark -import org.slf4j.LoggerFactory /** * Associates Python [GutterMark]s to PSI elements. diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/plugin/SourceLineMarkerProvider.kt b/marker/src/main/kotlin/spp/jetbrains/marker/plugin/SourceLineMarkerProvider.kt index 1510afe5c..070b2da31 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/plugin/SourceLineMarkerProvider.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/plugin/SourceLineMarkerProvider.kt @@ -22,10 +22,10 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo import com.intellij.codeInsight.daemon.LineMarkerProviderDescriptor import com.intellij.openapi.editor.markup.GutterIconRenderer.Alignment.CENTER import com.intellij.psi.PsiElement +import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.source.mark.api.key.SourceKey import spp.jetbrains.marker.source.mark.gutter.GutterMark -import org.slf4j.LoggerFactory /** * Used to associate [GutterMark]s with IntelliJ PSI elements. diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/SourceFileMarker.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/SourceFileMarker.kt index df9ae9579..8b093e294 100755 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/SourceFileMarker.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/SourceFileMarker.kt @@ -26,6 +26,7 @@ import com.intellij.openapi.util.Key import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import com.intellij.psi.PsiNameIdentifierOwner +import org.slf4j.LoggerFactory import spp.jetbrains.marker.source.mark.api.* import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode @@ -35,7 +36,6 @@ import spp.jetbrains.marker.source.mark.gutter.ExpressionGutterMark import spp.jetbrains.marker.source.mark.gutter.MethodGutterMark import spp.jetbrains.marker.source.mark.inlay.ExpressionInlayMark import spp.jetbrains.marker.source.mark.inlay.MethodInlayMark -import org.slf4j.LoggerFactory import spp.protocol.artifact.ArtifactQualifiedName import java.util.* diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/SourceMarkPopupAction.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/SourceMarkPopupAction.kt index 3c4d98954..a890ab2bd 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/SourceMarkPopupAction.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/SourceMarkPopupAction.kt @@ -23,6 +23,8 @@ import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.openapi.util.TextRange +import org.jetbrains.annotations.NotNull +import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.source.SourceFileMarker import spp.jetbrains.marker.source.mark.api.ClassSourceMark @@ -30,8 +32,6 @@ import spp.jetbrains.marker.source.mark.api.MethodSourceMark import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode -import org.jetbrains.annotations.NotNull -import org.slf4j.LoggerFactory /** * todo: description. diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt index 2feb65aca..6711dcbd7 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt @@ -20,9 +20,6 @@ package spp.jetbrains.monitor.skywalking import com.apollographql.apollo3.ApolloClient import com.apollographql.apollo3.api.Optional import com.codahale.metrics.MetricRegistry -import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics -import spp.jetbrains.monitor.skywalking.model.GetEndpointTraces -import spp.jetbrains.monitor.skywalking.model.GetMultipleEndpointMetrics import io.vertx.core.Vertx import monitor.skywalking.protocol.log.QueryLogsQuery import monitor.skywalking.protocol.metadata.GetAllServicesQuery @@ -34,12 +31,14 @@ import monitor.skywalking.protocol.trace.QueryBasicTracesQuery import monitor.skywalking.protocol.trace.QueryTraceQuery import monitor.skywalking.protocol.type.* import org.slf4j.LoggerFactory +import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics +import spp.jetbrains.monitor.skywalking.model.GetEndpointTraces +import spp.jetbrains.monitor.skywalking.model.GetMultipleEndpointMetrics import spp.protocol.util.LocalMessageCodec import java.io.IOException import java.time.ZoneOffset.ofHours import java.time.ZonedDateTime import java.time.format.DateTimeFormatter -import java.util.* /** * Used to communicate with Apache SkyWalking. diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt index e94cec454..22d6dd1a9 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt @@ -17,12 +17,6 @@ */ package spp.jetbrains.monitor.skywalking -import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics -import spp.protocol.artifact.QueryTimeFrame -import spp.protocol.artifact.metrics.ArtifactMetricResult -import spp.protocol.artifact.metrics.ArtifactMetrics -import spp.protocol.artifact.metrics.MetricType -import spp.protocol.artifact.trace.* import kotlinx.datetime.Instant import monitor.skywalking.protocol.metrics.GetLinearIntValuesQuery import monitor.skywalking.protocol.metrics.GetMultipleLinearIntValuesQuery @@ -30,7 +24,13 @@ import monitor.skywalking.protocol.trace.QueryBasicTracesQuery import monitor.skywalking.protocol.trace.QueryTraceQuery import monitor.skywalking.protocol.type.QueryOrder import monitor.skywalking.protocol.type.TraceState +import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.QueryTimeFrame +import spp.protocol.artifact.metrics.ArtifactMetricResult +import spp.protocol.artifact.metrics.ArtifactMetrics +import spp.protocol.artifact.metrics.MetricType +import spp.protocol.artifact.trace.* fun toProtocol( artifactQualifiedName: ArtifactQualifiedName, diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt index 5c0b6772c..c52685b98 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt @@ -17,7 +17,6 @@ */ package spp.jetbrains.monitor.skywalking.bridge -import spp.jetbrains.monitor.skywalking.SkywalkingClient import io.vertx.core.Vertx import io.vertx.core.eventbus.ReplyException import io.vertx.core.eventbus.ReplyFailure @@ -27,6 +26,7 @@ import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.launch import monitor.skywalking.protocol.metadata.SearchEndpointQuery import org.slf4j.LoggerFactory +import spp.jetbrains.monitor.skywalking.SkywalkingClient import spp.protocol.util.LocalMessageCodec /** diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointMetricsBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointMetricsBridge.kt index ff347568d..ce2fdab7f 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointMetricsBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointMetricsBridge.kt @@ -17,9 +17,6 @@ */ package spp.jetbrains.monitor.skywalking.bridge -import spp.jetbrains.monitor.skywalking.SkywalkingClient -import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics -import spp.jetbrains.monitor.skywalking.model.GetMultipleEndpointMetrics import io.vertx.core.Vertx import io.vertx.kotlin.coroutines.CoroutineVerticle import io.vertx.kotlin.coroutines.await @@ -27,6 +24,9 @@ import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.launch import monitor.skywalking.protocol.metrics.GetLinearIntValuesQuery import monitor.skywalking.protocol.metrics.GetMultipleLinearIntValuesQuery +import spp.jetbrains.monitor.skywalking.SkywalkingClient +import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics +import spp.jetbrains.monitor.skywalking.model.GetMultipleEndpointMetrics /** * todo: description. diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointTracesBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointTracesBridge.kt index 1e5d39881..9e6f43b5a 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointTracesBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointTracesBridge.kt @@ -17,18 +17,18 @@ */ package spp.jetbrains.monitor.skywalking.bridge -import spp.jetbrains.monitor.skywalking.SkywalkingClient -import spp.jetbrains.monitor.skywalking.model.GetEndpointTraces -import spp.jetbrains.monitor.skywalking.toProtocol -import spp.protocol.artifact.trace.Trace -import spp.protocol.artifact.trace.TraceResult -import spp.protocol.artifact.trace.TraceSpanStackQueryResult import io.vertx.core.Vertx import io.vertx.kotlin.coroutines.CoroutineVerticle import io.vertx.kotlin.coroutines.await import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.launch import kotlinx.datetime.Instant +import spp.jetbrains.monitor.skywalking.SkywalkingClient +import spp.jetbrains.monitor.skywalking.model.GetEndpointTraces +import spp.jetbrains.monitor.skywalking.toProtocol +import spp.protocol.artifact.trace.Trace +import spp.protocol.artifact.trace.TraceResult +import spp.protocol.artifact.trace.TraceSpanStackQueryResult /** * todo: description. diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt index a3c791eb8..2317c985c 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt @@ -18,12 +18,6 @@ package spp.jetbrains.monitor.skywalking.bridge import com.apollographql.apollo3.api.Optional -import spp.jetbrains.monitor.skywalking.SkywalkingClient -import spp.jetbrains.monitor.skywalking.model.ZonedDuration -import spp.protocol.artifact.exception.LiveStackTrace -import spp.protocol.artifact.log.Log -import spp.protocol.artifact.log.LogOrderType -import spp.protocol.artifact.log.LogResult import io.vertx.core.AsyncResult import io.vertx.core.Future import io.vertx.core.Vertx @@ -35,6 +29,12 @@ import kotlinx.datetime.Clock import kotlinx.datetime.Instant import monitor.skywalking.protocol.type.LogQueryCondition import monitor.skywalking.protocol.type.Pagination +import spp.jetbrains.monitor.skywalking.SkywalkingClient +import spp.jetbrains.monitor.skywalking.model.ZonedDuration +import spp.protocol.artifact.exception.LiveStackTrace +import spp.protocol.artifact.log.Log +import spp.protocol.artifact.log.LogOrderType +import spp.protocol.artifact.log.LogResult import spp.protocol.util.LocalMessageCodec /** diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt index dabaf68cf..806b204c3 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt @@ -17,8 +17,6 @@ */ package spp.jetbrains.monitor.skywalking.bridge -import spp.jetbrains.monitor.skywalking.SkywalkingClient -import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep import io.vertx.core.Vertx import io.vertx.core.eventbus.MessageConsumer import io.vertx.kotlin.coroutines.CoroutineVerticle @@ -26,6 +24,8 @@ import io.vertx.kotlin.coroutines.await import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.launch import monitor.skywalking.protocol.metadata.GetAllServicesQuery +import spp.jetbrains.monitor.skywalking.SkywalkingClient +import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep import java.time.ZonedDateTime /** diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceInstanceBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceInstanceBridge.kt index 934246abf..feed39454 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceInstanceBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceInstanceBridge.kt @@ -17,8 +17,6 @@ */ package spp.jetbrains.monitor.skywalking.bridge -import spp.jetbrains.monitor.skywalking.SkywalkingClient -import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep import io.vertx.core.Vertx import io.vertx.core.eventbus.MessageConsumer import io.vertx.kotlin.coroutines.CoroutineVerticle @@ -26,6 +24,8 @@ import io.vertx.kotlin.coroutines.await import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.launch import monitor.skywalking.protocol.metadata.GetServiceInstancesQuery +import spp.jetbrains.monitor.skywalking.SkywalkingClient +import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep import java.time.ZonedDateTime /** diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/GetEndpointMetrics.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/GetEndpointMetrics.kt index d744929de..389b6a05a 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/GetEndpointMetrics.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/GetEndpointMetrics.kt @@ -17,8 +17,8 @@ */ package spp.jetbrains.monitor.skywalking.model -import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep import kotlinx.datetime.Instant +import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep import java.time.Duration import java.time.Period import java.time.ZonedDateTime diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/GetMultipleEndpointMetrics.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/GetMultipleEndpointMetrics.kt index 52e4506ef..4f32aaa18 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/GetMultipleEndpointMetrics.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/GetMultipleEndpointMetrics.kt @@ -17,8 +17,8 @@ */ package spp.jetbrains.monitor.skywalking.model -import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep import kotlinx.datetime.Instant +import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep import java.time.Duration import java.time.Period import java.time.ZonedDateTime diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/ZonedDuration.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/ZonedDuration.kt index ca7549b56..a3cc7c186 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/ZonedDuration.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/model/ZonedDuration.kt @@ -17,8 +17,8 @@ */ package spp.jetbrains.monitor.skywalking.model -import spp.jetbrains.monitor.skywalking.SkywalkingClient import monitor.skywalking.protocol.type.Duration +import spp.jetbrains.monitor.skywalking.SkywalkingClient import java.time.ZonedDateTime /** diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java index 2b4ecba56..b7dbf941b 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java @@ -24,10 +24,7 @@ import java.util.function.Function; import java.util.stream.Collectors; -import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_LIGHT_PLAIN_17; -import static spp.jetbrains.sourcemarker.PluginUI.SELECT_COLOR_RED; -import static spp.jetbrains.sourcemarker.PluginUI.STATUS_BAR_TXT_BG_COLOR; -import static spp.jetbrains.sourcemarker.PluginUI.DFLT_BGND_COLOR; +import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; public class ControlBar extends JPanel implements VisibleAreaListener { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/element/LiveControlBarRow.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/element/LiveControlBarRow.java index df7bbe2fb..72edad976 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/element/LiveControlBarRow.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/element/LiveControlBarRow.java @@ -2,27 +2,14 @@ import com.intellij.util.ui.UIUtil; import com.jgoodies.forms.factories.FormFactory; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.ColumnSpec; -import com.jgoodies.forms.layout.FormLayout; -import com.jgoodies.forms.layout.FormSpec; -import com.jgoodies.forms.layout.RowSpec; -import com.jgoodies.forms.layout.Sizes; +import com.jgoodies.forms.layout.*; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import static spp.jetbrains.sourcemarker.PluginUI.CONTROL_BAR_CMD_FOREGROUND; -import static spp.jetbrains.sourcemarker.PluginUI.PANEL_BACKGROUND_COLOR; -import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_PLAIN_11; -import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_PLAIN_15; -import static spp.jetbrains.sourcemarker.PluginUI.SELECT_COLOR_RED; +import java.util.*; + +import static spp.jetbrains.sourcemarker.PluginUI.*; public class LiveControlBarRow extends JPanel { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/LiveBreakpointConfigurationPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/LiveBreakpointConfigurationPanel.java index 3adfa139a..a9e065b7b 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/LiveBreakpointConfigurationPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/LiveBreakpointConfigurationPanel.java @@ -1,11 +1,10 @@ package spp.jetbrains.sourcemarker.settings; +import net.miginfocom.swing.MigLayout; import spp.jetbrains.sourcemarker.PluginUI; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; -import net.miginfocom.swing.MigLayout; import javax.swing.*; -import javax.swing.border.LineBorder; import java.awt.*; import java.util.Objects; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/LiveLogConfigurationPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/LiveLogConfigurationPanel.java index db859a3c1..c3114b324 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/LiveLogConfigurationPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/LiveLogConfigurationPanel.java @@ -6,28 +6,27 @@ import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.psi.PsiFile; import com.intellij.ui.EditorTextField; -import com.intellij.util.ui.UIUtil; import com.intellij.xdebugger.XDebuggerUtil; import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.XSourcePosition; import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl; import com.intellij.xdebugger.impl.ui.XDebuggerExpressionComboBox; +import net.miginfocom.swing.MigLayout; +import org.jetbrains.annotations.NotNull; import spp.jetbrains.marker.source.mark.inlay.InlayMark; import spp.jetbrains.sourcemarker.PluginUI; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; -import net.miginfocom.swing.MigLayout; -import org.jetbrains.annotations.NotNull; import javax.swing.*; -import javax.swing.border.LineBorder; import java.awt.*; import java.util.Objects; import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.DFLT_BGND_COLOR; import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_LIGHT_PLAIN_15; -import static spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.*; +import static spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.INTELLIJ_PRODUCT_CODES; +import static spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.PYCHARM_PRODUCT_CODES; public class LiveLogConfigurationPanel extends JPanel { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveBreakpointStatusPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveBreakpointStatusPanel.java index ab53b3640..b89311e38 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveBreakpointStatusPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveBreakpointStatusPanel.java @@ -2,12 +2,7 @@ import com.codahale.metrics.Meter; import com.jgoodies.forms.factories.FormFactory; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.ColumnSpec; -import com.jgoodies.forms.layout.FormLayout; -import com.jgoodies.forms.layout.FormSpec; -import com.jgoodies.forms.layout.RowSpec; -import com.jgoodies.forms.layout.Sizes; +import com.jgoodies.forms.layout.*; import spp.jetbrains.sourcemarker.PluginUI; import spp.protocol.utils.TimeUtilsKt; @@ -17,10 +12,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import static spp.jetbrains.sourcemarker.PluginUI.EXPIRY_FOREGROUND_COLOR; -import static spp.jetbrains.sourcemarker.PluginUI.LABEL_FOREGROUND_COLOR1; -import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_LIGHT_PLAIN_15; -import static spp.jetbrains.sourcemarker.PluginUI.SELECT_COLOR_RED; +import static spp.jetbrains.sourcemarker.PluginUI.*; public class LiveBreakpointStatusPanel extends JPanel { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/activities/PluginSourceMarkerStartupActivity.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/activities/PluginSourceMarkerStartupActivity.kt index bdf325791..2cc4ae22c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/activities/PluginSourceMarkerStartupActivity.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/activities/PluginSourceMarkerStartupActivity.kt @@ -23,13 +23,13 @@ import com.intellij.notification.Notifications import com.intellij.openapi.application.ApplicationInfo import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project -import spp.jetbrains.marker.plugin.SourceMarkerStartupActivity -import spp.jetbrains.sourcemarker.PluginBundle -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import kotlinx.coroutines.runBlocking import org.apache.log4j.FileAppender import org.apache.log4j.Logger import org.apache.log4j.PatternLayout +import spp.jetbrains.marker.plugin.SourceMarkerStartupActivity +import spp.jetbrains.sourcemarker.PluginBundle +import spp.jetbrains.sourcemarker.SourceMarkerPlugin /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/console/SourceMarkerToolWindowFactory.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/console/SourceMarkerToolWindowFactory.kt index 767bc480b..2c7fbb05d 100755 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/console/SourceMarkerToolWindowFactory.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/console/SourceMarkerToolWindowFactory.kt @@ -23,10 +23,10 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.wm.ToolWindow import com.intellij.openapi.wm.ToolWindowAnchor import com.intellij.openapi.wm.ToolWindowFactory -import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import io.vertx.core.json.DecodeException import io.vertx.core.json.Json import org.slf4j.LoggerFactory +import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig /** * Displays logs from the SourceMarker plugin to a console window. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt index c7e5b046c..b1df1a0b5 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt @@ -17,11 +17,11 @@ */ package spp.jetbrains.sourcemarker.mark +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.marker.jvm.psi.LoggerDetector import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.key.SourceKey import spp.jetbrains.portal.SourcePortal -import spp.jetbrains.marker.jvm.psi.EndpointDetector -import spp.jetbrains.marker.jvm.psi.LoggerDetector import spp.jetbrains.sourcemarker.service.InstrumentEventListener import spp.jetbrains.sourcemarker.status.StatusBar diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt index 8e245e3a1..6e3e4309c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt @@ -45,8 +45,6 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.SystemInfo import com.intellij.util.Consumer import com.intellij.util.io.decodeBase64 -import spp.jetbrains.sourcemarker.PluginBundle -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import io.vertx.core.json.JsonObject import org.eclipse.egit.github.core.Issue import org.eclipse.egit.github.core.Label @@ -54,6 +52,8 @@ import org.eclipse.egit.github.core.RepositoryId import org.eclipse.egit.github.core.client.GitHubClient import org.eclipse.egit.github.core.service.IssueService import org.slf4j.LoggerFactory +import spp.jetbrains.sourcemarker.PluginBundle +import spp.jetbrains.sourcemarker.SourceMarkerPlugin import java.awt.Component import java.io.IOException import java.io.PrintWriter diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ExecutionPointManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ExecutionPointManager.kt index 6e57ced09..8dfb34f2c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ExecutionPointManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ExecutionPointManager.kt @@ -25,10 +25,10 @@ import com.intellij.openapi.fileEditor.OpenFileDescriptor import com.intellij.openapi.project.Project import com.intellij.xdebugger.XDebuggerUtil import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter +import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker import spp.protocol.artifact.exception.qualifiedClassName import spp.protocol.artifact.exception.sourceAsLineNumber -import org.slf4j.LoggerFactory /** * todo: probably don't need this as the breakpoint bar serves as the execution point indicator diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/painter/VariableEditorLinePainter.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/painter/VariableEditorLinePainter.kt index 726a8fe58..802caca68 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/painter/VariableEditorLinePainter.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/painter/VariableEditorLinePainter.kt @@ -29,7 +29,6 @@ import com.intellij.xdebugger.ui.DebuggerColors import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService import java.awt.Color import java.awt.Font -import java.util.* /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/BreakpointHitWindow.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/BreakpointHitWindow.kt index fe887de0a..a8b0c17c0 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/BreakpointHitWindow.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/BreakpointHitWindow.kt @@ -29,14 +29,14 @@ import com.intellij.openapi.util.Disposer import com.intellij.ui.content.Content import com.intellij.util.concurrency.AppExecutorUtil import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter -import spp.protocol.artifact.exception.LiveStackTrace -import spp.protocol.artifact.exception.LiveStackTraceElement +import io.vertx.core.json.Json import spp.jetbrains.sourcemarker.service.breakpoint.DebugStackFrameListener import spp.jetbrains.sourcemarker.service.breakpoint.ExecutionPointManager import spp.jetbrains.sourcemarker.service.breakpoint.LiveBreakpointConstants import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import io.vertx.core.json.Json +import spp.protocol.artifact.exception.LiveStackTrace +import spp.protocol.artifact.exception.LiveStackTraceElement import java.util.concurrent.CopyOnWriteArrayList import javax.swing.JComponent diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsWindow.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsWindow.kt index c6705f6e0..288bdff35 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsWindow.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsWindow.kt @@ -23,8 +23,8 @@ import com.intellij.icons.AllIcons import com.intellij.openapi.Disposable import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer -import spp.jetbrains.sourcemarker.service.breakpoint.LiveBreakpointConstants import spp.jetbrains.sourcemarker.service.breakpoint.DebugStackFrameListener +import spp.jetbrains.sourcemarker.service.breakpoint.LiveBreakpointConstants import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager import java.util.concurrent.CopyOnWriteArrayList import javax.swing.JComponent diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/FramesTab.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/FramesTab.kt index 38aa5c733..9a461f483 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/FramesTab.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/FramesTab.kt @@ -24,11 +24,11 @@ import com.intellij.ui.ColoredListCellRenderer import com.intellij.ui.SimpleTextAttributes import com.intellij.ui.components.JBList import com.intellij.ui.components.JBScrollPane -import spp.protocol.artifact.exception.LiveStackTraceElement -import spp.protocol.artifact.exception.sourceAsLineNumber import spp.jetbrains.sourcemarker.service.breakpoint.DebugStackFrameListener import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig +import spp.protocol.artifact.exception.LiveStackTraceElement +import spp.protocol.artifact.exception.sourceAsLineNumber import java.awt.BorderLayout import javax.swing.JList import javax.swing.JPanel diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/settings/SourceMarkerConfigurable.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/settings/SourceMarkerConfigurable.kt index cf6da5ded..39f07ba60 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/settings/SourceMarkerConfigurable.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/settings/SourceMarkerConfigurable.kt @@ -21,12 +21,12 @@ import com.intellij.ide.util.PropertiesComponent import com.intellij.openapi.options.Configurable import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.ProjectManager -import spp.jetbrains.sourcemarker.PluginBundle.message -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import io.vertx.core.json.DecodeException import io.vertx.core.json.Json import kotlinx.coroutines.runBlocking import org.slf4j.LoggerFactory +import spp.jetbrains.sourcemarker.PluginBundle.message +import spp.jetbrains.sourcemarker.SourceMarkerPlugin import javax.swing.JComponent /** diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt index d1578b7ed..b42dcfc0f 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt @@ -24,8 +24,8 @@ import com.intellij.util.ui.JBUI import com.intellij.util.ui.UIUtil import spp.jetbrains.sourcemarker.PluginIcons import spp.jetbrains.sourcemarker.PluginUI.* -import spp.jetbrains.sourcemarker.service.log.VariableParser import spp.jetbrains.sourcemarker.command.AutocompleteFieldRow +import spp.jetbrains.sourcemarker.service.log.VariableParser import spp.protocol.artifact.ArtifactQualifiedName import java.awt.* import java.awt.event.* diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt index c57c75771..ac6aee7af 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt @@ -30,13 +30,6 @@ import com.intellij.testFramework.LightProjectDescriptor import com.intellij.testFramework.PsiTestUtil import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase -import spp.jetbrains.portal.SourcePortal -import spp.protocol.ProtocolAddress.Global.RefreshLogs -import spp.protocol.portal.PageType -import spp.protocol.portal.PortalConfiguration -import spp.jetbrains.sourcemarker.SourceMarkerPlugin -import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx -import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import io.vertx.core.Promise import io.vertx.core.json.Json import io.vertx.kotlin.coroutines.await @@ -47,8 +40,15 @@ import kotlinx.coroutines.runBlocking import org.junit.jupiter.api.Assumptions.assumeTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import spp.jetbrains.portal.SourcePortal +import spp.jetbrains.sourcemarker.SourceMarkerPlugin +import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx +import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig +import spp.protocol.ProtocolAddress.Global.RefreshLogs import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType +import spp.protocol.portal.PageType +import spp.protocol.portal.PortalConfiguration import java.io.File class StandaloneLogsLiveView : LightJavaCodeInsightFixtureTestCase() { diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt index 9c4ff5e32..d8b5e07f9 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt @@ -30,13 +30,6 @@ import com.intellij.testFramework.LightProjectDescriptor import com.intellij.testFramework.PsiTestUtil import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase -import spp.jetbrains.portal.SourcePortal -import spp.protocol.ProtocolAddress.Global.RefreshTraces -import spp.protocol.portal.PageType -import spp.protocol.portal.PortalConfiguration -import spp.jetbrains.sourcemarker.SourceMarkerPlugin -import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx -import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import io.vertx.core.Promise import io.vertx.core.json.Json import io.vertx.kotlin.coroutines.await @@ -47,8 +40,15 @@ import kotlinx.coroutines.runBlocking import org.junit.jupiter.api.Assumptions.assumeTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import spp.jetbrains.portal.SourcePortal +import spp.jetbrains.sourcemarker.SourceMarkerPlugin +import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx +import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig +import spp.protocol.ProtocolAddress.Global.RefreshTraces import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType +import spp.protocol.portal.PageType +import spp.protocol.portal.PortalConfiguration import java.io.File class StandaloneTracesLiveView : LightJavaCodeInsightFixtureTestCase() { diff --git a/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapperTest.kt b/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapperTest.kt index 08991c990..59a0c1cd7 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapperTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapperTest.kt @@ -17,12 +17,12 @@ */ package spp.jetbrains.mapper.vcs.git -import spp.jetbrains.mapper.SourceMapperTest import org.eclipse.jgit.api.Git import org.eclipse.jgit.internal.storage.file.FileRepository import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test +import spp.jetbrains.mapper.SourceMapperTest import java.io.File import java.nio.file.Files import java.util.* diff --git a/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/MethodRenameTest.kt b/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/MethodRenameTest.kt index a5dad64de..114e2b4d1 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/MethodRenameTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/MethodRenameTest.kt @@ -17,11 +17,6 @@ */ package spp.jetbrains.mapper.vcs.git -import spp.jetbrains.mapper.SourceMapperTest -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper.Companion.originalCommitIdPattern -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType import org.eclipse.jgit.api.Git import org.eclipse.jgit.internal.storage.file.FileRepository import org.eclipse.jgit.lib.AnyObjectId @@ -33,6 +28,11 @@ import org.eclipse.jgit.transport.URIish import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test +import spp.jetbrains.mapper.SourceMapperTest +import spp.jetbrains.mapper.api.impl.SourceMapperImpl +import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper.Companion.originalCommitIdPattern +import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType import java.io.File import java.nio.file.Files import java.util.* diff --git a/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt b/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt index bcb9aa432..b394b24af 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt @@ -17,18 +17,18 @@ */ package spp.jetbrains.portal.display.views -import spp.jetbrains.portal.SourcePortal -import spp.protocol.artifact.QueryTimeFrame -import spp.protocol.artifact.metrics.ArtifactMetricResult -import spp.protocol.artifact.metrics.ArtifactMetrics -import spp.protocol.artifact.metrics.MetricType -import spp.protocol.portal.PortalConfiguration import kotlinx.datetime.toKotlinInstant import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Test +import spp.jetbrains.portal.SourcePortal import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType +import spp.protocol.artifact.QueryTimeFrame +import spp.protocol.artifact.metrics.ArtifactMetricResult +import spp.protocol.artifact.metrics.ArtifactMetrics +import spp.protocol.artifact.metrics.MetricType +import spp.protocol.portal.PortalConfiguration import java.time.ZonedDateTime import java.time.temporal.ChronoUnit diff --git a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/GroovyEndpointDetectorTest.kt b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/GroovyEndpointDetectorTest.kt index 8d79faf6f..5233503f9 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/GroovyEndpointDetectorTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/GroovyEndpointDetectorTest.kt @@ -18,14 +18,14 @@ package spp.jetbrains.sourcemarker.psi.endpoint import com.intellij.openapi.application.ApplicationManager -import spp.jetbrains.marker.jvm.psi.EndpointDetector -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import io.vertx.kotlin.coroutines.await import kotlinx.coroutines.runBlocking import org.intellij.lang.annotations.Language import org.jetbrains.uast.UFile import org.jetbrains.uast.toUElement import org.junit.jupiter.api.Test +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.sourcemarker.SourceMarkerPlugin class GroovyEndpointDetectorTest : EndpointDetectorTest() { diff --git a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/JavaEndpointDetectorTest.kt b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/JavaEndpointDetectorTest.kt index bb903a37c..65cd99bf5 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/JavaEndpointDetectorTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/JavaEndpointDetectorTest.kt @@ -18,14 +18,14 @@ package spp.jetbrains.sourcemarker.psi.endpoint import com.intellij.openapi.application.ApplicationManager -import spp.jetbrains.marker.jvm.psi.EndpointDetector -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import io.vertx.kotlin.coroutines.await import kotlinx.coroutines.runBlocking import org.intellij.lang.annotations.Language import org.jetbrains.uast.UFile import org.jetbrains.uast.toUElement import org.junit.jupiter.api.Test +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.sourcemarker.SourceMarkerPlugin class JavaEndpointDetectorTest : EndpointDetectorTest() { diff --git a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/KotlinEndpointDetectorTest.kt b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/KotlinEndpointDetectorTest.kt index 92732baf4..5bba95961 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/KotlinEndpointDetectorTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/KotlinEndpointDetectorTest.kt @@ -18,14 +18,14 @@ package spp.jetbrains.sourcemarker.psi.endpoint import com.intellij.openapi.application.ApplicationManager -import spp.jetbrains.marker.jvm.psi.EndpointDetector -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import io.vertx.kotlin.coroutines.await import kotlinx.coroutines.runBlocking import org.intellij.lang.annotations.Language import org.jetbrains.uast.UFile import org.jetbrains.uast.toUElement import org.junit.jupiter.api.Test +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.sourcemarker.SourceMarkerPlugin class KotlinEndpointDetectorTest : EndpointDetectorTest() { diff --git a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/ScalaEndpointNameDetectorTest.kt b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/ScalaEndpointNameDetectorTest.kt index 812267aee..1ea6a2300 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/ScalaEndpointNameDetectorTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/psi/endpoint/ScalaEndpointNameDetectorTest.kt @@ -18,14 +18,14 @@ package spp.jetbrains.sourcemarker.psi.endpoint import com.intellij.openapi.application.ApplicationManager -import spp.jetbrains.marker.jvm.psi.EndpointDetector -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import io.vertx.kotlin.coroutines.await import kotlinx.coroutines.runBlocking import org.intellij.lang.annotations.Language import org.jetbrains.uast.UFile import org.jetbrains.uast.toUElement import org.junit.jupiter.api.Test +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.sourcemarker.SourceMarkerPlugin class ScalaEndpointNameDetectorTest : EndpointDetectorTest() { diff --git a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/InstrumentConditionParserTest.kt b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/InstrumentConditionParserTest.kt index f467ca1c4..655d44147 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/InstrumentConditionParserTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/InstrumentConditionParserTest.kt @@ -27,12 +27,12 @@ import com.intellij.psi.PsiJavaFile import com.intellij.testFramework.TestApplicationManager import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl -import spp.jetbrains.marker.InstrumentConditionParser -import spp.jetbrains.marker.jvm.JVMConditionParser import org.intellij.lang.annotations.Language import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import spp.jetbrains.marker.InstrumentConditionParser +import spp.jetbrains.marker.jvm.JVMConditionParser class InstrumentConditionParserTest : LightJavaCodeInsightFixtureTestCase() { From 1f99248ac55a71a3beaa911b9808c41eb0474cab Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 17:04:33 -0500 Subject: [PATCH 012/115] refactor --- .../settings/PluginConfigurationPanel.java | 2 +- .../status/BreakpointStatusBar.java | 2 +- .../status/LiveMeterStatusPanel.java | 2 +- .../sourcemarker/status/LogStatusBar.java | 2 +- .../sourcemarker/status/MeterStatusBar.java | 2 +- .../sourcemarker/status/SpanStatusBar.java | 2 +- .../sourcemarker/SourceMarkerPlugin.kt | 26 +++++++++---------- .../command/ControlBarController.kt | 14 +++++----- .../discover/TCPServiceDiscoveryBackend.kt | 2 +- .../listeners/PortalEventListener.kt | 2 +- .../service/LiveInstrumentManager.kt | 4 +-- .../sourcemarker/service/LiveViewManager.kt | 2 +- .../service/LogCountIndicators.kt | 2 +- .../sourcemarker/status/LiveStatusManager.kt | 4 +-- .../jetbrains/StandaloneActivityLiveView.kt | 4 +-- 15 files changed, 36 insertions(+), 36 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/PluginConfigurationPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/PluginConfigurationPanel.java index 9a99bbc61..4a3971224 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/PluginConfigurationPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/settings/PluginConfigurationPanel.java @@ -22,7 +22,7 @@ import java.util.stream.Collectors; import static spp.jetbrains.sourcemarker.PluginBundle.message; -import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; +import static spp.protocol.SourceServices.Instance.INSTANCE; public class PluginConfigurationPanel { private JPanel myWholePanel; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index cf84651b8..509731b56 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -53,7 +53,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; +import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.BREAKPOINT_HIT; import static spp.protocol.instrument.event.LiveInstrumentEventType.BREAKPOINT_REMOVED; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java index 297184afb..42566efc7 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java @@ -22,7 +22,7 @@ import static spp.jetbrains.sourcemarker.PluginUI.LABEL_FOREGROUND_COLOR; import static spp.jetbrains.sourcemarker.PluginUI.ROBOTO_LIGHT_PLAIN_15; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; +import static spp.protocol.SourceServices.Instance.INSTANCE; public class LiveMeterStatusPanel extends JPanel implements InstrumentEventListener { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index 867837bc5..e7ce2c755 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -58,7 +58,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; +import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_HIT; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_REMOVED; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index 994dd56c0..c6d2ed712 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -46,7 +46,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; +import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.METER_REMOVED; public class MeterStatusBar extends JPanel implements StatusBar, VisibleAreaListener { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index 9a5c1891f..611eae4f0 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -43,7 +43,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.SourceMarkerServices.Instance.INSTANCE; +import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.METER_REMOVED; public class SpanStatusBar extends JPanel implements StatusBar, VisibleAreaListener { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 6b1115902..caa43f1c1 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -95,8 +95,8 @@ import spp.jetbrains.sourcemarker.settings.getServicePortNormalized import spp.jetbrains.sourcemarker.settings.isSsl import spp.jetbrains.sourcemarker.settings.serviceHostNormalized import spp.jetbrains.sourcemarker.status.LiveStatusManager -import spp.protocol.SourceMarkerServices -import spp.protocol.SourceMarkerServices.Instance +import spp.protocol.SourceServices +import spp.protocol.SourceServices.Instance import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.endpoint.EndpointResult import spp.protocol.artifact.exception.LiveStackTraceElement @@ -107,9 +107,9 @@ import spp.protocol.artifact.trace.TraceSpan import spp.protocol.artifact.trace.TraceSpanStackQueryResult import spp.protocol.artifact.trace.TraceStack import spp.protocol.service.LiveService -import spp.protocol.service.live.LiveInstrumentService -import spp.protocol.service.live.LiveViewService -import spp.protocol.service.logging.LogCountIndicatorService +import spp.protocol.service.LiveInstrumentService +import spp.protocol.service.LiveViewService +import spp.protocol.service.LogCountIndicatorService import spp.protocol.util.KSerializers import spp.protocol.util.LocalMessageCodec import java.awt.Color @@ -318,12 +318,12 @@ object SourceMarkerPlugin { val availableRecords = discovery.getRecords { true }.await() //live service - if (availableRecords.any { it.name == SourceMarkerServices.Utilize.LIVE_SERVICE }) { + if (availableRecords.any { it.name == SourceServices.Utilize.LIVE_SERVICE }) { log.info("Live service available") Instance.liveService = ServiceProxyBuilder(vertx) .apply { config.serviceToken?.let { setToken(it) } } - .setAddress(SourceMarkerServices.Utilize.LIVE_SERVICE) + .setAddress(SourceServices.Utilize.LIVE_SERVICE) .build(LiveService::class.java) } else { log.warn("Live service unavailable") @@ -331,13 +331,13 @@ object SourceMarkerPlugin { //live instrument if (hardcodedConfig.getJsonObject("services").getBoolean("live_instrument")) { - if (availableRecords.any { it.name == SourceMarkerServices.Utilize.LIVE_INSTRUMENT }) { + if (availableRecords.any { it.name == SourceServices.Utilize.LIVE_INSTRUMENT }) { log.info("Live instruments available") SourceMarker.addGlobalSourceMarkEventListener(LiveStatusManager) Instance.liveInstrument = ServiceProxyBuilder(vertx) .apply { config.serviceToken?.let { setToken(it) } } - .setAddress(SourceMarkerServices.Utilize.LIVE_INSTRUMENT) + .setAddress(SourceServices.Utilize.LIVE_INSTRUMENT) .build(LiveInstrumentService::class.java) ApplicationManager.getApplication().invokeLater { BreakpointHitWindowService.getInstance(project).showEventsWindow() @@ -355,11 +355,11 @@ object SourceMarkerPlugin { //live view if (hardcodedConfig.getJsonObject("services").getBoolean("live_view")) { - if (availableRecords.any { it.name == SourceMarkerServices.Utilize.LIVE_VIEW }) { + if (availableRecords.any { it.name == SourceServices.Utilize.LIVE_VIEW }) { log.info("Live views available") Instance.liveView = ServiceProxyBuilder(vertx) .apply { config.serviceToken?.let { setToken(it) } } - .setAddress(SourceMarkerServices.Utilize.LIVE_VIEW) + .setAddress(SourceServices.Utilize.LIVE_VIEW) .build(LiveViewService::class.java) val viewListener = LiveViewManager(config) @@ -375,11 +375,11 @@ object SourceMarkerPlugin { //log count indicator if (hardcodedConfig.getJsonObject("services").getBoolean("log_count_indicator")) { - if (availableRecords.any { it.name == SourceMarkerServices.Utilize.LOG_COUNT_INDICATOR }) { + if (availableRecords.any { it.name == SourceServices.Utilize.LOG_COUNT_INDICATOR }) { log.info("Log count indicator available") Instance.logCountIndicator = ServiceProxyBuilder(vertx) .apply { config.serviceToken?.let { setToken(it) } } - .setAddress(SourceMarkerServices.Utilize.LOG_COUNT_INDICATOR) + .setAddress(SourceServices.Utilize.LOG_COUNT_INDICATOR) .build(LogCountIndicatorService::class.java) GlobalScope.launch(vertx.dispatcher()) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt index 2b8a2fc0c..6ca38a637 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt @@ -39,7 +39,7 @@ import spp.jetbrains.sourcemarker.command.LiveControlCommand.* import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.SetCurrentPage -import spp.protocol.SourceMarkerServices +import spp.protocol.SourceServices import spp.protocol.instrument.LiveInstrumentType.* import spp.protocol.portal.PageType import java.awt.BorderLayout @@ -58,7 +58,7 @@ object ControlBarController { private var previousControlBar: InlayMark? = null private val availableCommands by lazy { runBlocking { - val selfInfo = SourceMarkerServices.Instance.liveService!!.getSelf().await() + val selfInfo = SourceServices.Instance.liveService!!.getSelf().await() LiveControlCommand.values().toList().filter { @Suppress("UselessCallOnCollection") //unknown enums are null selfInfo.permissions.filterNotNull().map { it.name }.contains(it.name) @@ -116,7 +116,7 @@ object ControlBarController { previousControlBar!!.dispose() previousControlBar = null - SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(BREAKPOINT).onComplete { + SourceServices.Instance.liveInstrument!!.clearLiveInstruments(BREAKPOINT).onComplete { if (it.failed()) { log.error("Failed to clear live breakpoints", it.cause()) } @@ -126,7 +126,7 @@ object ControlBarController { previousControlBar!!.dispose() previousControlBar = null - SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(LOG).onComplete { + SourceServices.Instance.liveInstrument!!.clearLiveInstruments(LOG).onComplete { if (it.failed()) { log.error("Failed to clear live logs", it.cause()) } @@ -136,7 +136,7 @@ object ControlBarController { previousControlBar!!.dispose() previousControlBar = null - SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(METER).onComplete { + SourceServices.Instance.liveInstrument!!.clearLiveInstruments(METER).onComplete { if (it.failed()) { log.error("Failed to clear live meters", it.cause()) } @@ -146,7 +146,7 @@ object ControlBarController { previousControlBar!!.dispose() previousControlBar = null - SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(SPAN).onComplete { + SourceServices.Instance.liveInstrument!!.clearLiveInstruments(SPAN).onComplete { if (it.failed()) { log.error("Failed to clear live spans", it.cause()) } @@ -156,7 +156,7 @@ object ControlBarController { previousControlBar!!.dispose() previousControlBar = null - SourceMarkerServices.Instance.liveInstrument!!.clearLiveInstruments(null).onComplete { + SourceServices.Instance.liveInstrument!!.clearLiveInstruments(null).onComplete { if (it.failed()) { log.error("Failed to clear live instruments", it.cause()) } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 367ba3b99..09daa144c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -42,7 +42,7 @@ import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.settings.isSsl import spp.jetbrains.sourcemarker.settings.serviceHostNormalized -import spp.protocol.SourceMarkerServices.Utilize +import spp.protocol.SourceServices.Utilize import spp.protocol.extend.TCPServiceFrameParser import spp.protocol.platform.PlatformAddress import spp.protocol.status.InstanceConnection diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt index fa0aa42e2..3d2a1afa4 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt @@ -79,7 +79,7 @@ import spp.protocol.ProtocolAddress.Global.RefreshTraces import spp.protocol.ProtocolAddress.Global.SetCurrentPage import spp.protocol.ProtocolAddress.Global.TraceSpanUpdated import spp.protocol.ProtocolAddress.Portal.UpdateEndpoints -import spp.protocol.SourceMarkerServices.Instance +import spp.protocol.SourceServices.Instance import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.endpoint.EndpointResult diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index b8eb3bb01..c620e7a80 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -35,8 +35,8 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated -import spp.protocol.SourceMarkerServices.Instance -import spp.protocol.SourceMarkerServices.Provide +import spp.protocol.SourceServices.Instance +import spp.protocol.SourceServices.Provide import spp.protocol.instrument.LiveBreakpoint import spp.protocol.instrument.LiveLog import spp.protocol.instrument.event.* diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index 52ebd5ef4..3a92c943b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -40,7 +40,7 @@ import spp.protocol.ProtocolAddress import spp.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated import spp.protocol.ProtocolAddress.Global.ArtifactTracesUpdated import spp.protocol.ProtocolAddress.Global.TraceSpanUpdated -import spp.protocol.SourceMarkerServices.Provide +import spp.protocol.SourceServices.Provide import spp.protocol.artifact.QueryTimeFrame import spp.protocol.artifact.log.Log import spp.protocol.artifact.log.LogOrderType diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt index c4fe1cbb7..155040e3a 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt @@ -33,7 +33,7 @@ import spp.jetbrains.marker.source.mark.api.MethodSourceMark import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.LOGGER_DETECTOR import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.protocol.SourceMarkerServices.Instance +import spp.protocol.SourceServices.Instance import spp.protocol.instrument.DurationStep /** diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index bb8f46dca..14aade941 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -46,7 +46,7 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.LOG_ID import spp.jetbrains.sourcemarker.service.InstrumentEventListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.ProtocolAddress.Portal.DisplayLogs -import spp.protocol.SourceMarkerServices +import spp.protocol.SourceServices import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.log.LogResult @@ -396,7 +396,7 @@ object LiveStatusManager : SourceMarkEventListener { @JvmStatic fun showMeterStatusIcon(liveMeter: LiveMeter, sourceFileMarker: SourceFileMarker) { - SourceMarkerServices.Instance.liveView!!.addLiveViewSubscription( + SourceServices.Instance.liveView!!.addLiveViewSubscription( LiveViewSubscription( null, listOf(liveMeter.toMetricId()), diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt index fbee19383..013d1060d 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt @@ -49,7 +49,7 @@ import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.ProtocolAddress.Global.RefreshActivity -import spp.protocol.SourceMarkerServices +import spp.protocol.SourceServices import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType import spp.protocol.instrument.LiveSourceLocation @@ -145,7 +145,7 @@ class StandaloneActivityLiveView : LightJavaCodeInsightFixtureTestCase() { val endpointName = sourceMark.getUserData( SourceMarkKeys.ENDPOINT_DETECTOR )?.getOrFindEndpointName(sourceMark) ?: return@launch - SourceMarkerServices.Instance.liveView!!.addLiveViewSubscription( + SourceServices.Instance.liveView!!.addLiveViewSubscription( LiveViewSubscription( null, listOf(endpointName), From c1d4142eae3871993793819a405d8d3747f4e56d Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 20:35:07 -0500 Subject: [PATCH 013/115] refactor --- .../sourcemarker/service/LiveInstrumentManager.kt | 10 +++++++--- .../jetbrains/sourcemarker/service/LiveViewManager.kt | 7 +++---- .../service/breakpoint/BreakpointHitColumnInfo.kt | 9 +++++---- .../sourcemarker/service/log/LogHitColumnInfo.kt | 9 +++++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index c620e7a80..fd1df290b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -35,11 +35,15 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated +import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide import spp.protocol.instrument.LiveBreakpoint import spp.protocol.instrument.LiveLog -import spp.protocol.instrument.event.* +import spp.protocol.instrument.event.LiveBreakpointHit +import spp.protocol.instrument.event.LiveInstrumentEvent +import spp.protocol.instrument.event.LiveInstrumentEventType +import spp.protocol.instrument.event.LiveLogHit /** * todo: description. @@ -93,7 +97,7 @@ class LiveInstrumentManager(private val project: Project) : CoroutineVerticle() } private fun handleLogRemovedEvent(liveEvent: LiveInstrumentEvent) { - val logRemoved = Json.decodeValue(liveEvent.data, LiveInstrumentRemoved::class.java) + val logRemoved = deserializeLiveInstrumentRemoved(JsonObject(liveEvent.data)) ApplicationManager.getApplication().invokeLater { val inlayMark = SourceMarkSearch.findByLogId(logRemoved.liveInstrument.id!!) if (inlayMark != null) { @@ -139,7 +143,7 @@ class LiveInstrumentManager(private val project: Project) : CoroutineVerticle() } private fun handleBreakpointRemovedEvent(liveEvent: LiveInstrumentEvent) { - val bpRemoved = Json.decodeValue(liveEvent.data, LiveInstrumentRemoved::class.java) + val bpRemoved = deserializeLiveInstrumentRemoved(JsonObject(liveEvent.data)) ApplicationManager.getApplication().invokeLater { val inlayMark = SourceMarkSearch.findByBreakpointId(bpRemoved.liveInstrument.id!!) if (inlayMark != null) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index 3a92c943b..0fe32a7ad 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -25,7 +25,6 @@ import io.vertx.ext.bridge.BridgeEventType import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper import io.vertx.kotlin.coroutines.CoroutineVerticle import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.datetime.toJavaInstant import kotlinx.datetime.toKotlinInstant @@ -83,8 +82,8 @@ class LiveViewManager(val markerConfig: SourceMarkerConfig) : CoroutineVerticle( if (log.isTraceEnabled) log.trace("Received live event: {}", event) when (event.viewConfig.viewName) { - "LIVE_METER" -> GlobalScope.launch(vertx.dispatcher()) { consumeLiveMeterEvent(event) } - "LOGS" -> GlobalScope.launch(vertx.dispatcher()) { consumeLogsViewEvent(event) } + "LIVE_METER" -> launch(vertx.dispatcher()) { consumeLiveMeterEvent(event) } + "LOGS" -> launch(vertx.dispatcher()) { consumeLogsViewEvent(event) } "TRACES" -> { val sourceMark = SourceMarkSearch.findByEndpointName(event.entityId) if (sourceMark == null) { @@ -113,7 +112,7 @@ class LiveViewManager(val markerConfig: SourceMarkerConfig) : CoroutineVerticle( ) } - private suspend fun consumeLiveMeterEvent(event: LiveViewEvent) { + private fun consumeLiveMeterEvent(event: LiveViewEvent) { val meterTypeStr = event.entityId.substringAfter("spp_").substringBefore("_").toUpperCase() val meterType = MeterType.valueOf(meterTypeStr) val meterId = event.entityId.substringAfter(meterType.name.toLowerCase() + "_").replace("_", "-") diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt index ebd279b0d..7c3ee64df 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt @@ -19,12 +19,13 @@ package spp.jetbrains.sourcemarker.service.breakpoint import com.intellij.util.ui.ColumnInfo import io.vertx.core.json.Json +import io.vertx.core.json.JsonObject import kotlinx.datetime.Clock import spp.jetbrains.sourcemarker.PluginBundle.message +import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.instrument.event.LiveBreakpointHit import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType -import spp.protocol.instrument.event.LiveInstrumentRemoved import spp.protocol.utils.toPrettyDuration /** @@ -41,14 +42,14 @@ class BreakpointHitColumnInfo(name: String) : ColumnInfo item.toString() } } else { - val item = Json.decodeValue(event.data, LiveInstrumentRemoved::class.java) + val item = deserializeLiveInstrumentRemoved(JsonObject(event.data)) return when (name) { "Breakpoint Data" -> item.cause!!.message ?: item.cause!!.exceptionType "Time" -> (Clock.System.now().toEpochMilliseconds() - item.occurredAt.toEpochMilliseconds()) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt index 5e0535459..4bb12dc8e 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt @@ -19,11 +19,12 @@ package spp.jetbrains.sourcemarker.service.log import com.intellij.util.ui.ColumnInfo import io.vertx.core.json.Json +import io.vertx.core.json.JsonObject import kotlinx.datetime.Clock import spp.jetbrains.sourcemarker.PluginBundle.message +import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType -import spp.protocol.instrument.event.LiveInstrumentRemoved import spp.protocol.instrument.event.LiveLogHit import spp.protocol.utils.toPrettyDuration @@ -41,14 +42,14 @@ class LogHitColumnInfo(name: String) : ColumnInfo(n val obj1 = if (t.eventType == LiveInstrumentEventType.LOG_HIT) { Json.decodeValue(t.data, LiveLogHit::class.java) } else if (t.eventType == LiveInstrumentEventType.LOG_REMOVED) { - Json.decodeValue(t.data, LiveInstrumentRemoved::class.java) + deserializeLiveInstrumentRemoved(JsonObject(t.data)) } else { throw IllegalArgumentException(t.eventType.name) } val obj2 = if (t2.eventType == LiveInstrumentEventType.LOG_HIT) { Json.decodeValue(t2.data, LiveLogHit::class.java) } else if (t2.eventType == LiveInstrumentEventType.LOG_REMOVED) { - Json.decodeValue(t2.data, LiveInstrumentRemoved::class.java) + deserializeLiveInstrumentRemoved(JsonObject(t2.data)) } else { throw IllegalArgumentException(t2.eventType.name) } @@ -69,7 +70,7 @@ class LogHitColumnInfo(name: String) : ColumnInfo(n else -> item.toString() } } else { - val item = Json.decodeValue(event.data, LiveInstrumentRemoved::class.java) + val item = deserializeLiveInstrumentRemoved(JsonObject(event.data)) return when (name) { "Message" -> item.cause!!.message ?: item.cause!!.exceptionType "Time" -> (Clock.System.now().toEpochMilliseconds() - item.occurredAt.toEpochMilliseconds()) From d254f174348e51e016cb555091f422b236437acf Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 20:35:35 -0500 Subject: [PATCH 014/115] bump --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index e75f0d2e2..2291f98b8 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:a97325afb6") + implementation("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 60aafe845..5265e9298 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -28,7 +28,7 @@ repositories { dependencies { val intellijVersion = "213.6777.52" - compileOnly("com.github.sourceplusplus.protocol:protocol:a97325afb6") + compileOnly("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index f3727e2ef..883459a7e 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:a97325afb6") + compileOnly("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 132166209..0d7487107 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:a97325afb6") + compileOnly("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 88fb6d7c3..9cccf4055 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:a97325afb6") + implementation("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") From b2b515e0afad7fd69b2edfb66a1295b817ae4155 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 20:35:50 -0500 Subject: [PATCH 015/115] bump --- plugin/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index b82b0006a..3f55a9ddf 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:a97325afb6") + implementation("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") } implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion") From efe60d6b76ca8df51f1ababc8cba079b0d2c5292 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 1 Feb 2022 21:28:06 -0500 Subject: [PATCH 016/115] refactor --- .../jetbrains/sourcemarker/status/BreakpointStatusBar.java | 4 +++- .../java/spp/jetbrains/sourcemarker/status/LogStatusBar.java | 5 +++-- .../spp/jetbrains/sourcemarker/status/MeterStatusBar.java | 5 +++-- .../spp/jetbrains/sourcemarker/status/SpanStatusBar.java | 5 +++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index 509731b56..f7753fa68 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -13,6 +13,7 @@ import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; import io.vertx.core.json.Json; +import io.vertx.core.json.JsonObject; import net.miginfocom.swing.MigLayout; import org.apache.commons.lang.StringUtils; import spp.jetbrains.marker.source.mark.api.SourceMark; @@ -53,6 +54,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.BREAKPOINT_HIT; import static spp.protocol.instrument.event.LiveInstrumentEventType.BREAKPOINT_REMOVED; @@ -174,7 +176,7 @@ private void setupAsActive() { } else if (event.getEventType() == BREAKPOINT_REMOVED) { configLabel.setIcon(PluginIcons.eyeSlash); - LiveInstrumentRemoved removed = Json.decodeValue(event.getData(), LiveInstrumentRemoved.class); + LiveInstrumentRemoved removed = deserializeLiveInstrumentRemoved(new JsonObject(event.getData())); if (removed.getCause() == null) { statusPanel.setStatus("Complete", COMPLETE_COLOR_PURPLE); } else { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index e7ce2c755..d25d861d2 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -12,7 +12,7 @@ import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; -import io.vertx.core.json.Json; +import io.vertx.core.json.JsonObject; import net.miginfocom.swing.MigLayout; import org.jetbrains.annotations.NotNull; import spp.jetbrains.marker.source.mark.inlay.InlayMark; @@ -58,6 +58,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_HIT; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_REMOVED; @@ -228,7 +229,7 @@ public void accept(@NotNull LiveInstrumentEvent event) { } else if (event.getEventType() == LOG_REMOVED) { removed = true; - LiveInstrumentRemoved removed = Json.decodeValue(event.getData(), LiveInstrumentRemoved.class); + LiveInstrumentRemoved removed = deserializeLiveInstrumentRemoved(new JsonObject(event.getData())); if (removed.getCause() != null) { commandModel.insertRow(0, event); diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index c6d2ed712..5d9446197 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -11,7 +11,7 @@ import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; -import io.vertx.core.json.Json; +import io.vertx.core.json.JsonObject; import net.miginfocom.swing.MigLayout; import spp.jetbrains.marker.source.mark.api.SourceMark; import spp.jetbrains.marker.source.mark.inlay.InlayMark; @@ -46,6 +46,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.METER_REMOVED; @@ -128,7 +129,7 @@ private void setupAsActive() { if (event.getEventType() == METER_REMOVED) { configLabel.setIcon(PluginIcons.eyeSlash); - LiveInstrumentRemoved removed = Json.decodeValue(event.getData(), LiveInstrumentRemoved.class); + LiveInstrumentRemoved removed = deserializeLiveInstrumentRemoved(new JsonObject(event.getData())); if (removed.getCause() == null) { statusPanel.setStatus("Complete", COMPLETE_COLOR_PURPLE); } else { diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index 611eae4f0..f4780a969 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -11,7 +11,7 @@ import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; -import io.vertx.core.json.Json; +import io.vertx.core.json.JsonObject; import net.miginfocom.swing.MigLayout; import spp.jetbrains.marker.source.mark.api.SourceMark; import spp.jetbrains.marker.source.mark.inlay.InlayMark; @@ -43,6 +43,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.METER_REMOVED; @@ -125,7 +126,7 @@ private void setupAsActive() { if (event.getEventType() == METER_REMOVED) { configLabel.setIcon(PluginIcons.eyeSlash); - LiveInstrumentRemoved removed = Json.decodeValue(event.getData(), LiveInstrumentRemoved.class); + LiveInstrumentRemoved removed = deserializeLiveInstrumentRemoved(new JsonObject(event.getData())); if (removed.getCause() == null) { statusPanel.setStatus("Complete", COMPLETE_COLOR_PURPLE); } else { From f7ba079a5ca36c8bfd407a2478a312bf785c06c1 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 00:34:08 -0500 Subject: [PATCH 017/115] validate marker auth over tcp --- .../sourcemarker/SourceMarkerPlugin.kt | 2 +- .../discover/TCPServiceDiscoveryBackend.kt | 18 +++++++++++------- .../service/LiveInstrumentManager.kt | 12 ++++++++---- .../sourcemarker/service/LiveViewManager.kt | 12 ++++++------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index caa43f1c1..97a640263 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -342,7 +342,7 @@ object SourceMarkerPlugin { ApplicationManager.getApplication().invokeLater { BreakpointHitWindowService.getInstance(project).showEventsWindow() } - val breakpointListener = LiveInstrumentManager(project) + val breakpointListener = LiveInstrumentManager(project, config) GlobalScope.launch(vertx.dispatcher()) { deploymentIds.add(vertx.deployVerticle(breakpointListener).await()) } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 09daa144c..69bd54aaf 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -20,6 +20,7 @@ package spp.jetbrains.sourcemarker.discover import eu.geekplace.javapinning.JavaPinning import eu.geekplace.javapinning.pin.Pin import io.vertx.core.* +import io.vertx.core.eventbus.DeliveryOptions import io.vertx.core.eventbus.MessageConsumer import io.vertx.core.json.Json import io.vertx.core.json.JsonArray @@ -64,18 +65,18 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { private lateinit var vertx: Vertx private lateinit var client: NetClient + private lateinit var pluginConfig: SourceMarkerConfig private val setupPromise = Promise.promise() private val setupFuture = setupPromise.future() override fun init(vertx: Vertx, config: JsonObject) { this.vertx = vertx - - val hardcodedConfig = config.getJsonObject("hardcoded_config") - val pluginConfig = Json.decodeValue( + pluginConfig = Json.decodeValue( config.getJsonObject("sourcemarker_plugin_config").toString(), SourceMarkerConfig::class.java ) val serviceHost = pluginConfig.serviceHostNormalized!! + val hardcodedConfig = config.getJsonObject("hardcoded_config") val servicePort = hardcodedConfig.getInteger("tcp_service_port") val certificatePins = mutableListOf() certificatePins.addAll(pluginConfig.certificatePins) @@ -138,8 +139,7 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { setupPromise.complete() } } - val headers = JsonObject() - pluginConfig.serviceToken?.let { headers.put("token", it) } + val headers = JsonObject().apply { pluginConfig.serviceToken?.let { put("auth-token", it) } } FrameHelper.sendFrame( BridgeEventType.SEND.name.toLowerCase(), PlatformAddress.MARKER_CONNECTED.address, @@ -186,7 +186,9 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { override fun getRecords(resultHandler: Handler>>) { if (setupFuture.isComplete) { if (setupFuture.succeeded()) { - vertx.eventBus().request("get-records", null) { + val deliveryOptions = DeliveryOptions() + .apply { pluginConfig.serviceToken?.let { addHeader("auth-token", it) } } + vertx.eventBus().request("get-records", null, deliveryOptions) { resultHandler.handle(Future.succeededFuture(mutableListOf(Record(it.result().body())))) } } else { @@ -195,7 +197,9 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { } else { setupFuture.onComplete { if (it.succeeded()) { - vertx.eventBus().request("get-records", null) { + val deliveryOptions = DeliveryOptions() + .apply { pluginConfig.serviceToken?.let { addHeader("auth-token", it) } } + vertx.eventBus().request("get-records", null, deliveryOptions) { val records = mutableListOf() it.result().body().forEach { record -> records.add(Record(record as JsonObject)) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index fd1df290b..f9fcbcfb3 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -33,6 +33,7 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.search.SourceMarkSearch import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener +import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved @@ -52,7 +53,10 @@ import spp.protocol.instrument.event.LiveLogHit * @author [Brandon Fergerson](mailto:bfergerson@apache.org) */ @Suppress("UNCHECKED_CAST") -class LiveInstrumentManager(private val project: Project) : CoroutineVerticle() { +class LiveInstrumentManager( + private val project: Project, + private val pluginConfig: SourceMarkerConfig +) : CoroutineVerticle() { companion object { private val log = LoggerFactory.getLogger(LiveInstrumentManager::class.java) @@ -80,9 +84,9 @@ class LiveInstrumentManager(private val project: Project) : CoroutineVerticle() //register listener FrameHelper.sendFrame( BridgeEventType.REGISTER.name.toLowerCase(), - Provide.LIVE_INSTRUMENT_SUBSCRIBER, - JsonObject(), - TCPServiceDiscoveryBackend.socket!! + Provide.LIVE_INSTRUMENT_SUBSCRIBER, null, + JsonObject().apply { pluginConfig.serviceToken?.let { put("auth-token", it) } }, + null, null, TCPServiceDiscoveryBackend.socket!! ) //show live status bars diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index 0fe32a7ad..efede97f9 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -60,7 +60,7 @@ import java.time.Instant import java.time.ZoneOffset import java.time.format.DateTimeFormatterBuilder -class LiveViewManager(val markerConfig: SourceMarkerConfig) : CoroutineVerticle() { +class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineVerticle() { private val log = LoggerFactory.getLogger(LiveViewManager::class.java) @@ -72,8 +72,8 @@ class LiveViewManager(val markerConfig: SourceMarkerConfig) : CoroutineVerticle( override suspend fun start() { //register listener var developer = "system" - if (markerConfig.serviceToken != null) { - val json = JWT.parse(markerConfig.serviceToken) + if (pluginConfig.serviceToken != null) { + val json = JWT.parse(pluginConfig.serviceToken) developer = json.getJsonObject("payload").getString("developer_id") } @@ -106,9 +106,9 @@ class LiveViewManager(val markerConfig: SourceMarkerConfig) : CoroutineVerticle( FrameHelper.sendFrame( BridgeEventType.REGISTER.name.toLowerCase(), - Provide.LIVE_VIEW_SUBSCRIBER + "." + developer, - JsonObject(), - TCPServiceDiscoveryBackend.socket!! + Provide.LIVE_VIEW_SUBSCRIBER + "." + developer, null, + JsonObject().apply { pluginConfig.serviceToken?.let { put("auth-token", it) } }, + null, null, TCPServiceDiscoveryBackend.socket!! ) } From b4b904c4b1bba2b9f3654f3e681a351d0e7effd2 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 11:03:58 -0500 Subject: [PATCH 018/115] refactor --- .../sourcemarker/discover/TCPServiceDiscoveryBackend.kt | 4 ++-- .../jetbrains/sourcemarker/service/LiveInstrumentManager.kt | 2 +- .../spp/jetbrains/sourcemarker/service/LiveViewManager.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 69bd54aaf..6011ccf12 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -128,7 +128,7 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { //setup connection val replyAddress = UUID.randomUUID().toString() val pc = InstanceConnection(SourceMarkerPlugin.INSTANCE_ID, System.currentTimeMillis()) - val consumer: MessageConsumer = vertx.eventBus().localConsumer("local.$replyAddress") + val consumer: MessageConsumer = vertx.eventBus().localConsumer(replyAddress) val promise = Promise.promise() consumer.handler { @@ -152,7 +152,7 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { private fun setupHandler(vertx: Vertx, address: String) { vertx.eventBus().localConsumer(address) { resp -> val replyAddress = UUID.randomUUID().toString() - val tempConsumer = vertx.eventBus().localConsumer("local.$replyAddress") + val tempConsumer = vertx.eventBus().localConsumer(replyAddress) tempConsumer.handler { resp.reply(it.body()) tempConsumer.unregister() diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index f9fcbcfb3..20f7de15f 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -66,7 +66,7 @@ class LiveInstrumentManager( log.debug("LiveInstrumentManager started") EditorFactory.getInstance().eventMulticaster.addEditorMouseListener(BreakpointTriggerListener, project) - vertx.eventBus().consumer("local." + Provide.LIVE_INSTRUMENT_SUBSCRIBER) { + vertx.eventBus().consumer(Provide.LIVE_INSTRUMENT_SUBSCRIBER) { val liveEvent = Json.decodeValue(it.body().toString(), LiveInstrumentEvent::class.java) log.debug("Received instrument event. Type: {}", liveEvent.eventType) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index efede97f9..36098df3c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -77,7 +77,7 @@ class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineV developer = json.getJsonObject("payload").getString("developer_id") } - vertx.eventBus().consumer("local." + Provide.LIVE_VIEW_SUBSCRIBER + "." + developer) { + vertx.eventBus().consumer(Provide.LIVE_VIEW_SUBSCRIBER + "." + developer) { val event = Json.decodeValue(it.body().toString(), LiveViewEvent::class.java) if (log.isTraceEnabled) log.trace("Received live event: {}", event) From eafc6da838c6cff1832d4206125dd3aecc07c9ef Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 12:14:02 -0500 Subject: [PATCH 019/115] bump --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index 2291f98b8..493f804a9 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") + implementation("com.github.sourceplusplus.protocol:protocol:e6ab057003") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 5265e9298..8941a0080 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -28,7 +28,7 @@ repositories { dependencies { val intellijVersion = "213.6777.52" - compileOnly("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") + compileOnly("com.github.sourceplusplus.protocol:protocol:e6ab057003") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 883459a7e..dbeb1e9b7 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") + compileOnly("com.github.sourceplusplus.protocol:protocol:e6ab057003") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 0d7487107..eebc5de5f 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") + compileOnly("com.github.sourceplusplus.protocol:protocol:e6ab057003") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 9cccf4055..66e84dd03 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") + implementation("com.github.sourceplusplus.protocol:protocol:e6ab057003") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 3f55a9ddf..ace3d77d8 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:f9cb03d3b4") + implementation("com.github.sourceplusplus.protocol:protocol:e6ab057003") } implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion") From 42aa9d68d6ce1a4e82037a766fc2c52d49146b0f Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 15:08:05 -0500 Subject: [PATCH 020/115] refactor --- .../sourcemarker/service/LiveInstrumentManager.kt | 13 +++++++++---- .../sourcemarker/service/LiveViewManager.kt | 6 +++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 20f7de15f..947f344e0 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectManager import io.vertx.core.json.Json import io.vertx.core.json.JsonObject +import io.vertx.ext.auth.impl.jose.JWT import io.vertx.ext.bridge.BridgeEventType import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper import io.vertx.kotlin.coroutines.CoroutineVerticle @@ -38,7 +39,7 @@ import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.SourceServices.Instance -import spp.protocol.SourceServices.Provide +import spp.protocol.SourceServices.Provide.toLiveInstrumentSubscriberAddress import spp.protocol.instrument.LiveBreakpoint import spp.protocol.instrument.LiveLog import spp.protocol.instrument.event.LiveBreakpointHit @@ -63,10 +64,14 @@ class LiveInstrumentManager( } override suspend fun start() { - log.debug("LiveInstrumentManager started") + var developer = "system" + if (pluginConfig.serviceToken != null) { + val json = JWT.parse(pluginConfig.serviceToken) + developer = json.getJsonObject("payload").getString("developer_id") + } EditorFactory.getInstance().eventMulticaster.addEditorMouseListener(BreakpointTriggerListener, project) - vertx.eventBus().consumer(Provide.LIVE_INSTRUMENT_SUBSCRIBER) { + vertx.eventBus().consumer(toLiveInstrumentSubscriberAddress(developer)) { val liveEvent = Json.decodeValue(it.body().toString(), LiveInstrumentEvent::class.java) log.debug("Received instrument event. Type: {}", liveEvent.eventType) @@ -84,7 +89,7 @@ class LiveInstrumentManager( //register listener FrameHelper.sendFrame( BridgeEventType.REGISTER.name.toLowerCase(), - Provide.LIVE_INSTRUMENT_SUBSCRIBER, null, + toLiveInstrumentSubscriberAddress(developer), null, JsonObject().apply { pluginConfig.serviceToken?.let { put("auth-token", it) } }, null, null, TCPServiceDiscoveryBackend.socket!! ) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index 36098df3c..099464c68 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -39,7 +39,7 @@ import spp.protocol.ProtocolAddress import spp.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated import spp.protocol.ProtocolAddress.Global.ArtifactTracesUpdated import spp.protocol.ProtocolAddress.Global.TraceSpanUpdated -import spp.protocol.SourceServices.Provide +import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress import spp.protocol.artifact.QueryTimeFrame import spp.protocol.artifact.log.Log import spp.protocol.artifact.log.LogOrderType @@ -77,7 +77,7 @@ class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineV developer = json.getJsonObject("payload").getString("developer_id") } - vertx.eventBus().consumer(Provide.LIVE_VIEW_SUBSCRIBER + "." + developer) { + vertx.eventBus().consumer(toLiveViewSubscriberAddress(developer)) { val event = Json.decodeValue(it.body().toString(), LiveViewEvent::class.java) if (log.isTraceEnabled) log.trace("Received live event: {}", event) @@ -106,7 +106,7 @@ class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineV FrameHelper.sendFrame( BridgeEventType.REGISTER.name.toLowerCase(), - Provide.LIVE_VIEW_SUBSCRIBER + "." + developer, null, + toLiveViewSubscriberAddress(developer), null, JsonObject().apply { pluginConfig.serviceToken?.let { put("auth-token", it) } }, null, null, TCPServiceDiscoveryBackend.socket!! ) From 5d673134e8378bea2c0e468c72baf6fd8de05aa3 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 15:09:36 -0500 Subject: [PATCH 021/115] bump --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index 493f804a9..daf2082ba 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:e6ab057003") + implementation("com.github.sourceplusplus.protocol:protocol:90a0782cda") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 8941a0080..0ad99bb32 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -28,7 +28,7 @@ repositories { dependencies { val intellijVersion = "213.6777.52" - compileOnly("com.github.sourceplusplus.protocol:protocol:e6ab057003") + compileOnly("com.github.sourceplusplus.protocol:protocol:90a0782cda") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index dbeb1e9b7..df13bff22 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:e6ab057003") + compileOnly("com.github.sourceplusplus.protocol:protocol:90a0782cda") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index eebc5de5f..c88699f0d 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:e6ab057003") + compileOnly("com.github.sourceplusplus.protocol:protocol:90a0782cda") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 66e84dd03..d0382b21a 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:e6ab057003") + implementation("com.github.sourceplusplus.protocol:protocol:90a0782cda") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index ace3d77d8..e8ea6f52e 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:e6ab057003") + implementation("com.github.sourceplusplus.protocol:protocol:90a0782cda") } implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion") From 6eb1e98c6a72a6cd906e3ae93c2fc84a97861178 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 15:53:19 -0500 Subject: [PATCH 022/115] bump --- gradle.properties | 2 +- settings.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 72a6882c6..9af36fa52 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,4 +24,4 @@ kotlin.stdlib.default.dependency = true apolloVersion=3.0.0 vertxVersion=4.2.4 slf4jVersion=1.7.33 -jacksonVersion=2.12.5 \ No newline at end of file +jacksonVersion=2.13.1 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index a3ed8bb2a..21412fe68 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,7 +8,7 @@ pluginManagement { id 'com.avast.gradle.docker-compose' version "0.15.0" apply false id 'io.gitlab.arturbosch.detekt' version "1.19.0" apply false id 'com.apollographql.apollo3' version "3.0.0" apply false - id 'com.diffplug.spotless' version '6.2.0' apply false + id 'com.diffplug.spotless' version '6.2.1' apply false } } From e9337cae87b145570953f4e21383cc2b6cbaf3d7 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 15:54:58 -0500 Subject: [PATCH 023/115] backwards compatibility issues --- gradle.properties | 3 ++- marker/build.gradle.kts | 2 ++ .../mark/api/component/jcef/SourceMarkJcefComponent.kt | 9 +++++++-- plugin/build.gradle.kts | 3 ++- .../spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9af36fa52..5f809a79c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,4 +24,5 @@ kotlin.stdlib.default.dependency = true apolloVersion=3.0.0 vertxVersion=4.2.4 slf4jVersion=1.7.33 -jacksonVersion=2.13.1 \ No newline at end of file +jacksonVersion=2.13.1 +joorVersion=0.9.13 \ No newline at end of file diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 0ad99bb32..f0851a34f 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -7,6 +7,7 @@ val kotlinVersion = ext.get("kotlinVersion") val pluginGroup: String by project val projectVersion: String by project val slf4jVersion: String by project +val joorVersion: String by project publishing { publications { @@ -28,6 +29,7 @@ repositories { dependencies { val intellijVersion = "213.6777.52" + compileOnly("org.jooq:joor:$joorVersion") compileOnly("com.github.sourceplusplus.protocol:protocol:90a0782cda") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/component/jcef/SourceMarkJcefComponent.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/component/jcef/SourceMarkJcefComponent.kt index 870442be7..74aeea829 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/component/jcef/SourceMarkJcefComponent.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/component/jcef/SourceMarkJcefComponent.kt @@ -25,6 +25,8 @@ import com.intellij.ui.jcef.JBCefClient import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import org.joor.Reflect +import org.joor.ReflectException import spp.jetbrains.marker.source.mark.api.component.api.SourceMarkComponent import spp.jetbrains.marker.source.mark.api.component.jcef.config.SourceMarkJcefComponentConfiguration import java.awt.Dimension @@ -68,9 +70,12 @@ class SourceMarkJcefComponent( //periodically update zoom level GlobalScope.launch { - while(browser != null) { + while (browser != null) { delay(50) - browser?.zoomLevel = configuration.zoomLevel + try { + browser?.let { Reflect.on(it).call("setZoomLevel", configuration.zoomLevel) } + } catch (ignore: ReflectException) { + } } } diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index e8ea6f52e..5e0c7d771 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -8,6 +8,7 @@ plugins { id("maven-publish") } +val joorVersion: String by project val jacksonVersion: String by project val vertxVersion: String by project val kotlinVersion = ext.get("kotlinVersion") @@ -66,6 +67,7 @@ dependencies { implementation("com.github.sourceplusplus.protocol:protocol:90a0782cda") } + implementation("org.jooq:joor:$joorVersion") implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion") implementation("org.apache.commons:commons-text:1.9") implementation("com.github.sh5i:git-stein:v0.5.0") @@ -74,7 +76,6 @@ dependencies { implementation("io.vertx:vertx-lang-kotlin:$vertxVersion") implementation("io.vertx:vertx-lang-kotlin-coroutines:$vertxVersion") implementation("io.vertx:vertx-web:$vertxVersion") - //implementation("io.vertx:vertx-service-discovery:$vertxVersion") implementation(files(".ext/vertx-service-discovery-4.0.3-SNAPSHOT.jar")) implementation("io.vertx:vertx-service-proxy:$vertxVersion") implementation("io.vertx:vertx-tcp-eventbus-bridge:$vertxVersion") diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 97a640263..739faee8e 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -167,7 +167,7 @@ object SourceMarkerPlugin { DatabindCodec.mapper().registerModule(GuavaModule()) DatabindCodec.mapper().registerModule(Jdk8Module()) DatabindCodec.mapper().registerModule(JavaTimeModule()) - DatabindCodec.mapper().registerModule(KotlinModule()) + DatabindCodec.mapper().registerModule(KotlinModule.Builder().build()) DatabindCodec.mapper().enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) DatabindCodec.mapper().enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) From b6b42da1cba6e5051c82ea21e40e31f006a9eae9 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 16:00:49 -0500 Subject: [PATCH 024/115] bump --- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index d0382b21a..fcd45aabb 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -20,7 +20,7 @@ dependencies { implementation("io.vertx:vertx-lang-kotlin:$vertxVersion") implementation("io.vertx:vertx-lang-kotlin-coroutines:$vertxVersion") implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.2") - implementation("io.dropwizard.metrics:metrics-core:4.2.7") + implementation("io.dropwizard.metrics:metrics-core:4.2.8") implementation("eu.geekplace.javapinning:java-pinning-core:1.2.0") } diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 5e0c7d771..be94f40fe 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -84,7 +84,7 @@ dependencies { implementation("com.fasterxml.jackson.datatype:jackson-datatype-guava:2.13.1") implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1") implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") - implementation("io.dropwizard.metrics:metrics-core:4.2.7") + implementation("io.dropwizard.metrics:metrics-core:4.2.8") implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.2") implementation("org.jooq:jooq:3.16.2") implementation("org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5") From 8ed4ac89b98d3d34d469857a42c03899c7516d82 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 16:58:06 -0500 Subject: [PATCH 025/115] bump --- gradle.properties | 2 +- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5f809a79c..14e471f68 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official pluginGroup = spp.jetbrains pluginName = Source++ -projectVersion=0.3.1 +projectVersion=0.4.0 pluginSinceBuild = 202.4357 # Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl # See https://jb.gg/intellij-platform-builds-list for available build versions diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index daf2082ba..2afe0fae7 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:90a0782cda") + implementation("com.github.sourceplusplus.protocol:protocol:c8340e0102") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index f0851a34f..e2d60d70e 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:90a0782cda") + compileOnly("com.github.sourceplusplus.protocol:protocol:c8340e0102") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index df13bff22..8e1fab712 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:90a0782cda") + compileOnly("com.github.sourceplusplus.protocol:protocol:c8340e0102") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index c88699f0d..1027fbaa2 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:90a0782cda") + compileOnly("com.github.sourceplusplus.protocol:protocol:c8340e0102") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index fcd45aabb..0e7d663f7 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:90a0782cda") + implementation("com.github.sourceplusplus.protocol:protocol:c8340e0102") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index be94f40fe..dc9278142 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -64,7 +64,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:90a0782cda") + implementation("com.github.sourceplusplus.protocol:protocol:c8340e0102") } implementation("org.jooq:joor:$joorVersion") From efcee420a58be9d46a82838a34ae354e9bd3511a Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 2 Feb 2022 17:44:49 -0500 Subject: [PATCH 026/115] bump --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index 2afe0fae7..e2029b886 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:c8340e0102") + implementation("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index e2d60d70e..7a6070477 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:c8340e0102") + compileOnly("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 8e1fab712..d47b0b7c2 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:c8340e0102") + compileOnly("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 1027fbaa2..129dce0fd 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:c8340e0102") + compileOnly("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 0e7d663f7..52b57569f 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:c8340e0102") + implementation("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index dc9278142..44af948f3 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -64,7 +64,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:c8340e0102") + implementation("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") } implementation("org.jooq:joor:$joorVersion") From c77f09748d96e5facdf8a72d7c5213c208aa72b8 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 4 Feb 2022 22:39:56 -0500 Subject: [PATCH 027/115] moved packages --- .../src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt | 2 +- plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java | 2 +- .../sourcemarker/discover/TCPServiceDiscoveryBackend.kt | 2 +- .../spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt | 2 +- .../sourcemarker/status/util/AutoCompleteCellRenderer.kt | 2 +- .../sourcemarker/status/util/ControlBarCellRenderer.kt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt index 155fe27eb..00077ff85 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt @@ -40,9 +40,9 @@ import org.jetbrains.uast.toUElementOfType import org.slf4j.LoggerFactory import spp.jetbrains.marker.jvm.psi.EndpointDetector import spp.jetbrains.marker.source.JVMMarkerUtils +import spp.protocol.artifact.ArtifactNameUtils import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType -import spp.protocol.utils.ArtifactNameUtils import java.util.* /** diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java index b7dbf941b..3e868fa28 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/ControlBar.java @@ -12,7 +12,7 @@ import spp.jetbrains.sourcemarker.command.LiveControlCommand; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.jetbrains.sourcemarker.status.util.ControlBarCellRenderer; -import spp.protocol.utils.ArtifactNameUtils; +import spp.protocol.artifact.ArtifactNameUtils; import javax.swing.*; import javax.swing.border.CompoundBorder; diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 6011ccf12..97da9ff3c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -46,7 +46,7 @@ import spp.jetbrains.sourcemarker.settings.serviceHostNormalized import spp.protocol.SourceServices.Utilize import spp.protocol.extend.TCPServiceFrameParser import spp.protocol.platform.PlatformAddress -import spp.protocol.status.InstanceConnection +import spp.protocol.platform.status.InstanceConnection import java.util.* /** diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt index 3d2a1afa4..3c5fb59ca 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt @@ -80,6 +80,7 @@ import spp.protocol.ProtocolAddress.Global.SetCurrentPage import spp.protocol.ProtocolAddress.Global.TraceSpanUpdated import spp.protocol.ProtocolAddress.Portal.UpdateEndpoints import spp.protocol.SourceServices.Instance +import spp.protocol.artifact.ArtifactNameUtils import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.endpoint.EndpointResult @@ -92,7 +93,6 @@ import spp.protocol.artifact.trace.TraceResult import spp.protocol.artifact.trace.TraceSpan import spp.protocol.instrument.LiveSourceLocation import spp.protocol.portal.PageType -import spp.protocol.utils.ArtifactNameUtils import spp.protocol.view.LiveViewConfig import spp.protocol.view.LiveViewSubscription import java.net.URI diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutoCompleteCellRenderer.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutoCompleteCellRenderer.kt index 9f350387d..84d481dd2 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutoCompleteCellRenderer.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutoCompleteCellRenderer.kt @@ -21,8 +21,8 @@ import spp.jetbrains.sourcemarker.PluginUI.BGND_FOCUS_COLOR import spp.jetbrains.sourcemarker.command.AutocompleteFieldRow import spp.jetbrains.sourcemarker.command.LiveControlCommand import spp.jetbrains.sourcemarker.element.AutocompleteRow +import spp.protocol.artifact.ArtifactNameUtils.getShortFunctionSignature import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.utils.ArtifactNameUtils.getShortFunctionSignature import java.awt.Component import javax.swing.DefaultListCellRenderer import javax.swing.JList diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/ControlBarCellRenderer.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/ControlBarCellRenderer.kt index b96f92de2..a56920ae1 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/ControlBarCellRenderer.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/ControlBarCellRenderer.kt @@ -21,7 +21,7 @@ import spp.jetbrains.sourcemarker.PluginUI import spp.jetbrains.sourcemarker.command.AutocompleteFieldRow import spp.jetbrains.sourcemarker.command.LiveControlCommand import spp.jetbrains.sourcemarker.element.LiveControlBarRow -import spp.protocol.utils.ArtifactNameUtils.getShortFunctionSignature +import spp.protocol.artifact.ArtifactNameUtils.getShortFunctionSignature import java.awt.Component import javax.swing.DefaultListCellRenderer import javax.swing.JList From af3cc608be5ae5f45c96d51c1de4fb03d18d75d2 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 4 Feb 2022 22:59:54 -0500 Subject: [PATCH 028/115] refactor --- .../sourcemarker/discover/TCPServiceDiscoveryBackend.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 97da9ff3c..d70db245c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -142,7 +142,7 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { val headers = JsonObject().apply { pluginConfig.serviceToken?.let { put("auth-token", it) } } FrameHelper.sendFrame( BridgeEventType.SEND.name.toLowerCase(), - PlatformAddress.MARKER_CONNECTED.address, + PlatformAddress.MARKER_CONNECTED, replyAddress, headers, true, JsonObject.mapFrom(pc), socket!! ) } From 135a416321e90903db67474a9f7d10a617afa610 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 5 Feb 2022 15:57:39 -0500 Subject: [PATCH 029/115] better error message --- .../sourcemarker/SourceMarkerPlugin.kt | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 739faee8e..43d9c6c71 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -17,6 +17,7 @@ */ package spp.jetbrains.sourcemarker +import com.apollographql.apollo3.exception.ApolloHttpException import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature @@ -106,8 +107,8 @@ import spp.protocol.artifact.trace.TraceResult import spp.protocol.artifact.trace.TraceSpan import spp.protocol.artifact.trace.TraceSpanStackQueryResult import spp.protocol.artifact.trace.TraceStack -import spp.protocol.service.LiveService import spp.protocol.service.LiveInstrumentService +import spp.protocol.service.LiveService import spp.protocol.service.LiveViewService import spp.protocol.service.LogCountIndicatorService import spp.protocol.util.KSerializers @@ -257,6 +258,29 @@ object SourceMarkerPlugin { initMonitor(config) connectedMonitor = true } catch (ignored: CancellationException) { + } catch (throwable: ApolloHttpException) { + val pluginName = message("plugin_name") + if (throwable.statusCode == 401) { + Notifications.Bus.notify( + Notification( + pluginName, "Connection unauthorized", + "Failed to authenticate with $pluginName. " + + "Please ensure the correct configuration " + + "is set at: Settings -> Tools -> $pluginName", + NotificationType.ERROR + ) + ) + } else { + Notifications.Bus.notify( + Notification( + pluginName, "Connection failed", + "Failed to connect to $pluginName. " + + "Please ensure the correct configuration " + + "is set at: Settings -> Tools -> $pluginName", + NotificationType.ERROR + ) + ) + } } catch (throwable: Throwable) { //todo: if first time bring up config panel automatically instead of notification val pluginName = message("plugin_name") @@ -284,8 +308,8 @@ object SourceMarkerPlugin { log.error("Connection failed. Reason: {}", throwable.message) } - discoverAvailableServices(config, project) if (connectedMonitor) { + discoverAvailableServices(config, project) initPortal(config) initMarker(config, project) initMapper() @@ -465,15 +489,6 @@ object SourceMarkerPlugin { } } else { config.serviceToken = null - - log.error("Invalid access token") - Notifications.Bus.notify( - Notification( - message("plugin_name"), "Invalid access token", - "Failed to validate access token", - NotificationType.ERROR - ) - ) } } else { //try default local access From d0f1a17f9376a036938d071eb5d55fb579474c45 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 5 Feb 2022 15:58:11 -0500 Subject: [PATCH 030/115] bump --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index e2029b886..b26fe4b8b 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") + implementation("com.github.sourceplusplus.protocol:protocol:46eaa1c361") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 7a6070477..ae0cd0e0c 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") + compileOnly("com.github.sourceplusplus.protocol:protocol:46eaa1c361") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index d47b0b7c2..88385d1da 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") + compileOnly("com.github.sourceplusplus.protocol:protocol:46eaa1c361") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 129dce0fd..940ff8f22 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") + compileOnly("com.github.sourceplusplus.protocol:protocol:46eaa1c361") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 52b57569f..6c99dad16 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") + implementation("com.github.sourceplusplus.protocol:protocol:46eaa1c361") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 10cc4d13d..3026f9743 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -65,7 +65,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:b0399b3a1b") + implementation("com.github.sourceplusplus.protocol:protocol:46eaa1c361") } implementation("org.jooq:joor:$joorVersion") From eccbd2dcd976ace5266d023c26f92562afd6e304 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 5 Feb 2022 17:08:11 -0500 Subject: [PATCH 031/115] bump --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index b26fe4b8b..47f49a325 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:46eaa1c361") + implementation("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index ae0cd0e0c..fe11bdfcc 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:46eaa1c361") + compileOnly("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 88385d1da..b5dbabdb7 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:46eaa1c361") + compileOnly("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 940ff8f22..6138888da 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:46eaa1c361") + compileOnly("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 6c99dad16..fdc9abb01 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:46eaa1c361") + implementation("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 3026f9743..fc3c945a8 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -65,7 +65,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:46eaa1c361") + implementation("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") } implementation("org.jooq:joor:$joorVersion") From c592d2c4ae0081247697ba2ea4836d5b06b3b897 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 5 Feb 2022 20:58:32 -0500 Subject: [PATCH 032/115] use official lib --- ...vertx-service-discovery-4.0.3-SNAPSHOT.jar | Bin 70285 -> 0 bytes plugin/build.gradle.kts | 2 +- .../sourcemarker/SourceMarkerPlugin.kt | 23 ++++++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) delete mode 100644 plugin/.ext/vertx-service-discovery-4.0.3-SNAPSHOT.jar diff --git a/plugin/.ext/vertx-service-discovery-4.0.3-SNAPSHOT.jar b/plugin/.ext/vertx-service-discovery-4.0.3-SNAPSHOT.jar deleted file mode 100644 index 451d90e896e9e562d91e202b188d08c7f8e78dd5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 70285 zcmb5V1#lfpval(%n3$rdv+Tg)trnVFfHnZdHwGxPr0JM&`i z?sh~+baZD{R99zyS(#O>EC&e%4+aYh3znCwtx62W2wciDZIFVFC4SY3WrnSZT9LVDz!c zCL9ZVt?cl++VpbcFuI3_?B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K;49 z{VOr=@7-}bjn7>=0^a;P9ly!g|I%@@JiZ-Co&F~g-&yr6>)%n__5%K2_&1CD+ab*n zZ^6&e|D6Z71Nh!;;2aRZKdbd0eRR*|SsC5uw*EVXw=MSXsuK# z%w07?vT`4;ztqStUG?VI n{WHUEAEe$r4Kdxn57X_NY#DK|$2Tox2mbR$1_3#`xOw|O0E@?h diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index fc3c945a8..3b5727bc1 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -77,7 +77,7 @@ dependencies { implementation("io.vertx:vertx-lang-kotlin:$vertxVersion") implementation("io.vertx:vertx-lang-kotlin-coroutines:$vertxVersion") implementation("io.vertx:vertx-web:$vertxVersion") - implementation(files(".ext/vertx-service-discovery-4.0.3-SNAPSHOT.jar")) + implementation("io.vertx:vertx-service-discovery:$vertxVersion") implementation("io.vertx:vertx-service-proxy:$vertxVersion") implementation("io.vertx:vertx-tcp-eventbus-bridge:$vertxVersion") implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.1") diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 43d9c6c71..3aeced3ea 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -328,15 +328,22 @@ object SourceMarkerPlugin { throw RuntimeException(e) } - val discovery: ServiceDiscovery = DiscoveryImpl( - vertx, - ServiceDiscoveryOptions().setBackendConfiguration( - JsonObject() - .put("backend-name", "tcp-service-discovery") - .put("hardcoded_config", hardcodedConfig) - .put("sourcemarker_plugin_config", JsonObject.mapFrom(config)) + val discovery: ServiceDiscovery + val originalClassLoader = Thread.currentThread().contextClassLoader + try { + Thread.currentThread().contextClassLoader = javaClass.classLoader + discovery = DiscoveryImpl( + vertx, + ServiceDiscoveryOptions().setBackendConfiguration( + JsonObject() + .put("backend-name", "tcp-service-discovery") + .put("hardcoded_config", hardcodedConfig) + .put("sourcemarker_plugin_config", JsonObject.mapFrom(config)) + ) ) - ) + } finally { + Thread.currentThread().contextClassLoader = originalClassLoader + } log.info("Discovering available services") val availableRecords = discovery.getRecords { true }.await() From 75d5491fb3de3aa75271efc56f528ced96ae646d Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Feb 2022 13:19:10 -0500 Subject: [PATCH 033/115] Update build.gradle.kts --- mapper/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index 47f49a325..a723a9a54 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") + implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") From b4db81c330346e49837170837029c8c9cc70c45a Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Feb 2022 13:19:29 -0500 Subject: [PATCH 034/115] Update build.gradle.kts --- marker/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index fe11bdfcc..e308f9aa9 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") + compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") From c5bc659c4835ec70f47c76ed03dc43e86b8c2ac1 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Feb 2022 13:19:40 -0500 Subject: [PATCH 035/115] Update build.gradle.kts --- marker/jvm-marker/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index b5dbabdb7..72cf7d187 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") + compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") From 47b65637d24e87716f69a6e4611c3e2a3f808771 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Feb 2022 13:20:01 -0500 Subject: [PATCH 036/115] Update build.gradle.kts --- marker/py-marker/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 6138888da..a21bfac40 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") + compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") From 7911a118db40b305d878360863317215f0f3b915 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Feb 2022 13:20:13 -0500 Subject: [PATCH 037/115] Update build.gradle.kts --- monitor/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index fdc9abb01..a73c656fb 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") + implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") From af73fafb1e7ba7e5a146815148da70358cbf00eb Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Feb 2022 13:30:01 -0500 Subject: [PATCH 038/115] bump --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 21412fe68..671277dc6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,7 +7,7 @@ pluginManagement { id 'org.jetbrains.kotlin.plugin.serialization' version kotlinVersion apply false id 'com.avast.gradle.docker-compose' version "0.15.0" apply false id 'io.gitlab.arturbosch.detekt' version "1.19.0" apply false - id 'com.apollographql.apollo3' version "3.0.0" apply false + id 'com.apollographql.apollo3' version "3.1.0" apply false id 'com.diffplug.spotless' version '6.2.1' apply false } } From 79df319280dba9129194411dfad999f69013d9cc Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Feb 2022 14:06:12 -0500 Subject: [PATCH 039/115] Update build.gradle.kts --- plugin/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 3b5727bc1..617245ca5 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -64,8 +64,8 @@ dependencies { implementation(project(":marker:jvm-marker")) implementation(project(":marker:py-marker")) implementation(project(":monitor")) - implementation("com.github.sourceplusplus.interface-portal:portal-jvm:fc869f7181") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:2f2e39f1f1") + implementation("com.github.sourceplusplus.interface-portal:portal-jvm:$projectVersion") { isTransitive = false } + implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") } implementation("org.jooq:joor:$joorVersion") From 719c315921213f68408262733b0694e39604077a Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Feb 2022 15:08:42 -0500 Subject: [PATCH 040/115] bump --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5ce062dad..b7511be51 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ platformPlugins = java, Groovy, Kotlin, PythonCore:213.5744.223, org.intellij.sc # See https://kotlinlang.org/docs/reference/using-gradle.html#dependency-on-the-standard-library for details. kotlin.stdlib.default.dependency = true -apolloVersion=3.0.0 +apolloVersion=3.1.0 vertxVersion=4.2.4 slf4jVersion=1.7.33 jacksonVersion=2.13.1 From 13391f90dca57bff8b41e95aff3accb22fb594eb Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Feb 2022 13:53:45 -0500 Subject: [PATCH 041/115] fixes #658 --- .../kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt index 00077ff85..e1bbff1f5 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt @@ -59,8 +59,12 @@ object ArtifactSearch { suspend fun detectRootPackage(project: Project): String? { var basePackages = withContext(Dispatchers.Default) { ApplicationManager.getApplication().runReadAction(Computable> { - JavaPsiFacade.getInstance(project).findPackage("") - ?.getSubPackages(ProjectScope.getProjectScope(project))!! + val foundPackage = JavaPsiFacade.getInstance(project).findPackage("") + if (foundPackage != null) { + foundPackage.getSubPackages(ProjectScope.getProjectScope(project)) + } else { + emptyArray() + } }) } From c446ab7b413620f6161492361b8ccac30cc14fc6 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Feb 2022 13:55:54 -0500 Subject: [PATCH 042/115] refactor --- .../kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt index e1bbff1f5..b2a4dd60e 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactSearch.kt @@ -59,12 +59,8 @@ object ArtifactSearch { suspend fun detectRootPackage(project: Project): String? { var basePackages = withContext(Dispatchers.Default) { ApplicationManager.getApplication().runReadAction(Computable> { - val foundPackage = JavaPsiFacade.getInstance(project).findPackage("") - if (foundPackage != null) { - foundPackage.getSubPackages(ProjectScope.getProjectScope(project)) - } else { - emptyArray() - } + JavaPsiFacade.getInstance(project).findPackage("") + ?.getSubPackages(ProjectScope.getProjectScope(project)) ?: emptyArray() }) } From d5c355d5f4ece5249ec3185012b226b136f2a65d Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 9 Feb 2022 14:04:13 -0500 Subject: [PATCH 043/115] remove globalscope --- .../listeners/PortalEventListener.kt | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt index 3c5fb59ca..842aad59d 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt @@ -29,7 +29,6 @@ import io.vertx.core.json.Json import io.vertx.core.json.JsonObject import io.vertx.kotlin.coroutines.CoroutineVerticle import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.datetime.Instant import org.slf4j.LoggerFactory @@ -207,7 +206,7 @@ class PortalEventListener( if (sourceMarks.isNotEmpty()) { it.reply(sourceMarks[0].getUserData(SourceMarkKeys.SOURCE_PORTAL)!!) } else { - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { val classArtifact = findArtifact( vertx, artifactQualifiedName.copy( identifier = ArtifactNameUtils.getQualifiedClassName(artifactQualifiedName.identifier)!!, @@ -249,7 +248,7 @@ class PortalEventListener( vertx.eventBus().consumer(RefreshOverview) { runReadAction { val fileMarker = SourceMarker.getSourceFileMarker(it.body().viewingArtifact)!! - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { refreshOverview(fileMarker, it.body()) } @@ -259,7 +258,7 @@ class PortalEventListener( vertx.eventBus().consumer(RefreshActivity) { val portal = it.body() //pull from skywalking - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { pullLatestActivity(portal) } @@ -267,7 +266,7 @@ class PortalEventListener( if (Instance.liveView != null) { Instance.liveView!!.clearLiveViewSubscriptions().onComplete { if (it.succeeded()) { - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { val sourceMark = SourceMarker.getSourceMark( portal.viewingArtifact, SourceMark.Type.GUTTER ) ?: return@launch @@ -298,7 +297,7 @@ class PortalEventListener( vertx.eventBus().consumer(RefreshTraces) { val portal = it.body() //pull from skywalking - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { pullLatestTraces(it.body()) } @@ -306,7 +305,7 @@ class PortalEventListener( if (Instance.liveView != null) { Instance.liveView!!.clearLiveViewSubscriptions().onComplete { if (it.succeeded()) { - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { val sourceMark = SourceMarker.getSourceMark( portal.viewingArtifact, SourceMark.Type.GUTTER ) ?: return@launch @@ -337,7 +336,7 @@ class PortalEventListener( vertx.eventBus().consumer(RefreshLogs) { val portal = it.body() //pull from skywalking - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { pullLatestLogs(portal) } @@ -345,7 +344,7 @@ class PortalEventListener( if (Instance.liveView != null) { Instance.liveView!!.clearLiveViewSubscriptions().onComplete { if (it.succeeded()) { - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { val sourceMark = SourceMarker.getSourceMark( portal.viewingArtifact, SourceMark.Type.GUTTER ) @@ -385,7 +384,7 @@ class PortalEventListener( } vertx.eventBus().consumer(QueryTraceStack) { handler -> val traceId = handler.body() - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { handler.reply(EndpointTracesBridge.getTraceStack(traceId, vertx)) } } @@ -407,12 +406,12 @@ class PortalEventListener( vertx.eventBus().consumer(CanNavigateToArtifact) { val artifactQualifiedName = it.body() val project = ProjectManager.getInstance().openProjects[0] - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { it.reply(ArtifactNavigator.canNavigateTo(project, artifactQualifiedName)) } } vertx.eventBus().consumer(NavigateToArtifact) { msg -> - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { ArtifactNavigator.navigateTo(vertx, msg.body()) { if (it.succeeded()) { log.info("Navigated to artifact $it") @@ -431,7 +430,7 @@ class PortalEventListener( if (sourceMark != null && sourceMark is MethodSourceMark) { val endpointId = sourceMark.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(sourceMark) if (endpointId != null) { - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { val traceResult = EndpointTracesBridge.getTraces( GetEndpointTraces( artifactQualifiedName = portal.viewingArtifact, @@ -460,7 +459,7 @@ class PortalEventListener( ) { //todo: rename {GET} to [GET] in skywalking if (markerConfig.autoResolveEndpointNames) { - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { //todo: only try to auto resolve endpoint names with dynamic ids //todo: support multiple operationsNames/traceIds traceResult.traces.forEach { @@ -490,7 +489,7 @@ class PortalEventListener( private suspend fun pullLatestLogs(portal: SourcePortal) { if (log.isTraceEnabled) log.trace("Refreshing logs. Portal: {}", portal.portalUuid) val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) - GlobalScope.launch(vertx.dispatcher()) { + launch(vertx.dispatcher()) { val logsResult = LogsBridge.queryLogs( GetEndpointLogs( endpointId = if (sourceMark is MethodSourceMark) { From 11855308599aa71b6872d301a4219e54e3e82ed9 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 18 Feb 2022 16:52:00 -0500 Subject: [PATCH 044/115] fixes #666 --- .../kotlin/spp/jetbrains/marker/plugin/FileActivityListener.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/plugin/FileActivityListener.kt b/marker/src/main/kotlin/spp/jetbrains/marker/plugin/FileActivityListener.kt index 0fc2794e4..3725fe75d 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/plugin/FileActivityListener.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/plugin/FileActivityListener.kt @@ -54,7 +54,7 @@ class FileActivityListener : FileEditorManagerListener { } override fun fileClosed(source: FileEditorManager, file: VirtualFile) { - if (DumbService.isDumb(source.project)) { + if (DumbService.isDumb(source.project) || !file.isValid) { log.debug("Ignoring file closed: $file") } else { log.debug("File closed: $file") From 0b88b6d383df240898dd33bac1caefb0857c24b8 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 18 Feb 2022 17:22:59 -0500 Subject: [PATCH 045/115] refactor --- .../kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt | 5 ----- .../sourcemarker/discover/TCPServiceDiscoveryBackend.kt | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 3aeced3ea..27878588d 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -113,11 +113,9 @@ import spp.protocol.service.LiveViewService import spp.protocol.service.LogCountIndicatorService import spp.protocol.util.KSerializers import spp.protocol.util.LocalMessageCodec -import java.awt.Color import java.awt.Dimension import java.io.File import java.io.IOException -import java.util.* /** * Sets up the SourceMarker plugin by configuring and initializing the various plugin modules. @@ -128,9 +126,6 @@ import java.util.* @Suppress("MagicNumber") object SourceMarkerPlugin { - val SOURCE_RED = Color(225, 72, 59) - val INSTANCE_ID = UUID.randomUUID().toString() - private val log = LoggerFactory.getLogger(SourceMarkerPlugin::class.java) private val deploymentIds = mutableListOf() val vertx: Vertx diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index d70db245c..736abc47e 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -39,7 +39,6 @@ import io.vertx.servicediscovery.spi.ServiceDiscoveryBackend import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import org.slf4j.LoggerFactory -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.settings.isSsl import spp.jetbrains.sourcemarker.settings.serviceHostNormalized @@ -127,7 +126,7 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { //setup connection val replyAddress = UUID.randomUUID().toString() - val pc = InstanceConnection(SourceMarkerPlugin.INSTANCE_ID, System.currentTimeMillis()) + val pc = InstanceConnection(UUID.randomUUID().toString(), System.currentTimeMillis()) val consumer: MessageConsumer = vertx.eventBus().localConsumer(replyAddress) val promise = Promise.promise() From 16c680e33b2d05dfd21d5644e8db89f5fd10f251 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 23 Feb 2022 17:12:24 +0100 Subject: [PATCH 046/115] formatting --- .../java/spp/jetbrains/sourcemarker/status/LogStatusBar.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index d25d861d2..e3a863666 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -156,7 +156,7 @@ public void setLiveInstrument(LiveInstrument liveInstrument) { displayTimeField(); addExpandButton(); repaint(); - LiveStatusManager.INSTANCE.addStatusBar(inlayMark,this); + LiveStatusManager.INSTANCE.addStatusBar(inlayMark, this); } public void setWrapperPanel(JPanel wrapperPanel) { From 2e2b94e45f39f5a77393cda58bbd888ffe39cefd Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 26 Feb 2022 16:50:50 +0100 Subject: [PATCH 047/115] fix log pattern ordering --- .../sourcemarker/status/LogStatusBar.java | 27 +++---- .../service/log/VariableParser.kt | 74 +++++++++---------- .../status/util/AutocompleteField.kt | 8 +- .../service/log/VariableParserTest.kt | 27 +++++-- 4 files changed, 66 insertions(+), 70 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index e3a863666..2b05c9526 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -83,7 +83,6 @@ public class LogStatusBar extends JPanel implements StatusBar, VisibleAreaListen private Log latestLog; private JWindow popup; private LiveLogConfigurationPanel configurationPanel; - private final AtomicBoolean settingFormattedMessage = new AtomicBoolean(false); private boolean disposed = false; private JLabel expandLabel; private boolean expanded; @@ -97,7 +96,7 @@ public class LogStatusBar extends JPanel implements StatusBar, VisibleAreaListen new LogHitColumnInfo(TIME) }, new ArrayList<>(), 0, SortOrder.DESCENDING); - private final Pair patternPair; + private final Pattern varPattern; public LogStatusBar(LiveSourceLocation sourceLocation, List scopeVars, InlayMark inlayMark) { this.sourceLocation = sourceLocation; @@ -115,8 +114,8 @@ public Icon getIcon() { } }).collect(Collectors.toList()); lookup = text -> scopeVars.stream() - .filter(v -> VariableParser.isVariable(text, v) - ).map(it -> new AutocompleteFieldRow() { + .filter(v -> VariableParser.isVariable(text, v)) + .map(it -> new AutocompleteFieldRow() { public String getText() { return VariableParser.DOLLAR + it; } @@ -132,7 +131,7 @@ public Icon getIcon() { .limit(7) .collect(Collectors.toList()); - patternPair = VariableParser.createPattern(scopeVars); + varPattern = VariableParser.createPattern(scopeVars, "$", true, false); this.inlayMark = inlayMark; @@ -335,7 +334,6 @@ private void setupComponents() { liveLogTextField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { - if (settingFormattedMessage.get()) return; if (liveLog != null) { String originalMessage = liveLog.getLogFormat(); for (String var : liveLog.getLogArguments()) { @@ -380,16 +378,7 @@ public void focusGained(FocusEvent e) { liveLogTextField.setEditMode(true); if (liveLog != null) { - String originalMessage = liveLog.getLogFormat(); - for (String var : liveLog.getLogArguments()) { - originalMessage = originalMessage.replaceFirst( - QUOTE_CURLY_BRACES, - Matcher.quoteReplacement(VariableParser.DOLLAR + var) - ); - } - settingFormattedMessage.set(true); - liveLogTextField.setText(originalMessage); - settingFormattedMessage.set(false); + liveLogTextField.setText(liveLog.getMeta().get("original_log_pattern").toString()); } } @@ -554,7 +543,7 @@ private void saveLiveLog() { }); } - Pair> resp = VariableParser.extractVariables(patternPair, liveLogTextField.getText()); + Pair> resp = VariableParser.extractVariables(varPattern, liveLogTextField.getText()); final String finalLogPattern = resp.first; String condition = null; @@ -580,10 +569,11 @@ private void saveLiveLog() { HashMap meta = new HashMap<>(); meta.put("original_source_mark", inlayMark.getId()); + meta.put("original_log_pattern", liveLogTextField.getText()); LiveLog instrument = new LiveLog( finalLogPattern, - resp.second.stream().map(it -> it.substring(1)).collect(Collectors.toList()), + resp.second, sourceLocation, condition, expirationDate, @@ -647,6 +637,7 @@ private void initComponents() { timeLabel = new JLabel(); separator1 = new JSeparator(); liveLogTextField = new AutocompleteField(placeHolderText, scopeVars, lookup, inlayMark.getArtifactQualifiedName(), false, false, COMPLETE_COLOR_PURPLE); + liveLogTextField.setVarPattern(varPattern); closeLabel = new JLabel(); //======== this ======== diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParser.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParser.kt index 8923ddffa..062065ee7 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParser.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParser.kt @@ -24,40 +24,48 @@ import java.util.regex.Pattern object VariableParser { - const val PATTERN_CURLY_BRACES = "\\{|\\}" const val EMPTY = "" const val SPACE = " " const val DOLLAR = "$" @JvmStatic - fun createPattern(scopeVars: List): Pair { - var variablePattern: Pattern? = null - var templateVariablePattern: Pattern? = null + fun createPattern( + scopeVars: List, varInitChar: String = DOLLAR, + includeCurlyPattern: Boolean = true, + ignoreCase: Boolean = false + ): Pattern { + val sb = StringBuilder("") if (scopeVars.isNotEmpty()) { - val sb = StringBuilder("(") - val sbt = StringBuilder("(") + sb.append("(") for (i in scopeVars.indices) { - sb.append("\\$").append(scopeVars[i]) - sbt.append("\\$\\{").append(scopeVars[i]).append("\\}") + if (varInitChar.isNotEmpty()) { + sb.append("\\$varInitChar") + } + sb.append(scopeVars[i]).append("(?=\\s|$)") + if (includeCurlyPattern) { + sb.append("|") + sb.append("\\$varInitChar\\{").append(scopeVars[i]).append("\\}") + } if (i + 1 < scopeVars.size) { sb.append("|") - sbt.append("|") } } - sb.append(")(?:\\s|$)") - sbt.append(")(?:|$)") - variablePattern = Pattern.compile(sb.toString()) - templateVariablePattern = Pattern.compile(sbt.toString()) + sb.append(")") + } + + return if (ignoreCase) { + Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE) + } else { + Pattern.compile(sb.toString()) } - return Pair.create(variablePattern, templateVariablePattern) } @JvmStatic - fun extractVariables(patternPair: Pair, logText: String): Pair> { + fun extractVariables(pattern: Pattern, logText: String): Pair> { var logTemplate = logText val varMatches: MutableList = ArrayList() - if (patternPair.first != null) { - val m = patternPair.first!!.matcher(logTemplate) + if (pattern.pattern().isNotEmpty()) { + val m = pattern.matcher(logTemplate) var matchLength = 0 while (m.find()) { val variable = m.group(1) @@ -65,34 +73,20 @@ object VariableParser { + logTemplate.substring(m.start() - matchLength) .replaceFirst(Pattern.quote(variable).toRegex(), "{}")) matchLength = matchLength + variable.length - 1 - varMatches.add(variable) - } - } - if (patternPair.second != null) { - val m = patternPair.second!!.matcher(logTemplate) - var matchLength = 0 - while (m.find()) { - var variable = m.group(1) - logTemplate = (logTemplate.substring(0, m.start() - matchLength) - + logTemplate.substring(m.start() - matchLength) - .replaceFirst(Pattern.quote(variable).toRegex(), "{}")) - matchLength = matchLength + variable.length - 1 - variable = variable.replace(PATTERN_CURLY_BRACES.toRegex(), EMPTY) - varMatches.add(variable) + + if (variable.startsWith("$DOLLAR{")) { + varMatches.add(variable.substring(2, variable.length - 1)) + } else { + varMatches.add(variable.substring(1)) + } } } return Pair.create(logTemplate, varMatches) } - fun matchVariables(patternPair: Pair, input: String, function: Function) { - if (patternPair.first != null) { - val match = patternPair.first!!.matcher(input) - function.apply(match) - } - if (patternPair.second != null) { - val match = patternPair.second!!.matcher(input) - function.apply(match) - } + fun matchVariables(pattern: Pattern, input: String, function: Function) { + val match = pattern.matcher(input) + function.apply(match) } @JvmStatic diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt index b42dcfc0f..cf7acb666 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt @@ -17,7 +17,6 @@ */ package spp.jetbrains.sourcemarker.status.util -import com.intellij.openapi.util.Pair import com.intellij.openapi.util.ScalableIcon import com.intellij.ui.components.JBList import com.intellij.util.ui.JBUI @@ -66,7 +65,8 @@ class AutocompleteField( var addOnSuggestionDoubleClick: Boolean = true var placeHolderTextColor: Color? = null var canShowSaveButton = true - var patternPair: Pair = Pair.empty(); + var varPattern: Pattern = Pattern.compile("") + var includeCurlyPattern: Boolean = false val matchAndApplyStyle = { m: Matcher -> while (m.find()) { @@ -116,7 +116,7 @@ class AutocompleteField( document.addDocumentListener(this) addKeyListener(this) - patternPair = VariableParser.createPattern(allLookup.map { a->a.getText().substring(1)}) + varPattern = VariableParser.createPattern(allLookup.map { it.getText() }, "", includeCurlyPattern, true) document.putProperty("filterNewlines", true) @@ -185,7 +185,7 @@ class AutocompleteField( true ) - VariableParser.matchVariables(patternPair, text, matchAndApplyStyle) + VariableParser.matchVariables(varPattern, text, matchAndApplyStyle) } private fun addNumberStyle(pn: JTextPane) { diff --git a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParserTest.kt b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParserTest.kt index 83bd01f33..53e7c8ebf 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParserTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParserTest.kt @@ -25,8 +25,8 @@ class VariableParserTest { @Test fun extractVariablesPattern1() { val input = "hello\$tt \$tthello \${tt}\$tt" - val patternPair = VariableParser.createPattern(listOf("tt", "deleteDate", "executorService")) - val resp = VariableParser.extractVariables(patternPair, input) + val varPattern = VariableParser.createPattern(listOf("tt", "deleteDate", "executorService")) + val resp = VariableParser.extractVariables(varPattern, input) assertEquals(3, resp.second.size) assertEquals("hello{} \$tthello {}{}", resp.first) @@ -35,8 +35,8 @@ class VariableParserTest { @Test fun extractVariablesPattern2() { val input = "\$tt \$deleteDate \${tt}\${deleteDate}\$tt" - val patternPair = VariableParser.createPattern(listOf("tt", "deleteDate", "executorService")) - val resp = VariableParser.extractVariables(patternPair, input) + val varPattern = VariableParser.createPattern(listOf("tt", "deleteDate", "executorService")) + val resp = VariableParser.extractVariables(varPattern, input) assertEquals(5, resp.second.size) assertEquals("{} {} {}{}{}", resp.first) @@ -45,18 +45,29 @@ class VariableParserTest { @Test fun extractVariablesPattern3() { val input = "hello\$user \$deleteDatebut not\${user}working\${deleteDate}\$user" - val patternPair = VariableParser.createPattern(listOf("user", "deleteDate", "executorService")) - val resp = VariableParser.extractVariables(patternPair, input) + val varPattern = VariableParser.createPattern(listOf("user", "deleteDate", "executorService")) + val resp = VariableParser.extractVariables(varPattern, input) assertEquals(4, resp.second.size) assertEquals("hello{} \$deleteDatebut not{}working{}{}", resp.first) } + @Test + fun testVariableOrder() { + val input = "\${i}hi\$date" + val variablePattern = VariableParser.createPattern(listOf("i", "deleteDate", "date")) + val resp = VariableParser.extractVariables(variablePattern, input) + + assertEquals(2, resp.second.size) + assertEquals("{}hi{}", resp.first) + assertEquals(listOf("i", "date"), resp.second) + } + @Test fun extractNoVariables() { val input = "hello\$user \$deleteDatebut not\${user}working\${deleteDate}\$user" - val patternPair = VariableParser.createPattern(emptyList()) - val resp = VariableParser.extractVariables(patternPair, input) + val varPattern = VariableParser.createPattern(emptyList()) + val resp = VariableParser.extractVariables(varPattern, input) assertEquals(0, resp.second.size) assertEquals(input, resp.first) From 032811d2aac1e48e1809fb9c5ec93b1f3fced02c Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 26 Feb 2022 16:51:09 +0100 Subject: [PATCH 048/115] bump --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index ce97955d5..2d9a7d82a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,10 +8,10 @@ projectVersion=0.4.1 pluginSinceBuild = 202.4357 # Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl # See https://jb.gg/intellij-platform-builds-list for available build versions -pluginVerifierIdeVersions = 2020.3.2, 2021.3.1 +pluginVerifierIdeVersions = 2020.3.2, 2021.3.2 platformType = IC -ideVersion = 2021.3.1 +ideVersion = 2021.3.2 platformDownloadSources = true # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 From 9dcfc6d2dde292415e35fc9ffe99f4daa6135097 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 26 Feb 2022 17:38:33 +0100 Subject: [PATCH 049/115] live variable presentation --- .../spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt index 183ab6ef2..34429d436 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMVariableSimpleNode.kt @@ -127,8 +127,11 @@ class JVMVariableSimpleNode(val variable: LiveVariable) : SimpleNode() { } else { val simpleClassName = variable.liveClazz!!.substringAfterLast(".") val identity = variable.liveIdentity - presentation.addText("{ $simpleClassName@$identity }", SimpleTextAttributes.GRAYED_ATTRIBUTES) - + if (variable.presentation != null) { + presentation.addText("\"${variable.presentation}\"", SimpleTextAttributes.REGULAR_ATTRIBUTES) + } else { + presentation.addText("{ $simpleClassName@$identity }", SimpleTextAttributes.GRAYED_ATTRIBUTES) + } presentation.setIcon(AllIcons.Debugger.Value) } } else { From 727daf34603e727aad7c9470019f65e291b54578 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 27 Feb 2022 00:01:46 +0100 Subject: [PATCH 050/115] refactor --- .../spp/jetbrains/monitor/skywalking/SkywalkingClient.kt | 2 +- .../spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt | 2 +- .../spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt | 2 +- .../jetbrains/sourcemarker/status/BreakpointStatusBar.java | 2 +- .../java/spp/jetbrains/sourcemarker/status/LogStatusBar.java | 3 +-- .../spp/jetbrains/sourcemarker/status/MeterStatusBar.java | 2 +- .../java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java | 2 +- .../kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt | 4 ++-- .../jetbrains/sourcemarker/service/LiveInstrumentManager.kt | 2 +- .../service/breakpoint/BreakpointHitColumnInfo.kt | 2 +- .../jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt | 2 +- 11 files changed, 12 insertions(+), 13 deletions(-) diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt index 6711dcbd7..c96865207 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt @@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics import spp.jetbrains.monitor.skywalking.model.GetEndpointTraces import spp.jetbrains.monitor.skywalking.model.GetMultipleEndpointMetrics -import spp.protocol.util.LocalMessageCodec +import spp.protocol.marshall.LocalMessageCodec import java.io.IOException import java.time.ZoneOffset.ofHours import java.time.ZonedDateTime diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt index c52685b98..ba37b96a1 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointBridge.kt @@ -27,7 +27,7 @@ import kotlinx.coroutines.launch import monitor.skywalking.protocol.metadata.SearchEndpointQuery import org.slf4j.LoggerFactory import spp.jetbrains.monitor.skywalking.SkywalkingClient -import spp.protocol.util.LocalMessageCodec +import spp.protocol.marshall.LocalMessageCodec /** * todo: description. diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt index 2317c985c..30a47af17 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/LogsBridge.kt @@ -35,7 +35,7 @@ import spp.protocol.artifact.exception.LiveStackTrace import spp.protocol.artifact.log.Log import spp.protocol.artifact.log.LogOrderType import spp.protocol.artifact.log.LogResult -import spp.protocol.util.LocalMessageCodec +import spp.protocol.marshall.LocalMessageCodec /** * todo: description. diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index e9faf22ae..5fa2718e1 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -54,7 +54,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved; +import static spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.BREAKPOINT_HIT; import static spp.protocol.instrument.event.LiveInstrumentEventType.BREAKPOINT_REMOVED; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index 2b05c9526..579c4f5b1 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -48,7 +48,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; import java.util.regex.Matcher; @@ -58,7 +57,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved; +import static spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_HIT; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_REMOVED; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index 5d9446197..1e3351963 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -46,7 +46,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved; +import static spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.METER_REMOVED; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index f4780a969..e70246797 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -43,7 +43,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved; +import static spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.METER_REMOVED; diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 27878588d..f1368290c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -111,8 +111,8 @@ import spp.protocol.service.LiveInstrumentService import spp.protocol.service.LiveService import spp.protocol.service.LiveViewService import spp.protocol.service.LogCountIndicatorService -import spp.protocol.util.KSerializers -import spp.protocol.util.LocalMessageCodec +import spp.protocol.marshall.KSerializers +import spp.protocol.marshall.LocalMessageCodec import java.awt.Dimension import java.io.File import java.io.IOException diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 947f344e0..5b61ad2d5 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -37,7 +37,7 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated -import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved +import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide.toLiveInstrumentSubscriberAddress import spp.protocol.instrument.LiveBreakpoint diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt index 7c3ee64df..73edda884 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt @@ -22,7 +22,7 @@ import io.vertx.core.json.Json import io.vertx.core.json.JsonObject import kotlinx.datetime.Clock import spp.jetbrains.sourcemarker.PluginBundle.message -import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved +import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.instrument.event.LiveBreakpointHit import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt index 4bb12dc8e..dec67dd04 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt @@ -22,7 +22,7 @@ import io.vertx.core.json.Json import io.vertx.core.json.JsonObject import kotlinx.datetime.Clock import spp.jetbrains.sourcemarker.PluginBundle.message -import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved +import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType import spp.protocol.instrument.event.LiveLogHit From b79727dbfa488fca53686277c578a35f669ecf97 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 27 Feb 2022 12:01:19 +0100 Subject: [PATCH 051/115] use protocol marshaller --- .../jetbrains/sourcemarker/service/LiveInstrumentManager.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 5b61ad2d5..f4903f7f9 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -42,10 +42,10 @@ import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide.toLiveInstrumentSubscriberAddress import spp.protocol.instrument.LiveBreakpoint import spp.protocol.instrument.LiveLog -import spp.protocol.instrument.event.LiveBreakpointHit import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType import spp.protocol.instrument.event.LiveLogHit +import spp.protocol.marshall.ProtocolMarshaller /** * todo: description. @@ -165,7 +165,7 @@ class LiveInstrumentManager( } private fun handleBreakpointHitEvent(liveEvent: LiveInstrumentEvent) { - val bpHit = Json.decodeValue(liveEvent.data, LiveBreakpointHit::class.java) + val bpHit = ProtocolMarshaller.deserializeLiveBreakpointHit(JsonObject(liveEvent.data)) ApplicationManager.getApplication().invokeLater { val project = ProjectManager.getInstance().openProjects[0] BreakpointHitWindowService.getInstance(project).addBreakpointHit(bpHit) From 145e509f10ee809e9deab93616db90a4bcf567cf Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 27 Feb 2022 12:33:50 +0100 Subject: [PATCH 052/115] require input --- .../java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java | 2 +- .../java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index 1e3351963..fdb974927 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -238,7 +238,7 @@ public void keyPressed(KeyEvent e) { public void keyTyped(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dispose(); - } else if (e.getKeyChar() == KeyEvent.VK_ENTER) { + } else if (e.getKeyChar() == KeyEvent.VK_ENTER && meterNameField.getText().length() > 0) { meterTypeComboBox.requestFocus(); } } diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index e70246797..24c6a16be 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -225,7 +225,7 @@ public void keyPressed(KeyEvent e) { public void keyTyped(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dispose(); - } else if (e.getKeyChar() == KeyEvent.VK_ENTER) { + } else if (e.getKeyChar() == KeyEvent.VK_ENTER && spanOperationNameField.getText().length() > 0) { ApplicationManager.getApplication().runWriteAction(() -> saveLiveSpan()); } } From 878f69ef16d5fd419340d59d35405fc352d0c5e9 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 27 Feb 2022 12:34:06 +0100 Subject: [PATCH 053/115] skip if no pattern --- .../sourcemarker/status/util/AutocompleteField.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt index cf7acb666..90549da02 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt @@ -69,10 +69,12 @@ class AutocompleteField( var includeCurlyPattern: Boolean = false val matchAndApplyStyle = { m: Matcher -> - while (m.find()) { - val variable: String = m.group(1) - val varIndex = m.start() - styledDocument.setCharacterAttributes(varIndex, variable.length, getStyle("numbers"), true) + if (varPattern.pattern().isNotEmpty()) { + while (m.find()) { + val variable: String = m.group(1) + val varIndex = m.start() + styledDocument.setCharacterAttributes(varIndex, variable.length, getStyle("numbers"), true) + } } } From 0ba093ac8aabc8605d9cf55f157bc7a751780a9f Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 27 Feb 2022 12:36:04 +0100 Subject: [PATCH 054/115] bump --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index a723a9a54..f3f7d362c 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") + implementation("com.github.sourceplusplus.protocol:protocol:473051b4e5") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index e308f9aa9..a55dc3b0e 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") + compileOnly("com.github.sourceplusplus.protocol:protocol:473051b4e5") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index ce6f94c6d..5373d0151 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") + compileOnly("com.github.sourceplusplus.protocol:protocol:473051b4e5") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index a21bfac40..f7a8a588f 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") + compileOnly("com.github.sourceplusplus.protocol:protocol:473051b4e5") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index a73c656fb..50c85c418 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") + implementation("com.github.sourceplusplus.protocol:protocol:473051b4e5") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 68263ac97..1506c850e 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -65,7 +65,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:$projectVersion") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") + implementation("com.github.sourceplusplus.protocol:protocol:473051b4e5") } implementation("org.jooq:joor:$joorVersion") From b77f5a3b732bf52918bb030961ffbbc37f6643e7 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 27 Feb 2022 16:35:03 +0100 Subject: [PATCH 055/115] clean --- .../discover/TCPServiceDiscoveryBackend.kt | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 736abc47e..ddc5a709b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -166,21 +166,10 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { } } - override fun store(record: Record, resultHandler: Handler>) { - TODO("Not yet implemented") - } - - override fun remove(record: Record, resultHandler: Handler>) { - TODO("Not yet implemented") - } - - override fun remove(uuid: String, resultHandler: Handler>) { - TODO("Not yet implemented") - } - - override fun update(record: Record, resultHandler: Handler>) { - TODO("Not yet implemented") - } + override fun store(record: Record, resultHandler: Handler>) = Unit + override fun remove(record: Record, resultHandler: Handler>) = Unit + override fun remove(uuid: String, resultHandler: Handler>) = Unit + override fun update(record: Record, resultHandler: Handler>) = Unit override fun getRecords(resultHandler: Handler>>) { if (setupFuture.isComplete) { @@ -212,9 +201,6 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { } } - override fun getRecord(uuid: String, resultHandler: Handler>) { - TODO("Not yet implemented") - } - + override fun getRecord(uuid: String, resultHandler: Handler>) = Unit override fun name() = "tcp-service-discovery" } From a346a73e8a80a63b7b484a463757245b5edcffb5 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 28 Feb 2022 12:54:18 +0100 Subject: [PATCH 056/115] Watch log command (#673) * watch log * unused * refactor * refactor * moved portal only code to portal * protocol update * clean * watch log command * bump * refactor * format * remove subscription on mark remove --- mapper/build.gradle.kts | 2 +- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- .../source/mark/api/ExpressionSourceMark.kt | 12 +++ monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- .../sourcemarker/status/LogStatusBar.java | 63 ++++++++++++--- .../command/ControlBarController.kt | 33 +++++++- .../command/LiveControlCommand.kt | 6 ++ .../discover/TCPServiceDiscoveryBackend.kt | 24 ++---- .../sourcemarker/search/SourceMarkSearch.kt | 30 ++----- .../service/LiveInstrumentManager.kt | 29 ++----- .../sourcemarker/service/LiveViewManager.kt | 33 +++++--- .../service/LogCountIndicators.kt | 4 +- .../sourcemarker/status/LiveStatusManager.kt | 78 ++++++++++++++++--- .../main/resources/plugin-configuration.json | 1 - 17 files changed, 217 insertions(+), 108 deletions(-) diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts index f3f7d362c..cb2c10937 100644 --- a/mapper/build.gradle.kts +++ b/mapper/build.gradle.kts @@ -24,7 +24,7 @@ repositories { } dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:473051b4e5") + implementation("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") implementation("com.github.sh5i:git-stein:v0.5.0") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index a55dc3b0e..6ed34f049 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:473051b4e5") + compileOnly("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 5373d0151..4aaa44cad 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:473051b4e5") + compileOnly("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index f7a8a588f..005753418 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:473051b4e5") + compileOnly("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/ExpressionSourceMark.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/ExpressionSourceMark.kt index 0ccc6ef2c..53dd4a98e 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/ExpressionSourceMark.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/ExpressionSourceMark.kt @@ -21,6 +21,7 @@ import com.intellij.openapi.Disposable import com.intellij.openapi.editor.Editor import com.intellij.psi.PsiElement import com.intellij.psi.PsiInvalidElementAccessException +import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.SourceMarker.namingService import spp.jetbrains.marker.source.SourceFileMarker import spp.jetbrains.marker.source.mark.api.component.api.SourceMarkComponent @@ -31,6 +32,7 @@ import spp.jetbrains.marker.source.mark.api.key.SourceKey import spp.jetbrains.marker.source.mark.gutter.GutterMark import spp.jetbrains.marker.source.mark.inlay.InlayMark import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType import java.util.* /** @@ -96,6 +98,16 @@ abstract class ExpressionSourceMark( super.dispose(removeFromMarker, assertRemoval) } + fun getParentSourceMark(): SourceMark? { + return SourceMarker.getSourceMark( + artifactQualifiedName.copy( + identifier = artifactQualifiedName.identifier.substringBefore("#"), + type = ArtifactType.METHOD + ), + SourceMark.Type.GUTTER + ) + } + private val userData = HashMap() override fun getUserData(key: SourceKey): T? = userData[key] as T? override fun putUserData(key: SourceKey, value: T?) { diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 50c85c418..b81cb760d 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:473051b4e5") + implementation("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 1506c850e..deb6c620d 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -65,7 +65,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:$projectVersion") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:473051b4e5") + implementation("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") } implementation("org.jooq:joor:$joorVersion") diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index 579c4f5b1..c56bfa771 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -13,11 +13,13 @@ import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; import io.vertx.core.json.JsonObject; +import io.vertx.core.json.JsonObject; import net.miginfocom.swing.MigLayout; import org.jetbrains.annotations.NotNull; import spp.jetbrains.marker.source.mark.inlay.InlayMark; import spp.jetbrains.sourcemarker.PluginIcons; import spp.jetbrains.sourcemarker.PluginUI; +import spp.jetbrains.sourcemarker.SourceMarkerPlugin; import spp.jetbrains.sourcemarker.command.AutocompleteFieldRow; import spp.jetbrains.sourcemarker.mark.SourceMarkKeys; import spp.jetbrains.sourcemarker.service.InstrumentEventListener; @@ -26,11 +28,13 @@ import spp.jetbrains.sourcemarker.settings.LiveLogConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.artifact.log.Log; +import spp.protocol.artifact.log.LogResult; import spp.protocol.instrument.LiveInstrument; import spp.protocol.instrument.LiveLog; import spp.protocol.instrument.LiveSourceLocation; import spp.protocol.instrument.event.LiveInstrumentEvent; import spp.protocol.instrument.event.LiveInstrumentRemoved; +import spp.protocol.instrument.event.LiveLogHit; import spp.protocol.instrument.throttle.InstrumentThrottle; import spp.protocol.instrument.throttle.ThrottleStep; @@ -57,6 +61,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; +import static spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated; import static spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_HIT; @@ -76,6 +81,7 @@ public class LogStatusBar extends JPanel implements StatusBar, VisibleAreaListen private final List scopeVars; private final Function> lookup; private final String placeHolderText; + private final boolean watchExpression; private EditorImpl editor; private LiveLog liveLog; private Instant latestTime; @@ -97,7 +103,8 @@ public class LogStatusBar extends JPanel implements StatusBar, VisibleAreaListen new ArrayList<>(), 0, SortOrder.DESCENDING); private final Pattern varPattern; - public LogStatusBar(LiveSourceLocation sourceLocation, List scopeVars, InlayMark inlayMark) { + public LogStatusBar(LiveSourceLocation sourceLocation, List scopeVars, InlayMark inlayMark, + boolean watchExpression) { this.sourceLocation = sourceLocation; this.scopeVars = scopeVars.stream().map(it -> new AutocompleteFieldRow() { public String getText() { @@ -133,16 +140,49 @@ public Icon getIcon() { varPattern = VariableParser.createPattern(scopeVars, "$", true, false); this.inlayMark = inlayMark; + this.watchExpression = watchExpression; - placeHolderText = "Input log message (use $ for variables)"; + if (watchExpression) { + placeHolderText = WAITING_FOR_LIVE_LOG_DATA; + } else { + placeHolderText = "Input log message (use $ for variables)"; + } initComponents(); setupComponents(); - showEditableMode(); - liveLogTextField.setEditMode(true); + if (watchExpression) { + liveLogTextField.setCanShowSaveButton(false); + liveLogTextField.setEditMode(false); + removeActiveDecorations(); + configDropdownLabel.setVisible(false); + displayTimeField(); + addExpandButton(); - liveLogTextField.addSaveListener(this::saveLiveLog); + SourceMarkerPlugin.INSTANCE.getVertx().eventBus().consumer(ArtifactLogUpdated, event -> { + LogResult logResult = (LogResult) event.body(); + if (!inlayMark.getArtifactQualifiedName().equals(logResult.getArtifactQualifiedName())) { + return; + } + Log latestLog = logResult.getLogs().get(0); + setLatestLog(Instant.now(), latestLog); + + JsonObject logJson = JsonObject.mapFrom(new LiveLogHit( //todo: real hit info + "-1", latestLog.getTimestamp(), "null", "null", logResult + )); + logJson.getJsonObject("logResult").getJsonArray("logs").forEach(it -> { + JsonObject log = (JsonObject) it; + log.remove("formattedMessage"); + }); + + LiveInstrumentEvent liveInstrumentEvent = new LiveInstrumentEvent(LOG_HIT, logJson.toString()); + commandModel.insertRow(0, liveInstrumentEvent); + }); + } else { + showEditableMode(); + liveLogTextField.setEditMode(true); + liveLogTextField.addSaveListener(this::saveLiveLog); + } } public void setLiveInstrument(LiveInstrument liveInstrument) { @@ -164,14 +204,14 @@ public void setWrapperPanel(JPanel wrapperPanel) { @Override public void visibleAreaChanged(@NotNull VisibleAreaEvent e) { liveLogTextField.hideAutocompletePopup(); - if(popup != null) { + if (popup != null) { popup.dispose(); popup = null; } } public void setLatestLog(Instant time, Log latestLog) { - if (liveLog == null) return; + if (liveLog == null && !watchExpression) return; this.latestTime = time; this.latestLog = latestLog; @@ -373,7 +413,7 @@ public void keyTyped(KeyEvent e) { liveLogTextField.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { - if (errored || liveLogTextField.getEditMode()) return; + if (watchExpression || errored || liveLogTextField.getEditMode()) return; liveLogTextField.setEditMode(true); if (liveLog != null) { @@ -405,7 +445,7 @@ public void mouseClicked(MouseEvent e) { @Override public void mouseEntered(MouseEvent mouseEvent) { - if (!errored && !removed) showEditableMode(); + if (!watchExpression && !errored && !removed) showEditableMode(); } @Override @@ -454,7 +494,7 @@ public void mouseReleased(MouseEvent e) { configPanel.addMouseMotionListener(new MouseAdapter() { @Override public void mouseMoved(MouseEvent e) { - if (!errored && !removed) configPanel.setBackground(CNFG_PANEL_FOCUS_COLOR); + if (!watchExpression && !errored && !removed) configPanel.setBackground(CNFG_PANEL_FOCUS_COLOR); } }); @@ -462,7 +502,8 @@ public void mouseMoved(MouseEvent e) { addRecursiveMouseListener(configPanel, new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - if (!errored && !removed && System.currentTimeMillis() - popupLastOpened.get() > 200) { + if (!watchExpression && !errored && !removed + && System.currentTimeMillis() - popupLastOpened.get() > 200) { ApplicationManager.getApplication().runWriteAction(() -> showConfigurationPopup(popupLastOpened)); } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt index 6ca38a637..8185036eb 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt @@ -32,6 +32,7 @@ import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.component.swing.SwingSourceMarkComponentProvider import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode +import spp.jetbrains.marker.source.mark.inlay.ExpressionInlayMark import spp.jetbrains.marker.source.mark.inlay.InlayMark import spp.jetbrains.sourcemarker.ControlBar import spp.jetbrains.sourcemarker.SourceMarkerPlugin @@ -66,12 +67,40 @@ object ControlBarController { } } + private fun determineAvailableCommands(inlayMark: ExpressionInlayMark): List { + val availableCommandsAtLocation = availableCommands.toMutableList() + val parentMark = inlayMark.getParentSourceMark() + if (parentMark is MethodSourceMark) { + val loggerDetector = parentMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR) + if (loggerDetector != null) { + runBlocking { + val detectedLogs = loggerDetector.getOrFindLoggerStatements(parentMark) + val logOnCurrentLine = detectedLogs.find { it.lineLocation == inlayMark.lineNumber } + if (logOnCurrentLine != null) { + availableCommandsAtLocation.add(WATCH_LOG) + } + } + } + } + return availableCommandsAtLocation + } + fun handleCommandInput(input: String, editor: Editor) { log.info("Processing command input: {}", input) when (input) { VIEW_ACTIVITY.command -> handleViewPortalCommand(editor, VIEW_ACTIVITY) VIEW_TRACES.command -> handleViewPortalCommand(editor, VIEW_TRACES) VIEW_LOGS.command -> handleViewPortalCommand(editor, VIEW_LOGS) + WATCH_LOG.command -> { + //replace command inlay with log status inlay + val prevCommandBar = previousControlBar!! + previousControlBar!!.dispose() + previousControlBar = null + + ApplicationManager.getApplication().runWriteAction { + LiveStatusManager.showLogStatusBar(editor, prevCommandBar.lineNumber, true) + } + } ADD_LIVE_BREAKPOINT.command -> { //replace command inlay with breakpoint status inlay val prevCommandBar = previousControlBar!! @@ -89,7 +118,7 @@ object ControlBarController { previousControlBar = null ApplicationManager.getApplication().runWriteAction { - LiveStatusManager.showLogStatusBar(editor, prevCommandBar.lineNumber) + LiveStatusManager.showLogStatusBar(editor, prevCommandBar.lineNumber, false) } } ADD_LIVE_METER.command -> { @@ -253,7 +282,7 @@ object ControlBarController { val wrapperPanel = JPanel() wrapperPanel.layout = BorderLayout() - val controlBar = ControlBar(editor, inlayMark, availableCommands) + val controlBar = ControlBar(editor, inlayMark, determineAvailableCommands(inlayMark)) wrapperPanel.add(controlBar) editor.scrollingModel.addVisibleAreaListener(controlBar) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt index e24fc939b..94f34358b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt @@ -52,6 +52,12 @@ enum class LiveControlCommand( PluginIcons.Command.viewLogsSelected, PluginIcons.Command.viewLogsUnSelected ), + WATCH_LOG( + "Watch Log", + "Live View ➛ Log ➛ Scope: Expression", + PluginIcons.Command.viewLogsSelected, + PluginIcons.Command.viewLogsUnSelected + ), WATCH_VARIABLE( "watch", "Manual Tracing ➛ Watched Variables ➛ Scope: Local / Add *variable* to watched variables" diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 736abc47e..ddc5a709b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -166,21 +166,10 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { } } - override fun store(record: Record, resultHandler: Handler>) { - TODO("Not yet implemented") - } - - override fun remove(record: Record, resultHandler: Handler>) { - TODO("Not yet implemented") - } - - override fun remove(uuid: String, resultHandler: Handler>) { - TODO("Not yet implemented") - } - - override fun update(record: Record, resultHandler: Handler>) { - TODO("Not yet implemented") - } + override fun store(record: Record, resultHandler: Handler>) = Unit + override fun remove(record: Record, resultHandler: Handler>) = Unit + override fun remove(uuid: String, resultHandler: Handler>) = Unit + override fun update(record: Record, resultHandler: Handler>) = Unit override fun getRecords(resultHandler: Handler>>) { if (setupFuture.isComplete) { @@ -212,9 +201,6 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { } } - override fun getRecord(uuid: String, resultHandler: Handler>) { - TODO("Not yet implemented") - } - + override fun getRecord(uuid: String, resultHandler: Handler>) = Unit override fun name() = "tcp-service-discovery" } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt index ca5f36334..48f94aab8 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt @@ -40,27 +40,6 @@ object SourceMarkSearch { } } - fun findByMeterId(meterId: String): SourceMark? { - return SourceMarker.getSourceMarks() - .firstOrNull { - it.getUserData(SourceMarkKeys.METER_ID) == meterId - } - } - - fun findByLogId(logId: String): SourceMark? { - return SourceMarker.getSourceMarks() - .firstOrNull { - it.getUserData(SourceMarkKeys.LOG_ID) == logId - } - } - - fun findByBreakpointId(breakpointId: String): SourceMark? { - return SourceMarker.getSourceMarks() - .firstOrNull { - it.getUserData(SourceMarkKeys.BREAKPOINT_ID) == breakpointId - } - } - fun findByInstrumentId(instrumentId: String): SourceMark? { return SourceMarker.getSourceMarks() .firstOrNull { @@ -73,7 +52,8 @@ object SourceMarkSearch { suspend fun findSourceMark(artifact: ArtifactQualifiedName): SourceMark? { return when (artifact.type) { ArtifactType.ENDPOINT -> findEndpointSourceMark(artifact) - ArtifactType.STATEMENT -> findExpressionAdvice(artifact) + ArtifactType.STATEMENT -> findExpressionSourceMark(artifact) + ArtifactType.EXPRESSION -> findExpressionSourceMark(artifact) else -> TODO("impl") } } @@ -120,7 +100,11 @@ object SourceMarkSearch { } } - private fun findExpressionAdvice(artifact: ArtifactQualifiedName): ExpressionSourceMark? { + private fun findExpressionSourceMark(artifact: ArtifactQualifiedName): ExpressionSourceMark? { + if (artifact.type == ArtifactType.EXPRESSION) { + return SourceMarker.getSourceMarks().find { it.artifactQualifiedName == artifact } as ExpressionSourceMark? + } + val qualifiedClassName = artifact.identifier.substring(0, artifact.identifier.lastIndexOf(".")) val fileMarker = SourceMarker.getSourceFileMarker(qualifiedClassName) return if (fileMarker != null) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index f4903f7f9..944a9d0e5 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -37,7 +37,6 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated -import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide.toLiveInstrumentSubscriberAddress import spp.protocol.instrument.LiveBreakpoint @@ -46,6 +45,7 @@ import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType import spp.protocol.instrument.event.LiveLogHit import spp.protocol.marshall.ProtocolMarshaller +import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved /** * todo: description. @@ -79,9 +79,9 @@ class LiveInstrumentManager( LiveInstrumentEventType.LOG_HIT -> handleLogHitEvent(liveEvent) LiveInstrumentEventType.BREAKPOINT_HIT -> handleBreakpointHitEvent(liveEvent) LiveInstrumentEventType.BREAKPOINT_ADDED -> handleBreakpointAddedEvent(liveEvent) - LiveInstrumentEventType.BREAKPOINT_REMOVED -> handleBreakpointRemovedEvent(liveEvent) + LiveInstrumentEventType.BREAKPOINT_REMOVED -> handleInstrumentRemovedEvent(liveEvent) LiveInstrumentEventType.LOG_ADDED -> handleLogAddedEvent(liveEvent) - LiveInstrumentEventType.LOG_REMOVED -> handleLogRemovedEvent(liveEvent) + LiveInstrumentEventType.LOG_REMOVED -> handleInstrumentRemovedEvent(liveEvent) else -> log.warn("Un-implemented event type: {}", liveEvent.eventType) } } @@ -105,19 +105,6 @@ class LiveInstrumentManager( } } - private fun handleLogRemovedEvent(liveEvent: LiveInstrumentEvent) { - val logRemoved = deserializeLiveInstrumentRemoved(JsonObject(liveEvent.data)) - ApplicationManager.getApplication().invokeLater { - val inlayMark = SourceMarkSearch.findByLogId(logRemoved.liveInstrument.id!!) - if (inlayMark != null) { - val eventListeners = inlayMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) - if (eventListeners?.isNotEmpty() == true) { - eventListeners.forEach { it.accept(liveEvent) } - } - } - } - } - private fun handleLogAddedEvent(liveEvent: LiveInstrumentEvent) { if (!SourceMarker.enabled) { log.debug("SourceMarker disabled. Ignored log added") @@ -151,10 +138,10 @@ class LiveInstrumentManager( } } - private fun handleBreakpointRemovedEvent(liveEvent: LiveInstrumentEvent) { - val bpRemoved = deserializeLiveInstrumentRemoved(JsonObject(liveEvent.data)) + private fun handleInstrumentRemovedEvent(liveEvent: LiveInstrumentEvent) { + val instrumentRemoved = deserializeLiveInstrumentRemoved(JsonObject(liveEvent.data)) ApplicationManager.getApplication().invokeLater { - val inlayMark = SourceMarkSearch.findByBreakpointId(bpRemoved.liveInstrument.id!!) + val inlayMark = SourceMarkSearch.findByInstrumentId(instrumentRemoved.liveInstrument.id!!) if (inlayMark != null) { val eventListeners = inlayMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) if (eventListeners?.isNotEmpty() == true) { @@ -170,7 +157,7 @@ class LiveInstrumentManager( val project = ProjectManager.getInstance().openProjects[0] BreakpointHitWindowService.getInstance(project).addBreakpointHit(bpHit) - val inlayMark = SourceMarkSearch.findByBreakpointId(bpHit.breakpointId) + val inlayMark = SourceMarkSearch.findByInstrumentId(bpHit.breakpointId) if (inlayMark != null) { val eventListeners = inlayMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) if (eventListeners?.isNotEmpty() == true) { @@ -189,7 +176,7 @@ class LiveInstrumentManager( //todo: can get log hit without log added (race) try open val logHit = Json.decodeValue(liveEvent.data, LiveLogHit::class.java) ApplicationManager.getApplication().invokeLater { - val inlayMark = SourceMarkSearch.findByLogId(logHit.logId) + val inlayMark = SourceMarkSearch.findByInstrumentId(logHit.logId) if (inlayMark != null) { val eventListeners = inlayMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) if (eventListeners?.isNotEmpty() == true) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index 099464c68..ab347a4fb 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -29,6 +29,7 @@ import kotlinx.coroutines.launch import kotlinx.datetime.toJavaInstant import kotlinx.datetime.toKotlinInstant import org.slf4j.LoggerFactory +import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.portal.SourcePortal import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend @@ -40,6 +41,7 @@ import spp.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated import spp.protocol.ProtocolAddress.Global.ArtifactTracesUpdated import spp.protocol.ProtocolAddress.Global.TraceSpanUpdated import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress +import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.QueryTimeFrame import spp.protocol.artifact.log.Log import spp.protocol.artifact.log.LogOrderType @@ -80,6 +82,10 @@ class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineV vertx.eventBus().consumer(toLiveViewSubscriberAddress(developer)) { val event = Json.decodeValue(it.body().toString(), LiveViewEvent::class.java) if (log.isTraceEnabled) log.trace("Received live event: {}", event) + if (!SourceMarker.enabled) { + log.warn("SourceMarker is not enabled, ignoring live event: {}", event) + return@consumer + } when (event.viewConfig.viewName) { "LIVE_METER" -> launch(vertx.dispatcher()) { consumeLiveMeterEvent(event) } @@ -116,7 +122,7 @@ class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineV val meterTypeStr = event.entityId.substringAfter("spp_").substringBefore("_").toUpperCase() val meterType = MeterType.valueOf(meterTypeStr) val meterId = event.entityId.substringAfter(meterType.name.toLowerCase() + "_").replace("_", "-") - val meterMark = SourceMarkSearch.findByMeterId(meterId) + val meterMark = SourceMarkSearch.findByInstrumentId(meterId) if (meterMark == null) { log.info("Could not find source mark for: " + event.entityId) return @@ -140,16 +146,23 @@ class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineV Int.MAX_VALUE ) - for ((content, logs) in logsResult.logs.groupBy { it.content }) { - SourceMarkSearch.findInheritedSourceMarks(content).forEach { - vertx.eventBus().send( - ProtocolAddress.Global.ArtifactLogUpdated, - logsResult.copy( - artifactQualifiedName = it.artifactQualifiedName, - total = logs.size, - logs = logs, + if (event.artifactQualifiedName.type == ArtifactType.EXPRESSION) { + val expressionMark = SourceMarkSearch.findSourceMark(event.artifactQualifiedName) + if (expressionMark != null) { + vertx.eventBus().send(ProtocolAddress.Global.ArtifactLogUpdated, logsResult) + } + } else { + for ((content, logs) in logsResult.logs.groupBy { it.content }) { + SourceMarkSearch.findInheritedSourceMarks(content).forEach { + vertx.eventBus().send( + ProtocolAddress.Global.ArtifactLogUpdated, + logsResult.copy( + artifactQualifiedName = it.artifactQualifiedName, + total = logs.size, + logs = logs, + ) ) - ) + } } } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt index 155040e3a..35a68ce2d 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt @@ -63,7 +63,7 @@ class LogCountIndicators : CoroutineVerticle() { val fileLogPatterns = fileMarker.getSourceMarks().filterIsInstance().flatMap { it.getUserData(LOGGER_DETECTOR)!!.getOrFindLoggerStatements(it) } - Instance.logCountIndicator!!.getPatternOccurrences( + val occurrences = Instance.logCountIndicator!!.getPatternOccurrences( fileLogPatterns.map { it.logPattern }, config.serviceName, Clock.System.now().minus(15, DateTimeUnit.MINUTE), @@ -103,8 +103,6 @@ class LogCountIndicators : CoroutineVerticle() { } } } - } else { - log.error("Failed to get log pattern occurrences", it.cause()) } } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index 14aade941..b581c9441 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -23,6 +23,7 @@ import com.intellij.openapi.editor.Editor import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.psi.PsiDocumentManager import io.vertx.core.json.Json +import kotlinx.coroutines.runBlocking import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker.creationService import spp.jetbrains.marker.SourceMarker.namingService @@ -161,7 +162,7 @@ object LiveStatusManager : SourceMarkEventListener { /** * Invoked via control bar. Force visible. */ - fun showLogStatusBar(editor: Editor, lineNumber: Int) { + fun showLogStatusBar(editor: Editor, lineNumber: Int, watchExpression: Boolean) { val fileMarker = PsiDocumentManager.getInstance(editor.project!!).getPsiFile(editor.document)!! .getUserData(SourceFileMarker.KEY) if (fileMarker == null) { @@ -174,17 +175,69 @@ object LiveStatusManager : SourceMarkEventListener { val wrapperPanel = JPanel() wrapperPanel.layout = BorderLayout() + if (watchExpression) { + val logPatterns = mutableListOf() + val parentMark = inlayMark.getParentSourceMark() + if (parentMark is MethodSourceMark) { + val loggerDetector = parentMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR) + if (loggerDetector != null) { + runBlocking { + val detectedLogs = loggerDetector.getOrFindLoggerStatements(parentMark) + val logOnCurrentLine = detectedLogs.find { it.lineLocation == inlayMark.lineNumber } + if (logOnCurrentLine != null) { + logPatterns.add(logOnCurrentLine.logPattern) + } + } + } + } + + SourceServices.Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + logPatterns, + ArtifactQualifiedName( + inlayMark.artifactQualifiedName.identifier, + lineNumber = inlayMark.artifactQualifiedName.lineNumber, + type = ArtifactType.EXPRESSION + ), + LiveSourceLocation( + inlayMark.artifactQualifiedName.identifier, + line = inlayMark.artifactQualifiedName.lineNumber!! + ), + LiveViewConfig("LOGS", listOf("endpoint_logs")) + ) + ).onComplete { + if (it.succeeded()) { + inlayMark.addEventListener { event -> + if (event.eventCode == SourceMarkEventCode.MARK_REMOVED) { + SourceServices.Instance.liveView!!.removeLiveViewSubscription( + it.result().subscriptionId!! + ).onComplete { + if (it.failed()) { + log.error("Failed to remove subscription: {}", it.cause()) + } + } + } + } + } else { + log.error("Failed to add live view subscription", it.cause()) + } + } + } + val config = Json.decodeValue( PropertiesComponent.getInstance(editor.project!!).getValue("sourcemarker_plugin_config"), SourceMarkerConfig::class.java ) val statusBar = LogStatusBar( LiveSourceLocation( - namingService.getClassQualifiedNames(fileMarker.psiFile)[0].identifier, lineNumber, + namingService.getClassQualifiedNames(fileMarker.psiFile)[0].identifier, + lineNumber, service = config.serviceName ), - scopeService.getScopeVariables(fileMarker, lineNumber), - inlayMark + if (watchExpression) emptyList() else scopeService.getScopeVariables(fileMarker, lineNumber), + inlayMark, + watchExpression ) inlayMark.putUserData(SourceMarkKeys.STATUS_BAR, statusBar) statusBar.setWrapperPanel(wrapperPanel) @@ -203,14 +256,14 @@ object LiveStatusManager : SourceMarkEventListener { sourcePortal.configuration.currentPage = PageType.LOGS sourcePortal.configuration.statusBar = true - SourceMarkerPlugin.vertx.eventBus().consumer(DisplayLogs(sourcePortal.portalUuid)) { - val latestLog = it.body().logs.first() - statusBar.setLatestLog( - Instant.ofEpochMilli(latestLog.timestamp.toEpochMilliseconds()), latestLog - ) - } + if (!watchExpression) { + SourceMarkerPlugin.vertx.eventBus().consumer(DisplayLogs(sourcePortal.portalUuid)) { + val latestLog = it.body().logs.first() + statusBar.setLatestLog(Instant.ofEpochMilli(latestLog.timestamp.toEpochMilliseconds()), latestLog) + } - statusBar.focus() + statusBar.focus() + } } } @@ -359,7 +412,8 @@ object LiveStatusManager : SourceMarkEventListener { val statusBar = LogStatusBar( liveLog.location, emptyList(), - inlayMark + inlayMark, + false ) inlayMark.putUserData(SourceMarkKeys.STATUS_BAR, statusBar) statusBar.setWrapperPanel(wrapperPanel) diff --git a/plugin/src/main/resources/plugin-configuration.json b/plugin/src/main/resources/plugin-configuration.json index 6bf445836..b736dabda 100644 --- a/plugin/src/main/resources/plugin-configuration.json +++ b/plugin/src/main/resources/plugin-configuration.json @@ -6,7 +6,6 @@ "service_port": 5445, "tcp_service_port": 5455, "services": { - "local_tracing": false, "log_count_indicator": false, "live_instrument": true, "live_view": true From b01c7aff89ab0a6f7ceca6d30ab112212534a5ba Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 28 Feb 2022 21:13:29 +0100 Subject: [PATCH 057/115] move package --- .../sourcemarker/status/LogStatusBar.java | 2 +- .../sourcemarker/SourceMarkerPlugin.kt | 2 +- .../command/ControlBarController.kt | 4 +- .../PluginSourceMarkEventListener.kt | 4 +- .../listeners/PortalEventListener.kt | 52 +++++++++---------- .../service/LiveInstrumentManager.kt | 2 +- .../sourcemarker/service/LiveViewManager.kt | 8 +-- .../sourcemarker/status/LiveStatusManager.kt | 4 +- .../jetbrains/StandaloneActivityLiveView.kt | 4 +- .../spp/jetbrains/StandaloneLogsLiveView.kt | 6 +-- .../spp/jetbrains/StandaloneTracesLiveView.kt | 6 +-- .../portal/display/views/ActivityViewTest.kt | 2 +- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index c56bfa771..400054036 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -61,7 +61,7 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated; +import static spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactLogUpdated; import static spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_HIT; diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index f1368290c..2d2ae18ef 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -99,7 +99,7 @@ import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.SourceServices import spp.protocol.SourceServices.Instance import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.endpoint.EndpointResult +import spp.jetbrains.portal.protocol.artifact.endpoint.EndpointResult import spp.protocol.artifact.exception.LiveStackTraceElement import spp.protocol.artifact.log.LogResult import spp.protocol.artifact.metrics.ArtifactMetricResult diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt index 8185036eb..67fe07199 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt @@ -39,10 +39,10 @@ import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.command.LiveControlCommand.* import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.status.LiveStatusManager -import spp.protocol.ProtocolAddress.Global.SetCurrentPage +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.SetCurrentPage import spp.protocol.SourceServices import spp.protocol.instrument.LiveInstrumentType.* -import spp.protocol.portal.PageType +import spp.jetbrains.portal.protocol.portal.PageType import java.awt.BorderLayout import javax.swing.JComponent import javax.swing.JPanel diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt index daf71cbb9..5114217e2 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt @@ -33,9 +33,9 @@ import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.LOGGER_DETECTOR -import spp.protocol.ProtocolAddress.Global.OpenPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.OpenPortal import spp.protocol.artifact.ArtifactType -import spp.protocol.portal.PageType +import spp.jetbrains.portal.protocol.portal.PageType /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt index 842aad59d..11bf9c651 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt @@ -57,41 +57,41 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR import spp.jetbrains.sourcemarker.search.SourceMarkSearch import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated -import spp.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated -import spp.protocol.ProtocolAddress.Global.ArtifactTracesUpdated -import spp.protocol.ProtocolAddress.Global.CanNavigateToArtifact -import spp.protocol.ProtocolAddress.Global.ClickedStackTraceElement -import spp.protocol.ProtocolAddress.Global.ClosePortal -import spp.protocol.ProtocolAddress.Global.FindAndOpenPortal -import spp.protocol.ProtocolAddress.Global.FindPortal -import spp.protocol.ProtocolAddress.Global.GetPortalConfiguration -import spp.protocol.ProtocolAddress.Global.GetPortalTranslations -import spp.protocol.ProtocolAddress.Global.NavigateToArtifact -import spp.protocol.ProtocolAddress.Global.OpenPortal -import spp.protocol.ProtocolAddress.Global.QueryTraceStack -import spp.protocol.ProtocolAddress.Global.RefreshActivity -import spp.protocol.ProtocolAddress.Global.RefreshLogs -import spp.protocol.ProtocolAddress.Global.RefreshOverview -import spp.protocol.ProtocolAddress.Global.RefreshPortal -import spp.protocol.ProtocolAddress.Global.RefreshTraces -import spp.protocol.ProtocolAddress.Global.SetCurrentPage -import spp.protocol.ProtocolAddress.Global.TraceSpanUpdated -import spp.protocol.ProtocolAddress.Portal.UpdateEndpoints +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactLogUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactTracesUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.CanNavigateToArtifact +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ClickedStackTraceElement +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ClosePortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.FindAndOpenPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.FindPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.GetPortalConfiguration +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.GetPortalTranslations +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.NavigateToArtifact +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.OpenPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.QueryTraceStack +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshActivity +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshLogs +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshOverview +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshTraces +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.SetCurrentPage +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.TraceSpanUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Portal.UpdateEndpoints import spp.protocol.SourceServices.Instance import spp.protocol.artifact.ArtifactNameUtils import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType -import spp.protocol.artifact.endpoint.EndpointResult -import spp.protocol.artifact.endpoint.EndpointType +import spp.jetbrains.portal.protocol.artifact.endpoint.EndpointResult +import spp.jetbrains.portal.protocol.artifact.endpoint.EndpointType import spp.protocol.artifact.exception.LiveStackTraceElement -import spp.protocol.artifact.metrics.ArtifactSummarizedMetrics -import spp.protocol.artifact.metrics.ArtifactSummarizedResult +import spp.jetbrains.portal.protocol.artifact.metrics.ArtifactSummarizedMetrics +import spp.jetbrains.portal.protocol.artifact.metrics.ArtifactSummarizedResult import spp.protocol.artifact.metrics.MetricType import spp.protocol.artifact.trace.TraceResult import spp.protocol.artifact.trace.TraceSpan import spp.protocol.instrument.LiveSourceLocation -import spp.protocol.portal.PageType +import spp.jetbrains.portal.protocol.portal.PageType import spp.protocol.view.LiveViewConfig import spp.protocol.view.LiveViewSubscription import java.net.URI diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 944a9d0e5..de0dc2dcb 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -36,7 +36,7 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.status.LiveStatusManager -import spp.protocol.ProtocolAddress.Global.ArtifactLogUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactLogUpdated import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide.toLiveInstrumentSubscriberAddress import spp.protocol.instrument.LiveBreakpoint diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index ab347a4fb..25fbf3881 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -36,10 +36,10 @@ import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.search.SourceMarkSearch import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.protocol.ProtocolAddress -import spp.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated -import spp.protocol.ProtocolAddress.Global.ArtifactTracesUpdated -import spp.protocol.ProtocolAddress.Global.TraceSpanUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactTracesUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.TraceSpanUpdated import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.QueryTimeFrame diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index b581c9441..29138cb11 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -46,14 +46,14 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.LOG_ID import spp.jetbrains.sourcemarker.service.InstrumentEventListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.protocol.ProtocolAddress.Portal.DisplayLogs +import spp.jetbrains.portal.protocol.ProtocolAddress.Portal.DisplayLogs import spp.protocol.SourceServices import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.log.LogResult import spp.protocol.instrument.* import spp.protocol.instrument.meter.MeterType -import spp.protocol.portal.PageType +import spp.jetbrains.portal.protocol.portal.PageType import spp.protocol.view.LiveViewConfig import spp.protocol.view.LiveViewSubscription import java.awt.BorderLayout diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt index 013d1060d..adc5031a5 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt @@ -48,12 +48,12 @@ import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.protocol.ProtocolAddress.Global.RefreshActivity +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshActivity import spp.protocol.SourceServices import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType import spp.protocol.instrument.LiveSourceLocation -import spp.protocol.portal.PortalConfiguration +import spp.jetbrains.portal.protocol.portal.PortalConfiguration import spp.protocol.view.LiveViewConfig import spp.protocol.view.LiveViewSubscription import java.io.File diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt index ac6aee7af..6e15a43a3 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt @@ -44,11 +44,11 @@ import spp.jetbrains.portal.SourcePortal import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.protocol.ProtocolAddress.Global.RefreshLogs +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshLogs import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType -import spp.protocol.portal.PageType -import spp.protocol.portal.PortalConfiguration +import spp.jetbrains.portal.protocol.portal.PageType +import spp.jetbrains.portal.protocol.portal.PortalConfiguration import java.io.File class StandaloneLogsLiveView : LightJavaCodeInsightFixtureTestCase() { diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt index d8b5e07f9..470993207 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt @@ -44,11 +44,11 @@ import spp.jetbrains.portal.SourcePortal import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.protocol.ProtocolAddress.Global.RefreshTraces +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshTraces import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType -import spp.protocol.portal.PageType -import spp.protocol.portal.PortalConfiguration +import spp.jetbrains.portal.protocol.portal.PageType +import spp.jetbrains.portal.protocol.portal.PortalConfiguration import java.io.File class StandaloneTracesLiveView : LightJavaCodeInsightFixtureTestCase() { diff --git a/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt b/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt index b394b24af..b62c9a7c2 100644 --- a/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt +++ b/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt @@ -28,7 +28,7 @@ import spp.protocol.artifact.QueryTimeFrame import spp.protocol.artifact.metrics.ArtifactMetricResult import spp.protocol.artifact.metrics.ArtifactMetrics import spp.protocol.artifact.metrics.MetricType -import spp.protocol.portal.PortalConfiguration +import spp.jetbrains.portal.protocol.portal.PortalConfiguration import java.time.ZonedDateTime import java.time.temporal.ChronoUnit From 2c3976d75367d33ae01326750a47ad93e3ff8dfe Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 28 Feb 2022 21:44:23 +0100 Subject: [PATCH 058/115] move test --- .../portal/display/views/ActivityViewTest.kt | 376 ------------------ 1 file changed, 376 deletions(-) delete mode 100644 plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt diff --git a/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt b/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt deleted file mode 100644 index b62c9a7c2..000000000 --- a/plugin/src/test/kotlin/spp/jetbrains/portal/display/views/ActivityViewTest.kt +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.portal.display.views - -import kotlinx.datetime.toKotlinInstant -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertNotNull -import org.junit.jupiter.api.Test -import spp.jetbrains.portal.SourcePortal -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import spp.protocol.artifact.QueryTimeFrame -import spp.protocol.artifact.metrics.ArtifactMetricResult -import spp.protocol.artifact.metrics.ArtifactMetrics -import spp.protocol.artifact.metrics.MetricType -import spp.jetbrains.portal.protocol.portal.PortalConfiguration -import java.time.ZonedDateTime -import java.time.temporal.ChronoUnit - -class ActivityViewTest { - - @Test - fun startPush1Minute() { - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration(external = true) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - val now = ZonedDateTime.now().truncatedTo(ChronoUnit.MINUTES) - val endTime = now.plusSeconds(60).toInstant() - val startTime = now.toInstant() - val pushResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_MINUTE, - MetricType.Throughput_Average, - startTime.toKotlinInstant(), - endTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(1.0) - ) - ), - true - ) - portal.activityView.cacheMetricResult(pushResult) - - val metricResult = portal.activityView.metricResultCache - .get(portal.viewingArtifact)!!.get(QueryTimeFrame.LAST_MINUTE) - assertNotNull(metricResult) - assertEquals(1, metricResult!!.artifactMetrics.size) - assertEquals(listOf(1.0), metricResult.artifactMetrics.first().values) - assertEquals(startTime.toKotlinInstant(), metricResult.start) - assertEquals(endTime.toKotlinInstant(), metricResult.stop) - } - - @Test - fun startPush1MinuteUpdated() { - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration(external = true) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - val now = ZonedDateTime.now().truncatedTo(ChronoUnit.MINUTES) - val endTime = now.plusSeconds(60).toInstant() - val startTime = now.toInstant() - val pushResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_MINUTE, - MetricType.Throughput_Average, - startTime.toKotlinInstant(), - endTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(1.0) - ) - ), - true - ) - portal.activityView.cacheMetricResult(pushResult) - - val pushResult2 = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_MINUTE, - MetricType.Throughput_Average, - startTime.toKotlinInstant(), - endTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(2.0) - ) - ), - true - ) - portal.activityView.cacheMetricResult(pushResult2) - - val metricResult = portal.activityView.metricResultCache - .get(portal.viewingArtifact)!!.get(QueryTimeFrame.LAST_MINUTE) - assertNotNull(metricResult) - assertEquals(1, metricResult!!.artifactMetrics.size) - assertEquals(listOf(2.0), metricResult.artifactMetrics.first().values) - assertEquals(startTime.toKotlinInstant(), metricResult.start) - assertEquals(endTime.toKotlinInstant(), metricResult.stop) - } - - @Test - fun startPush1MinuteUpdatedAfter() { - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration(external = true) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - val now = ZonedDateTime.now().truncatedTo(ChronoUnit.MINUTES) - val endTime = now.plusSeconds(60).toInstant() - val startTime = now.toInstant() - val pushResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_MINUTE, - MetricType.Throughput_Average, - startTime.toKotlinInstant(), - endTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(1.0) - ) - ), - true - ) - portal.activityView.cacheMetricResult(pushResult) - - val pushResult2 = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_MINUTE, - MetricType.Throughput_Average, - startTime.plusSeconds(60).toKotlinInstant(), - endTime.plusSeconds(60).toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(2.0) - ) - ), - true - ) - portal.activityView.cacheMetricResult(pushResult2) - - val metricResult = portal.activityView.metricResultCache - .get(portal.viewingArtifact)!!.get(QueryTimeFrame.LAST_MINUTE) - assertNotNull(metricResult) - assertEquals(1, metricResult!!.artifactMetrics.size) - assertEquals(listOf(2.0), metricResult.artifactMetrics.first().values) - assertEquals(startTime.plusSeconds(60).toKotlinInstant(), metricResult.start) - assertEquals(endTime.plusSeconds(60).toKotlinInstant(), metricResult.stop) - } - - @Test - fun push1MinuteAfter() { - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration(external = true) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - val now = ZonedDateTime.now().truncatedTo(ChronoUnit.MINUTES) - val endTime = now.toInstant() - val startTime = now.minusMinutes(portal.activityView.timeFrame.minutes.toLong()).toInstant() - val originalResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_5_MINUTES, - MetricType.Throughput_Average, - startTime.toKotlinInstant(), - endTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(1.0, 2.0, 3.0, 4.0, 5.0) - ) - ) - ) - portal.activityView.cacheMetricResult(originalResult) - - val updatedStartTime = now.plusMinutes(1).toInstant() - val pushResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_MINUTE, - MetricType.Throughput_Average, - endTime.toKotlinInstant(), - updatedStartTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(6.0) - ) - ), - true - ) - portal.activityView.cacheMetricResult(pushResult) - - val metricResult = portal.activityView.metricResult - assertNotNull(metricResult) - assertEquals(1, metricResult!!.artifactMetrics.size) - assertEquals(listOf(2.0, 3.0, 4.0, 5.0, 6.0), metricResult.artifactMetrics.first().values) - assertEquals(startTime.plusSeconds(60).toKotlinInstant(), metricResult.start) - assertEquals(endTime.plusSeconds(60).toKotlinInstant(), metricResult.stop) - } - - @Test - fun push1MinuteDuring() { - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration(external = true) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - val now = ZonedDateTime.now().truncatedTo(ChronoUnit.MINUTES) - val endTime = now.toInstant() - val startTime = now.minusMinutes(portal.activityView.timeFrame.minutes.toLong()).toInstant() - val originalResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_5_MINUTES, - MetricType.Throughput_Average, - startTime.toKotlinInstant(), - endTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(1.0, 2.0, 3.0, 4.0, 5.0) - ) - ) - ) - portal.activityView.cacheMetricResult(originalResult) - - val updatedStartTime = startTime.plusSeconds(60) - val pushResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_MINUTE, - MetricType.Throughput_Average, - startTime.toKotlinInstant(), - updatedStartTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(6.0) - ) - ), - true - ) - portal.activityView.cacheMetricResult(pushResult) - - val metricResult = portal.activityView.metricResult - assertNotNull(metricResult) - assertEquals(1, metricResult!!.artifactMetrics.size) - assertEquals(listOf(6.0, 2.0, 3.0, 4.0, 5.0), metricResult.artifactMetrics.first().values) - assertEquals(startTime.toKotlinInstant(), metricResult.start) - assertEquals(endTime.toKotlinInstant(), metricResult.stop) - } - - @Test - fun push1MinuteBefore() { - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration(external = true) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - val now = ZonedDateTime.now().truncatedTo(ChronoUnit.MINUTES) - val endTime = now.toInstant() - val startTime = now.minusMinutes(portal.activityView.timeFrame.minutes.toLong()).toInstant() - val originalResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_5_MINUTES, - MetricType.Throughput_Average, - startTime.toKotlinInstant(), - endTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(1.0, 2.0, 3.0, 4.0, 5.0) - ) - ) - ) - portal.activityView.cacheMetricResult(originalResult) - - val updatedEndTime = startTime.minusSeconds(60) - val pushResult = ArtifactMetricResult( - portal.viewingArtifact, - QueryTimeFrame.LAST_MINUTE, - MetricType.Throughput_Average, - updatedEndTime.toKotlinInstant(), - startTime.toKotlinInstant(), - "MINUTE", - listOf( - ArtifactMetrics( - MetricType.Throughput_Average, - listOf(6.0) - ) - ), - true - ) - portal.activityView.cacheMetricResult(pushResult) - - val metricResult = portal.activityView.metricResult - assertNotNull(metricResult) - assertEquals(1, metricResult!!.artifactMetrics.size) - assertEquals(listOf(1.0, 2.0, 3.0, 4.0, 5.0), metricResult.artifactMetrics.first().values) - assertEquals(startTime.toKotlinInstant(), metricResult.start) - assertEquals(endTime.toKotlinInstant(), metricResult.stop) - } -} From 83cfbaab00cfb92aeba907b645237ba8f38f6295 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 28 Feb 2022 21:44:43 +0100 Subject: [PATCH 059/115] bump --- plugin/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index deb6c620d..ae1fc96e3 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -64,7 +64,7 @@ dependencies { implementation(project(":marker:jvm-marker")) implementation(project(":marker:py-marker")) implementation(project(":monitor")) - implementation("com.github.sourceplusplus.interface-portal:portal-jvm:$projectVersion") { isTransitive = false } + implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4cd858772b") { isTransitive = false } implementation("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") } From 8de76ad9aba9d87fc68732b165c98ce08cec7a6b Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Mar 2022 14:12:22 +0100 Subject: [PATCH 060/115] remove mapper --- mapper/build.gradle.kts | 40 -- .../spp/jetbrains/mapper/api/SourceMapper.kt | 41 -- .../mapper/api/SourceMapperConfig.kt | 18 - .../mapper/api/impl/SourceMapperImpl.kt | 63 -- .../mapper/extend/SourceCodeTokenizer.kt | 39 -- .../mapper/vcs/git/GitRepositoryMapper.kt | 118 ---- .../mapper/vcs/git/LogFollowCommand.kt | 150 ---- .../integration/GroovyModificationTest.kt | 638 ------------------ .../integration/JavaModificationTest.kt | 330 --------- .../integration/KotlinModificationTest.kt | 330 --------- plugin/build.gradle.kts | 2 - 11 files changed, 1769 deletions(-) delete mode 100644 mapper/build.gradle.kts delete mode 100644 mapper/src/main/kotlin/spp/jetbrains/mapper/api/SourceMapper.kt delete mode 100644 mapper/src/main/kotlin/spp/jetbrains/mapper/api/SourceMapperConfig.kt delete mode 100644 mapper/src/main/kotlin/spp/jetbrains/mapper/api/impl/SourceMapperImpl.kt delete mode 100644 mapper/src/main/kotlin/spp/jetbrains/mapper/extend/SourceCodeTokenizer.kt delete mode 100644 mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapper.kt delete mode 100644 mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/LogFollowCommand.kt delete mode 100644 mapper/src/test/kotlin/spp/jetbrains/mapper/integration/GroovyModificationTest.kt delete mode 100644 mapper/src/test/kotlin/spp/jetbrains/mapper/integration/JavaModificationTest.kt delete mode 100644 mapper/src/test/kotlin/spp/jetbrains/mapper/integration/KotlinModificationTest.kt diff --git a/mapper/build.gradle.kts b/mapper/build.gradle.kts deleted file mode 100644 index cb2c10937..000000000 --- a/mapper/build.gradle.kts +++ /dev/null @@ -1,40 +0,0 @@ -plugins { - id("org.jetbrains.kotlin.jvm") - id("maven-publish") -} - -val pluginGroup: String by project -val projectVersion: String by project -val slf4jVersion: String by project - -publishing { - publications { - create("maven") { - groupId = pluginGroup - artifactId = "mapper" - version = projectVersion - - from(components["java"]) - } - } -} - -repositories { - maven(url = "https://jitpack.io") { name = "jitpack" } -} - -dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") - implementation("com.github.sh5i:git-stein:v0.5.0") - implementation("org.apache.commons:commons-lang3:3.12.0") - implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r") - implementation("com.google.guava:guava:31.0.1-jre") - testImplementation("junit:junit:4.13.2") - testImplementation("org.slf4j:slf4j-log4j12:$slf4jVersion") -} - -tasks { - test { - maxParallelForks = Runtime.getRuntime().availableProcessors() / 2 - } -} diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/api/SourceMapper.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/api/SourceMapper.kt deleted file mode 100644 index d8d5f0afa..000000000 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/api/SourceMapper.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.api - -import spp.protocol.artifact.ArtifactQualifiedName -import java.util.* - -/** - * todo: description. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -interface SourceMapper { - - //fun getCurrentMethodQualifiedName(methodQualifiedName: String, commitId: String): String - - /** - * todo: description. - */ - fun getMethodQualifiedName( - methodQualifiedName: ArtifactQualifiedName, - targetCommitId: String, - returnBestEffort: Boolean = false - ): Optional -} diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/api/SourceMapperConfig.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/api/SourceMapperConfig.kt deleted file mode 100644 index eef4c362d..000000000 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/api/SourceMapperConfig.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.api diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/api/impl/SourceMapperImpl.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/api/impl/SourceMapperImpl.kt deleted file mode 100644 index edf50d779..000000000 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/api/impl/SourceMapperImpl.kt +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.api.impl - -import org.slf4j.LoggerFactory -import spp.jetbrains.mapper.api.SourceMapper -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper -import spp.jetbrains.mapper.vcs.git.LogFollowCommand -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.LocalArtifact -import java.util.* - -/** - * todo: description. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -class SourceMapperImpl(private val mapper: GitRepositoryMapper) : SourceMapper { - - companion object { - private val log = LoggerFactory.getLogger(SourceMapperImpl::class.java) - } - - override fun getMethodQualifiedName( - methodQualifiedName: ArtifactQualifiedName, - targetCommitId: String, - returnBestEffort: Boolean - ): Optional { - log.debug( - "Getting method qualified name: {} - Target commit id: {} - Best effort: {}", - methodQualifiedName, targetCommitId, returnBestEffort - ) - val methodRenames = LogFollowCommand( - mapper.targetRepo, LocalArtifact( - methodQualifiedName, mapper.cacheThing[methodQualifiedName.identifier]!! - ), targetCommitId - ).call() - log.info("Method renames: {}", methodRenames.joinToString()) - - val possibleName = methodRenames.lastOrNull() - return if (possibleName?.artifactQualifiedName?.commitId == targetCommitId || returnBestEffort) { - Optional.ofNullable(possibleName?.artifactQualifiedName) - } else { - Optional.ofNullable(null) - } - } -} diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/extend/SourceCodeTokenizer.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/extend/SourceCodeTokenizer.kt deleted file mode 100644 index 9886493d6..000000000 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/extend/SourceCodeTokenizer.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.extend - -import spp.protocol.artifact.ArtifactQualifiedName - -/** - * Used to tokenize source code. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -interface SourceCodeTokenizer { - - fun getMethods(filename: String, sourceCode: String): List - - /** - * Represents a method split by language tokens. - */ - data class TokenizedMethod( - val artifactQualifiedName: ArtifactQualifiedName, - val tokens: List - ) -} diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapper.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapper.kt deleted file mode 100644 index 550ad7483..000000000 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapper.kt +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.vcs.git - -import com.google.common.base.Preconditions -import jp.ac.titech.c.se.stein.PorcelainAPI -import jp.ac.titech.c.se.stein.core.Context -import jp.ac.titech.c.se.stein.core.EntrySet -import jp.ac.titech.c.se.stein.core.EntrySet.Entry -import jp.ac.titech.c.se.stein.core.EntrySet.EntryList -import jp.ac.titech.c.se.stein.core.RepositoryRewriter -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.internal.storage.file.FileRepository -import org.eclipse.jgit.lib.Repository -import org.slf4j.LoggerFactory -import spp.jetbrains.mapper.extend.SourceCodeTokenizer -import java.io.File -import java.nio.charset.StandardCharsets -import java.util.* -import java.util.regex.Pattern - -/** - * Based off FinerGit. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -class GitRepositoryMapper(private val sourceCodeTokenizer: SourceCodeTokenizer) : RepositoryRewriter() { - - companion object { - private val log = LoggerFactory.getLogger(GitRepositoryMapper::class.java) - private val supportedFileTypes = hashSetOf("java", "groovy", "kt") - val originalCommitIdPattern = Pattern.compile("")!! - } - - init { - isPathSensitive = true - } - - lateinit var sourceRepo: Repository - lateinit var targetRepo: Repository - lateinit var targetSourceDirectory: File - lateinit var targetGit: Git - val cacheThing = mutableMapOf() - - fun initialize(sourceRepo: Repository) { - val tempDir = File("/tmp/tmp-repo-${UUID.randomUUID()}/.git") - Preconditions.checkArgument(tempDir.mkdirs()) - val fileRepo = FileRepository(tempDir) - fileRepo.create() - - initialize(sourceRepo, fileRepo) - } - - fun reinitialize() { - super.initialize(sourceRepo, targetRepo) - rewrite(Context.init()) - PorcelainAPI(targetRepo).use { - it.resetHard() - it.clean() - } - } - - override fun initialize(sourceRepo: Repository, targetRepo: Repository) { - this.sourceRepo = sourceRepo - this.targetRepo = targetRepo - targetSourceDirectory = targetRepo.directory.parentFile - targetGit = Git.wrap(targetRepo) - - super.initialize(sourceRepo, targetRepo) - rewrite(Context.init()) - PorcelainAPI(targetRepo).use { - it.resetHard() - it.clean() - } - } - - override fun rewriteCommitMessage(message: String, c: Context): String { - return "" - } - - override fun rewriteEntry(entry: Entry, c: Context): EntrySet { - if (entry.isTree) { - return super.rewriteEntry(entry, c) - } - - val fileType = entry.name.substringAfterLast(".") - if (!supportedFileTypes.contains(fileType.toLowerCase())) { - return Entry.EMPTY //unsupported file type - } - log.trace("Parsing file: ${entry.name}") - - val fileSource = String(source.readBlob(entry.id, c), StandardCharsets.UTF_8) - val result = EntryList() - sourceCodeTokenizer.getMethods(entry.name, fileSource).forEach { - val newId = target.writeBlob(it.tokens.joinToString("\n").toByteArray(StandardCharsets.UTF_8), c) - val name = "${it.artifactQualifiedName.identifier}.m${fileType}" - result.add(Entry(entry.mode, name, newId, entry.directory)) - cacheThing[it.artifactQualifiedName.identifier] = name //todo: consider directory - } - return result - } -} diff --git a/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/LogFollowCommand.kt b/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/LogFollowCommand.kt deleted file mode 100644 index 72ee91365..000000000 --- a/mapper/src/main/kotlin/spp/jetbrains/mapper/vcs/git/LogFollowCommand.kt +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.vcs.git - -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.api.errors.GitAPIException -import org.eclipse.jgit.diff.DiffEntry -import org.eclipse.jgit.diff.DiffEntry.ChangeType.COPY -import org.eclipse.jgit.diff.DiffEntry.ChangeType.RENAME -import org.eclipse.jgit.diff.RenameDetector -import org.eclipse.jgit.errors.MissingObjectException -import org.eclipse.jgit.lib.ObjectId -import org.eclipse.jgit.lib.Repository -import org.eclipse.jgit.revwalk.RevCommit -import org.eclipse.jgit.treewalk.TreeWalk -import org.slf4j.LoggerFactory -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import spp.protocol.artifact.LocalArtifact -import java.io.IOException - -/** - * todo: description. - * - * @since 0.2.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -class LogFollowCommand( - private val repository: Repository, - private var artifact: LocalArtifact, - private var targetCommitId: String -) { - - companion object { - private val log = LoggerFactory.getLogger(SourceMapperImpl::class.java) - } - - private var git = Git(repository) - private var currentPath: String? = null - private var nextStart: ObjectId? = null - private var forward: Boolean = true - - @Throws(IOException::class, MissingObjectException::class, GitAPIException::class) - fun call(): List { - log.info( - "Executing log follow command. Repository: {} - Artifact: {} - Target commit id: {}", - repository, artifact, targetCommitId - ) - - //determine direction - val originalStart = ObjectId.fromString(artifact.artifactQualifiedName.commitId) - val startCommitWalk = git.log().add(originalStart).call() - forward = !startCommitWalk.any { it.id.name == targetCommitId } - log.debug("Forward: {}", forward) - - //follow artifact - val artifacts = mutableListOf() - val commits = ArrayList() - var start: ObjectId? = null - nextStart = originalStart - currentPath = artifact.filePath - do { - if (forward) { - commits.clear() - start = null - } - - val logCommits = git.log() - .add(nextStart).add(ObjectId.fromString(targetCommitId)) - .addPath(currentPath).call().toList() - log.info("Found commits: {}", logCommits.joinToString()) - - for (commit in (if (forward) logCommits.asReversed() else logCommits)) { - if (commits.contains(commit)) { - start = null - } else { - start = if (forward && artifacts.isNotEmpty()) { - nextStart - } else { - commit - } - commits.add(commit) - } - } - if (start == null) return artifacts - } while (getRenamedPath(start as RevCommit, if (forward) commits else git.log().add(start).call()).also { - if (it != null) { - artifacts.add(it) - currentPath = it.filePath - } - } != null) - git.close() - return artifacts - } - - @Throws(IOException::class, MissingObjectException::class, GitAPIException::class) - private fun getRenamedPath(start: RevCommit, commits: Iterable): LocalArtifact? { - for (commit in commits) { - val tw = TreeWalk(repository) - tw.addTree(start.tree) - tw.addTree(commit.tree) - tw.isRecursive = true - - val rd = RenameDetector(repository) - rd.addAll(DiffEntry.scan(tw)) - for (diff in rd.compute()) { - if ((diff.changeType == RENAME || diff.changeType == COPY)) { - if (forward && diff.oldPath.contains(currentPath!!)) { - nextStart = commit - return LocalArtifact( - ArtifactQualifiedName( - diff.newPath.substring(0, diff.newPath.lastIndexOf(".")), - commit.name, - ArtifactType.METHOD - ), - diff.newPath - ) - } - if (!forward && diff.oldPath.contains(currentPath!!)) { - return LocalArtifact( - ArtifactQualifiedName( - diff.newPath.substring(0, diff.newPath.lastIndexOf(".")), - commit.name, - ArtifactType.METHOD - ), - diff.newPath - ) - } - } - } - } - return null - } -} diff --git a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/GroovyModificationTest.kt b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/GroovyModificationTest.kt deleted file mode 100644 index 69d914876..000000000 --- a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/GroovyModificationTest.kt +++ /dev/null @@ -1,638 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.integration - -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.internal.storage.file.FileRepository -import org.eclipse.jgit.lib.Constants -import org.intellij.lang.annotations.Language -import org.junit.Assert.* -import org.junit.Ignore -import org.junit.Test -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.jetbrains.mapper.extend.SourceCodeTokenizer -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import java.io.File -import java.nio.file.Files -import java.util.* -import java.util.concurrent.atomic.AtomicBoolean -import java.util.concurrent.atomic.AtomicInteger - -@Ignore -class GroovyModificationTest { - - @Test - fun singleModifiedFile() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "2", - ArtifactType.METHOD - ), listOf("") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Groovy") val code = """ - class GetterMethod { - private String str - String getStr() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Groovy") val renamedCode = """ - class GetterMethod { - private String str - String getStr2() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - val oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - val newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr2()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun twoModifiedFiles() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "1", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr3()", - "2", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr4()", - "2", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Groovy") val code = """ - class GetterMethod { - void getStr() { - System.currentTimeMillis() - } - void getStr2() { - System.gc() - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Groovy") val renamedCode = """ - class GetterMethod { - void getStr3() { - System.currentTimeMillis() - } - void getStr4() { - System.gc() - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed methods").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - var oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - var newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr3()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - oldName = oldName.copy(identifier = "GetterMethod.getStr2()") - newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr4()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr2()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun oneModifiedAndOneDeletedFile() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "1", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr3()", - "2", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Groovy") val code = """ - class GetterMethod { - void getStr() { - System.currentTimeMillis() - } - void getStr2() { - System.gc() - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Groovy") val renamedCode = """ - class GetterMethod { - void getStr3() { - System.currentTimeMillis() - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed methods").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - var oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - var newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr3()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - oldName = oldName.copy(identifier = "GetterMethod.getStr2()") - newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertFalse(newName.isPresent) - assertEquals("GetterMethod.getStr2()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun methodRenamedTwice() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val getCount = AtomicInteger() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - getCount.getAndAdd(1) - if (getCount.get() == 1) { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else if (getCount.get() == 2) { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "2", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr3()", - "3", - ArtifactType.METHOD - ), listOf("") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Groovy") var code = """ - class GetterMethod { - private String str - String getStr() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - code = """ - class GetterMethod { - private String str - String getStr2() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method").call() - - code = """ - class GetterMethod { - private String str - String getStr3() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method again").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId~2").name - val oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - val newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr3()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - val foundOldName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(newName.get(), oldCommitId) - assertNotNull(foundOldName) - assertTrue(foundOldName.isPresent) - assertEquals("GetterMethod.getStr()", foundOldName.get().identifier) - assertEquals(oldCommitId, foundOldName.get().commitId) - - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun methodRenamedThenDeleted() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val getCount = AtomicInteger() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - getCount.getAndAdd(1) - if (getCount.get() == 1) { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else if (getCount.get() == 2) { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "2", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else { - return emptyList() - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Groovy") var code = """ - class GetterMethod { - private String str - String getStr() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - code = """ - class GetterMethod { - private String str - String getStr2() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method").call() - - code = """ - class GetterMethod { - private String str - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Deleted method").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId~2").name - val oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - val newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertFalse(newName.isPresent) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun methodRenamedThenDeleted_getBestEffort() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val getCount = AtomicInteger() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - getCount.getAndAdd(1) - if (getCount.get() == 1) { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else if (getCount.get() == 2) { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "2", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else { - return emptyList() - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Groovy") var code = """ - class GetterMethod { - private String str - String getStr() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - code = """ - class GetterMethod { - private String str - String getStr2() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method").call() - - code = """ - class GetterMethod { - private String str - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Deleted method").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val secondCommitId = gitMapper.targetRepo.resolve("$newCommitId~1").name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId~2").name - val oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - val newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId, true) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr2()", newName.get().identifier) - assertEquals(secondCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - val foundOldName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName( - ArtifactQualifiedName( - identifier = "GetterMethod.getStr2()", - commitId = secondCommitId, - type = ArtifactType.METHOD - ), oldCommitId - ) - assertNotNull(foundOldName) - assertTrue(foundOldName.isPresent) - assertEquals("GetterMethod.getStr()", foundOldName.get().identifier) - assertEquals(oldCommitId, foundOldName.get().commitId) - - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } -} diff --git a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/JavaModificationTest.kt b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/JavaModificationTest.kt deleted file mode 100644 index 94eddf0a2..000000000 --- a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/JavaModificationTest.kt +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.integration - -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.internal.storage.file.FileRepository -import org.eclipse.jgit.lib.Constants -import org.intellij.lang.annotations.Language -import org.junit.Assert.* -import org.junit.Ignore -import org.junit.Test -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.jetbrains.mapper.extend.SourceCodeTokenizer -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import java.io.File -import java.nio.file.Files -import java.util.* -import java.util.concurrent.atomic.AtomicBoolean - -@Ignore -class JavaModificationTest { - - @Test - fun singleModifiedFile() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "2", - ArtifactType.METHOD - ), listOf("") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Java") val code = """ - public class GetterMethod { - private String str; - public String getStr() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Java") val renamedCode = """ - public class GetterMethod { - private String str; - public String getStr2() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - val oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - val newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr2()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun twoModifiedFiles() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "1", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr3()", - "2", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr4()", - "2", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Java") val code = """ - public class GetterMethod { - public void getStr() { - System.currentTimeMillis(); - } - public void getStr2() { - System.gc(); - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Java") val renamedCode = """ - public class GetterMethod { - public void getStr3() { - System.currentTimeMillis(); - } - public void getStr4() { - System.gc(); - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed methods").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - var oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - var newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr3()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - oldName = oldName.copy(identifier = "GetterMethod.getStr2()") - newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr4()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr2()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun oneModifiedAndOneDeletedFile() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "1", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr3()", - "2", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Java") val code = """ - public class GetterMethod { - public void getStr() { - System.currentTimeMillis(); - } - public void getStr2() { - System.gc(); - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Java") val renamedCode = """ - public class GetterMethod { - public void getStr3() { - System.currentTimeMillis(); - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed methods").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - var oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - var newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr3()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - oldName = oldName.copy(identifier = "GetterMethod.getStr2()") - newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertFalse(newName.isPresent) - assertEquals("GetterMethod.getStr2()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } -} diff --git a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/KotlinModificationTest.kt b/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/KotlinModificationTest.kt deleted file mode 100644 index 33faa1d71..000000000 --- a/mapper/src/test/kotlin/spp/jetbrains/mapper/integration/KotlinModificationTest.kt +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.integration - -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.internal.storage.file.FileRepository -import org.eclipse.jgit.lib.Constants -import org.intellij.lang.annotations.Language -import org.junit.Assert.* -import org.junit.Ignore -import org.junit.Test -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.jetbrains.mapper.extend.SourceCodeTokenizer -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import java.io.File -import java.nio.file.Files -import java.util.* -import java.util.concurrent.atomic.AtomicBoolean - -@Ignore -class KotlinModificationTest { - - @Test - fun singleModifiedFile() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "2", - ArtifactType.METHOD - ), listOf("") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Kt") val code = """ - class GetterMethod { - private val str: String - fun getStr(): String { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.kt").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Kt") val renamedCode = """ - class GetterMethod { - private val str: String - fun getStr2(): String { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.kt").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - val oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - val newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr2()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun twoModifiedFiles() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "1", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr3()", - "2", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr4()", - "2", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Kt") val code = """ - class GetterMethod { - fun getStr() { - System.currentTimeMillis() - } - fun getStr2() { - System.gc() - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.kt").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Kt") val renamedCode = """ - class GetterMethod { - fun getStr3() { - System.currentTimeMillis() - } - fun getStr4() { - System.gc() - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.kt").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed methods").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - var oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - var newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr3()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - oldName = oldName.copy(identifier = "GetterMethod.getStr2()") - newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr4()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr2()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun oneModifiedAndOneDeletedFile() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val first = AtomicBoolean() - val sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods(filename: String, sourceCode: String): List { - if (!first.get()) { - first.set(true) - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr()", - "1", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ), - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr2()", - "1", - ArtifactType.METHOD - ), listOf("System", "gc()") - ) - ) - } else { - return listOf( - SourceCodeTokenizer.TokenizedMethod( - ArtifactQualifiedName( - "GetterMethod.getStr3()", - "2", - ArtifactType.METHOD - ), listOf("System", "currentTimeMillis()") - ) - ) - } - } - } - - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Kt") val code = """ - class GetterMethod { - fun getStr() { - System.currentTimeMillis() - } - fun getStr2() { - System.gc() - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.kt").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Kt") val renamedCode = """ - class GetterMethod { - fun getStr3() { - System.currentTimeMillis() - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.kt").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed methods").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - var oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - var newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr3()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - oldName = oldName.copy(identifier = "GetterMethod.getStr2()") - newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertNotNull(newName) - assertFalse(newName.isPresent) - assertEquals("GetterMethod.getStr2()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } -} diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index ae1fc96e3..2dda7ffca 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -51,7 +51,6 @@ changelog { dependencies { if (findProject(":interfaces:jetbrains") != null) { - implementation(project(":interfaces:jetbrains:mapper")) implementation(project(":interfaces:jetbrains:marker")) implementation(project(":interfaces:jetbrains:marker:jvm-marker")) implementation(project(":interfaces:jetbrains:marker:py-marker")) @@ -59,7 +58,6 @@ dependencies { implementation(project(":interfaces:portal")) implementation(project(":protocol")) } else { - implementation(project(":mapper")) implementation(project(":marker")) implementation(project(":marker:jvm-marker")) implementation(project(":marker:py-marker")) From 635f384143f09a87857cec70a7391d511b52068e Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Mar 2022 14:13:52 +0100 Subject: [PATCH 061/115] remove mapper --- .../kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 2d2ae18ef..588dd3fb3 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -557,10 +557,6 @@ object SourceMarkerPlugin { ) } - private fun initMapper() { - //todo: this - } - private suspend fun initPortal(config: SourceMarkerConfig) { //todo: portal should be connected to event bus without bridge val sockJSHandler = SockJSHandler.create(vertx) From c0992465ad00650720f99577e27dc7f2269cf2fb Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Mar 2022 14:17:07 +0100 Subject: [PATCH 062/115] unused --- .../service/breakpoint/BreakpointHitWindowService.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt index 5c6e01d7a..2bbc6762e 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt @@ -30,7 +30,6 @@ import com.intellij.ui.content.ContentManager import com.intellij.ui.content.ContentManagerEvent import com.intellij.ui.content.ContentManagerListener import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter -import org.slf4j.LoggerFactory import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_BREAKPOINT_DISABLED_ICON import spp.jetbrains.sourcemarker.service.breakpoint.LiveBreakpointConstants.LIVE_BREAKPOINT_NAME import spp.jetbrains.sourcemarker.service.breakpoint.ui.BreakpointHitWindow @@ -47,8 +46,6 @@ import spp.protocol.instrument.event.LiveBreakpointHit class BreakpointHitWindowService(private val project: Project) : Disposable { companion object { - private val log = LoggerFactory.getLogger(BreakpointHitWindowService::class.java) - fun getInstance(project: Project): BreakpointHitWindowService { return ServiceManager.getService(project, BreakpointHitWindowService::class.java) } From 7f7c49cc9559769797461b2b823a2f5ab6eca103 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Mar 2022 14:20:23 +0100 Subject: [PATCH 063/115] remove unused --- .../jetbrains/sourcemarker/PluginBundle.kt | 6 - .../sourcemarker/SourceMarkerPlugin.kt | 25 +--- .../discover/TCPServiceDiscoveryBackend.kt | 1 - .../service/LogCountIndicators.kt | 113 ------------------ 4 files changed, 2 insertions(+), 143 deletions(-) delete mode 100644 plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/PluginBundle.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/PluginBundle.kt index 2c07daded..1563cbab0 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/PluginBundle.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/PluginBundle.kt @@ -35,10 +35,4 @@ object PluginBundle : AbstractBundle(BUNDLE) { @Suppress("SpreadOperator") @JvmStatic fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = getMessage(key, *params) - - @Suppress("SpreadOperator") - @JvmStatic - fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = run { - message(key, *params) - } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 588dd3fb3..790a3c54b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -89,7 +89,6 @@ import spp.jetbrains.sourcemarker.listeners.PluginSourceMarkEventListener import spp.jetbrains.sourcemarker.listeners.PortalEventListener import spp.jetbrains.sourcemarker.service.LiveInstrumentManager import spp.jetbrains.sourcemarker.service.LiveViewManager -import spp.jetbrains.sourcemarker.service.LogCountIndicators import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.settings.getServicePortNormalized @@ -107,12 +106,11 @@ import spp.protocol.artifact.trace.TraceResult import spp.protocol.artifact.trace.TraceSpan import spp.protocol.artifact.trace.TraceSpanStackQueryResult import spp.protocol.artifact.trace.TraceStack +import spp.protocol.marshall.KSerializers +import spp.protocol.marshall.LocalMessageCodec import spp.protocol.service.LiveInstrumentService import spp.protocol.service.LiveService import spp.protocol.service.LiveViewService -import spp.protocol.service.LogCountIndicatorService -import spp.protocol.marshall.KSerializers -import spp.protocol.marshall.LocalMessageCodec import java.awt.Dimension import java.io.File import java.io.IOException @@ -398,25 +396,6 @@ object SourceMarkerPlugin { } else { log.info("Live views disabled") } - - //log count indicator - if (hardcodedConfig.getJsonObject("services").getBoolean("log_count_indicator")) { - if (availableRecords.any { it.name == SourceServices.Utilize.LOG_COUNT_INDICATOR }) { - log.info("Log count indicator available") - Instance.logCountIndicator = ServiceProxyBuilder(vertx) - .apply { config.serviceToken?.let { setToken(it) } } - .setAddress(SourceServices.Utilize.LOG_COUNT_INDICATOR) - .build(LogCountIndicatorService::class.java) - - GlobalScope.launch(vertx.dispatcher()) { - deploymentIds.add(vertx.deployVerticle(LogCountIndicators()).await()) - } - } else { - log.warn("Log count indicator unavailable") - } - } else { - log.info("Log count indicator disabled") - } } private suspend fun restartIfNecessary() { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index ddc5a709b..91ace2a07 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -122,7 +122,6 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { setupHandler(vertx, Utilize.LIVE_SERVICE) setupHandler(vertx, Utilize.LIVE_INSTRUMENT) setupHandler(vertx, Utilize.LIVE_VIEW) - setupHandler(vertx, Utilize.LOG_COUNT_INDICATOR) //setup connection val replyAddress = UUID.randomUUID().toString() diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt deleted file mode 100644 index 35a68ce2d..000000000 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LogCountIndicators.kt +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.sourcemarker.service - -import com.intellij.ide.util.PropertiesComponent -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.project.ProjectManager -import io.vertx.core.json.Json -import io.vertx.kotlin.coroutines.CoroutineVerticle -import kotlinx.coroutines.launch -import kotlinx.datetime.Clock -import kotlinx.datetime.DateTimeUnit -import kotlinx.datetime.minus -import org.slf4j.LoggerFactory -import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.marker.SourceMarker.creationService -import spp.jetbrains.marker.source.mark.api.MethodSourceMark -import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.LOGGER_DETECTOR -import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.protocol.SourceServices.Instance -import spp.protocol.instrument.DurationStep - -/** - * todo: description. - * - * @since 0.2.1 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -class LogCountIndicators : CoroutineVerticle() { - - companion object { - private val log = LoggerFactory.getLogger(LogCountIndicators::class.java) - } - - override suspend fun start() { - log.info("Log count indicators started") - vertx.setPeriodic(5000) { - if (Instance.logCountIndicator != null) { - val project = ProjectManager.getInstance().openProjects[0] - val config = Json.decodeValue( - PropertiesComponent.getInstance(project).getValue("sourcemarker_plugin_config"), - SourceMarkerConfig::class.java - ) - - SourceMarker.getAvailableSourceFileMarkers().forEach { fileMarker -> - launch { - val fileLogPatterns = fileMarker.getSourceMarks().filterIsInstance().flatMap { - it.getUserData(LOGGER_DETECTOR)!!.getOrFindLoggerStatements(it) - } - val occurrences = Instance.logCountIndicator!!.getPatternOccurrences( - fileLogPatterns.map { it.logPattern }, - config.serviceName, - Clock.System.now().minus(15, DateTimeUnit.MINUTE), - Clock.System.now(), - DurationStep.MINUTE - ).onComplete { - if (it.succeeded()) { - val occurrences = it.result() - //log.info("Found ${occurrences} occurrences of log patterns") - - ApplicationManager.getApplication().runReadAction { - fileLogPatterns.forEach { logger -> - val sumValue = occurrences.getJsonObject(logger.logPattern) - .getJsonArray("values").list.sumOf { it as Int? ?: 0 } - - val logIndicator = creationService.getOrCreateExpressionGutterMark( - fileMarker, - logger.lineLocation - ).get() - if (!fileMarker.containsSourceMark(logIndicator)) { - logIndicator.configuration.icon = - SourceMarkerIcons.getNumericGutterMarkIcon( - sumValue, - if (logger.level == "warn" || logger.level == "error") "#e1483b" - else "#182d34" - ) - logIndicator.apply(true) - } else { - logIndicator.configuration.icon = - SourceMarkerIcons.getNumericGutterMarkIcon( - sumValue, - if (logger.level == "warn" || logger.level == "error") "#e1483b" - else "#182d34" - ) - //todo: should just be updating rendering, not all analysis - fileMarker.refresh() - } - } - } - } - } - } - } - } - } - } -} From d466cad0b53be2506002d595a6a02cfc74e74aeb Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Mar 2022 14:22:37 +0100 Subject: [PATCH 064/115] remove unused --- plugin/src/main/resources/plugin-configuration.json | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/src/main/resources/plugin-configuration.json b/plugin/src/main/resources/plugin-configuration.json index b736dabda..6e8893a69 100644 --- a/plugin/src/main/resources/plugin-configuration.json +++ b/plugin/src/main/resources/plugin-configuration.json @@ -6,7 +6,6 @@ "service_port": 5445, "tcp_service_port": 5455, "services": { - "log_count_indicator": false, "live_instrument": true, "live_view": true } From 403ceabb63a1e4230d0dcc787c5f405fb493aa88 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 7 Mar 2022 16:14:22 +0100 Subject: [PATCH 065/115] remove portal tests --- .../jetbrains/StandaloneActivityLiveView.kt | 168 ------------------ .../spp/jetbrains/StandaloneLogsLiveView.kt | 139 --------------- .../spp/jetbrains/StandaloneTracesLiveView.kt | 139 --------------- 3 files changed, 446 deletions(-) delete mode 100644 plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt delete mode 100644 plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt delete mode 100644 plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt deleted file mode 100644 index adc5031a5..000000000 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneActivityLiveView.kt +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains - -import com.intellij.ide.util.PropertiesComponent -import com.intellij.openapi.module.Module -import com.intellij.openapi.projectRoots.JavaSdk -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.roots.ContentEntry -import com.intellij.openapi.roots.LanguageLevelModuleExtension -import com.intellij.openapi.roots.ModifiableRootModel -import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.pom.java.LanguageLevel -import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.PsiTestUtil -import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor -import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase -import io.vertx.core.Promise -import io.vertx.core.json.Json -import io.vertx.kotlin.coroutines.await -import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking -import org.junit.jupiter.api.Assumptions.assumeTrue -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.marker.source.mark.api.SourceMark -import spp.jetbrains.portal.SourcePortal -import spp.jetbrains.sourcemarker.SourceMarkerPlugin -import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys -import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshActivity -import spp.protocol.SourceServices -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import spp.protocol.instrument.LiveSourceLocation -import spp.jetbrains.portal.protocol.portal.PortalConfiguration -import spp.protocol.view.LiveViewConfig -import spp.protocol.view.LiveViewSubscription -import java.io.File -import kotlin.system.exitProcess - -class StandaloneActivityLiveView : LightJavaCodeInsightFixtureTestCase() { - - @BeforeEach - public override fun setUp() { - assumeTrue((System.getenv("STANDALONE_ENABLED")?.toBoolean() ?: false)) - super.setUp() - } - - override fun getTestDataPath() = "src/test/testData/spp-example-web-app/src/main/java" - - override fun getProjectDescriptor(): LightProjectDescriptor { - return object : DefaultLightProjectDescriptor() { - override fun getSdk(): Sdk = JavaSdk.getInstance().createJdk( - "jdk-1.8", "/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre" - ) - - override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) { - super.configureModule(module, model, contentEntry) - model.getModuleExtension(LanguageLevelModuleExtension::class.java).languageLevel = LanguageLevel.JDK_1_8 - - myFixture.copyDirectoryToProject("", "") - val modulePath = testDataPath - val moduleDir = LocalFileSystem.getInstance().findFileByPath( - modulePath.replace(File.separatorChar, '/') - )!! - PsiTestUtil.removeAllRoots(module, sdk) - PsiTestUtil.addContentRoot(module, moduleDir) - PsiTestUtil.addLibrary( - model, - "test-lib", - "src/test/testData/spp-example-web-app/lib/", - "spring-web-5.2.2.RELEASE.jar", - "spring-data-commons-2.2.3.RELEASE.jar", - "apm-toolkit-trace-8.5.0.jar", - "slf4j-api-1.7.29.jar" - ) - } - } - } - - @Test - fun test() { - assumeTrue((System.getenv("STANDALONE_ENABLED")?.toBoolean() ?: false)) - val projectSettings = PropertiesComponent.getInstance(project) - val pluginConfig = SourceMarkerConfig( - accessToken = "change-me", - certificatePins = listOf( - "47:09:B8:64:03:06:5C:1A:25:D5:9B:95:CD:0F:8B:DD:5C:BA:7C:89:48:F0:37:14:E2:21:9D:E1:45:64:11:2C" - ) - ) - projectSettings.setValue("sourcemarker_plugin_config", Json.encode(pluginConfig)) - - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration(external = true) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - vertx.sharedData().getLocalMap("portal")["bridge.port"] = 8888 - runBlocking { - SourceMarkerPlugin.init(project) - } - - myFixture.testHighlighting( - false, - false, - false, - "spp/example/webapp/controller/WebappController.java" - ) - - GlobalScope.launch(vertx.dispatcher()) { - vertx.eventBus().send(RefreshActivity, portal) - delay(5000) - - val sourceMark = SourceMarker.getSourceMark( - portal.viewingArtifact, SourceMark.Type.GUTTER - ) ?: return@launch - val endpointName = sourceMark.getUserData( - SourceMarkKeys.ENDPOINT_DETECTOR - )?.getOrFindEndpointName(sourceMark) ?: return@launch - SourceServices.Instance.liveView!!.addLiveViewSubscription( - LiveViewSubscription( - null, - listOf(endpointName), - sourceMark.artifactQualifiedName, - LiveSourceLocation(sourceMark.artifactQualifiedName.identifier, -1), - LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) - ) - ).onComplete { - if (it.succeeded()) { - println(it) - } else { - it.cause().printStackTrace() - exitProcess(-1) - } - } - } - - runBlocking { Promise.promise().future().await() } - } -} diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt deleted file mode 100644 index 6e15a43a3..000000000 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneLogsLiveView.kt +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains - -import com.intellij.ide.util.PropertiesComponent -import com.intellij.openapi.module.Module -import com.intellij.openapi.projectRoots.JavaSdk -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.roots.ContentEntry -import com.intellij.openapi.roots.LanguageLevelModuleExtension -import com.intellij.openapi.roots.ModifiableRootModel -import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.pom.java.LanguageLevel -import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.PsiTestUtil -import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor -import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase -import io.vertx.core.Promise -import io.vertx.core.json.Json -import io.vertx.kotlin.coroutines.await -import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking -import org.junit.jupiter.api.Assumptions.assumeTrue -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import spp.jetbrains.portal.SourcePortal -import spp.jetbrains.sourcemarker.SourceMarkerPlugin -import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx -import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshLogs -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import spp.jetbrains.portal.protocol.portal.PageType -import spp.jetbrains.portal.protocol.portal.PortalConfiguration -import java.io.File - -class StandaloneLogsLiveView : LightJavaCodeInsightFixtureTestCase() { - - @BeforeEach - public override fun setUp() { - assumeTrue((System.getenv("STANDALONE_ENABLED")?.toBoolean() ?: false)) - super.setUp() - } - - override fun getTestDataPath() = "src/test/testData/spp-example-web-app/src/main/java" - - override fun getProjectDescriptor(): LightProjectDescriptor { - return object : DefaultLightProjectDescriptor() { - override fun getSdk(): Sdk = JavaSdk.getInstance().createJdk( - "jdk-1.8", "/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre" - ) - - override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) { - super.configureModule(module, model, contentEntry) - model.getModuleExtension(LanguageLevelModuleExtension::class.java).languageLevel = LanguageLevel.JDK_1_8 - - myFixture.copyDirectoryToProject("", "") - val modulePath = testDataPath - val moduleDir = LocalFileSystem.getInstance().findFileByPath( - modulePath.replace(File.separatorChar, '/') - )!! - PsiTestUtil.removeAllRoots(module, sdk) - PsiTestUtil.addContentRoot(module, moduleDir) - PsiTestUtil.addLibrary( - model, - "test-lib", - "src/test/testData/spp-example-web-app/lib/", - "spring-web-5.2.2.RELEASE.jar", - "spring-data-commons-2.2.3.RELEASE.jar", - "apm-toolkit-trace-8.5.0.jar", - "slf4j-api-1.7.29.jar" - ) - } - } - } - - @Test - fun test() { - assumeTrue((System.getenv("STANDALONE_ENABLED")?.toBoolean() ?: false)) - val projectSettings = PropertiesComponent.getInstance(project) - val pluginConfig = SourceMarkerConfig( - accessToken = "change-me", - certificatePins = listOf( - "47:09:B8:64:03:06:5C:1A:25:D5:9B:95:CD:0F:8B:DD:5C:BA:7C:89:48:F0:37:14:E2:21:9D:E1:45:64:11:2C" - ) - ) - projectSettings.setValue("sourcemarker_plugin_config", Json.encode(pluginConfig)) - - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration( - currentPage = PageType.LOGS, - external = true - ) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - vertx.sharedData().getLocalMap("portal")["bridge.port"] = 8888 - runBlocking { - SourceMarkerPlugin.init(project) - } - - myFixture.testHighlighting( - false, - false, - false, - "spp/example/webapp/controller/WebappController.java" - ) - - GlobalScope.launch(vertx.dispatcher()) { - vertx.eventBus().send(RefreshLogs, portal) - } - - runBlocking { Promise.promise().future().await() } - } -} diff --git a/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt b/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt deleted file mode 100644 index 470993207..000000000 --- a/plugin/src/test/kotlin/spp/jetbrains/StandaloneTracesLiveView.kt +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains - -import com.intellij.ide.util.PropertiesComponent -import com.intellij.openapi.module.Module -import com.intellij.openapi.projectRoots.JavaSdk -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.roots.ContentEntry -import com.intellij.openapi.roots.LanguageLevelModuleExtension -import com.intellij.openapi.roots.ModifiableRootModel -import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.pom.java.LanguageLevel -import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.PsiTestUtil -import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor -import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase -import io.vertx.core.Promise -import io.vertx.core.json.Json -import io.vertx.kotlin.coroutines.await -import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking -import org.junit.jupiter.api.Assumptions.assumeTrue -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import spp.jetbrains.portal.SourcePortal -import spp.jetbrains.sourcemarker.SourceMarkerPlugin -import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx -import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshTraces -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import spp.jetbrains.portal.protocol.portal.PageType -import spp.jetbrains.portal.protocol.portal.PortalConfiguration -import java.io.File - -class StandaloneTracesLiveView : LightJavaCodeInsightFixtureTestCase() { - - @BeforeEach - public override fun setUp() { - assumeTrue((System.getenv("STANDALONE_ENABLED")?.toBoolean() ?: false)) - super.setUp() - } - - override fun getTestDataPath() = "src/test/testData/spp-example-web-app/src/main/java" - - override fun getProjectDescriptor(): LightProjectDescriptor { - return object : DefaultLightProjectDescriptor() { - override fun getSdk(): Sdk = JavaSdk.getInstance().createJdk( - "jdk-1.8", "/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre" - ) - - override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) { - super.configureModule(module, model, contentEntry) - model.getModuleExtension(LanguageLevelModuleExtension::class.java).languageLevel = LanguageLevel.JDK_1_8 - - myFixture.copyDirectoryToProject("", "") - val modulePath = testDataPath - val moduleDir = LocalFileSystem.getInstance().findFileByPath( - modulePath.replace(File.separatorChar, '/') - )!! - PsiTestUtil.removeAllRoots(module, sdk) - PsiTestUtil.addContentRoot(module, moduleDir) - PsiTestUtil.addLibrary( - model, - "test-lib", - "src/test/testData/spp-example-web-app/lib/", - "spring-web-5.2.2.RELEASE.jar", - "spring-data-commons-2.2.3.RELEASE.jar", - "apm-toolkit-trace-8.5.0.jar", - "slf4j-api-1.7.29.jar" - ) - } - } - } - - @Test - fun test() { - assumeTrue((System.getenv("STANDALONE_ENABLED")?.toBoolean() ?: false)) - val projectSettings = PropertiesComponent.getInstance(project) - val pluginConfig = SourceMarkerConfig( - accessToken = "change-me", - certificatePins = listOf( - "47:09:B8:64:03:06:5C:1A:25:D5:9B:95:CD:0F:8B:DD:5C:BA:7C:89:48:F0:37:14:E2:21:9D:E1:45:64:11:2C" - ) - ) - projectSettings.setValue("sourcemarker_plugin_config", Json.encode(pluginConfig)) - - val className = "spp.example.webapp.controller.WebappController" - val artifactName = "$className.getUser(long)" - val portalUuid = "5471535f-2a5f-4ed2-bfaf-65345c59fd7b" - println( - "Portal UUID: " + SourcePortal.register( - portalUuid, - ArtifactQualifiedName(artifactName, type = ArtifactType.METHOD), - PortalConfiguration( - currentPage = PageType.TRACES, - external = true - ) - ) - ) - val portal = SourcePortal.getPortal(portalUuid)!! - - vertx.sharedData().getLocalMap("portal")["bridge.port"] = 8888 - runBlocking { - SourceMarkerPlugin.init(project) - } - - myFixture.testHighlighting( - false, - false, - false, - "spp/example/webapp/controller/WebappController.java" - ) - - GlobalScope.launch(vertx.dispatcher()) { - vertx.eventBus().send(RefreshTraces, portal) - } - - runBlocking { Promise.promise().future().await() } - } -} From c0bc141f642b25fe0522a9f86f4da74cbea12807 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 11:31:53 +0100 Subject: [PATCH 066/115] exclude gen --- build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle.kts b/build.gradle.kts index b8571a172..1b6f2d6b7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -70,6 +70,7 @@ subprojects { apply(plugin = "com.diffplug.spotless") configure { kotlin { + targetExclude("**/generated/**") if (file("../LICENSE-HEADER.txt").exists()) { licenseHeaderFile(file("../LICENSE-HEADER.txt")) } else { From d56c663a29d12e37dbdf0a15fbe5df0a38298983 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 11:38:04 +0100 Subject: [PATCH 067/115] use protocol type --- .../monitor/skywalking/SkywalkingClient.kt | 7 ++++--- .../monitor/skywalking/SkywalkingExtensions.kt | 6 ++++++ .../monitor/skywalking/bridge/ServiceBridge.kt | 18 +++++++++--------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt index c96865207..71bc58bc0 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingClient.kt @@ -35,6 +35,7 @@ import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics import spp.jetbrains.monitor.skywalking.model.GetEndpointTraces import spp.jetbrains.monitor.skywalking.model.GetMultipleEndpointMetrics import spp.protocol.marshall.LocalMessageCodec +import spp.protocol.platform.general.Service import java.io.IOException import java.time.ZoneOffset.ofHours import java.time.ZonedDateTime @@ -63,7 +64,7 @@ class SkywalkingClient( vertx.eventBus().registerDefaultCodec(GetMultipleEndpointMetrics::class.java, LocalMessageCodec()) vertx.eventBus().registerDefaultCodec(GetEndpointTraces::class.java, LocalMessageCodec()) vertx.eventBus().registerDefaultCodec(GetEndpointMetrics::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(GetAllServicesQuery.Result::class.java, LocalMessageCodec()) + vertx.eventBus().registerDefaultCodec(Service::class.java, LocalMessageCodec()) vertx.eventBus().registerDefaultCodec(GetServiceInstancesQuery.Result::class.java, LocalMessageCodec()) vertx.eventBus().registerDefaultCodec(SearchEndpointQuery.Result::class.java, LocalMessageCodec()) vertx.eventBus().registerDefaultCodec(QueryBasicTracesQuery.Result::class.java, LocalMessageCodec()) @@ -219,7 +220,7 @@ class SkywalkingClient( } } - suspend fun getServices(duration: Duration): List { + suspend fun getServices(duration: Duration): List { metricRegistry.timer("getServices").time().use { if (log.isTraceEnabled) log.trace("Get services request. Duration: {}", duration) @@ -231,7 +232,7 @@ class SkywalkingClient( throw IOException(response.errors!![0].message) } else { if (log.isTraceEnabled) log.trace("Get services response: {}", response.data!!.result) - return response.data!!.result + return response.data!!.result.map { it.toProtocol() } } } } diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt index 22d6dd1a9..3810ce441 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingExtensions.kt @@ -18,6 +18,7 @@ package spp.jetbrains.monitor.skywalking import kotlinx.datetime.Instant +import monitor.skywalking.protocol.metadata.GetAllServicesQuery import monitor.skywalking.protocol.metrics.GetLinearIntValuesQuery import monitor.skywalking.protocol.metrics.GetMultipleLinearIntValuesQuery import monitor.skywalking.protocol.trace.QueryBasicTracesQuery @@ -31,6 +32,7 @@ import spp.protocol.artifact.metrics.ArtifactMetricResult import spp.protocol.artifact.metrics.ArtifactMetrics import spp.protocol.artifact.metrics.MetricType import spp.protocol.artifact.trace.* +import spp.protocol.platform.general.Service fun toProtocol( artifactQualifiedName: ArtifactQualifiedName, @@ -134,3 +136,7 @@ fun Iterable.average(): Double { fun GetMultipleLinearIntValuesQuery.Value.toProtocol(): Double { return (value as Int).toDouble() } + +fun GetAllServicesQuery.Result.toProtocol(): Service { + return Service(id, name) +} diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt index 806b204c3..85ceb7e48 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt @@ -23,9 +23,9 @@ import io.vertx.kotlin.coroutines.CoroutineVerticle import io.vertx.kotlin.coroutines.await import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.launch -import monitor.skywalking.protocol.metadata.GetAllServicesQuery import spp.jetbrains.monitor.skywalking.SkywalkingClient import spp.jetbrains.monitor.skywalking.SkywalkingClient.DurationStep +import spp.protocol.platform.general.Service import java.time.ZonedDateTime /** @@ -37,8 +37,8 @@ import java.time.ZonedDateTime @Suppress("MagicNumber") class ServiceBridge(private val skywalkingClient: SkywalkingClient) : CoroutineVerticle() { - var currentService: GetAllServicesQuery.Result? = null - var activeServices: List = emptyList() + var currentService: Service? = null + var activeServices: List = emptyList() override suspend fun start() { vertx.setPeriodic(5000) { timerId -> @@ -99,22 +99,22 @@ class ServiceBridge(private val skywalkingClient: SkywalkingClient) : CoroutineV private const val currentServiceUpdatedAddress = "$rootAddress.currentService-Updated" private const val activeServicesUpdatedAddress = "$rootAddress.activeServices-Updated" - fun currentServiceConsumer(vertx: Vertx): MessageConsumer { + fun currentServiceConsumer(vertx: Vertx): MessageConsumer { return vertx.eventBus().localConsumer(currentServiceUpdatedAddress) } - fun activeServicesConsumer(vertx: Vertx): MessageConsumer> { + fun activeServicesConsumer(vertx: Vertx): MessageConsumer> { return vertx.eventBus().localConsumer(activeServicesUpdatedAddress) } - suspend fun getCurrentService(vertx: Vertx): GetAllServicesQuery.Result { + suspend fun getCurrentService(vertx: Vertx): Service { return vertx.eventBus() - .request(getCurrentServiceAddress, true).await().body() + .request(getCurrentServiceAddress, true).await().body() } - suspend fun getActiveServices(vertx: Vertx): List { + suspend fun getActiveServices(vertx: Vertx): List { return vertx.eventBus() - .request>(getActiveServicesAddress, true).await().body() + .request>(getActiveServicesAddress, true).await().body() } } } From 42bcbf2de21cb2959016265dba0c3e7341f2e1cd Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 11:40:49 +0100 Subject: [PATCH 068/115] start from current service --- .../monitor/skywalking/SkywalkingMonitor.kt | 5 +++-- .../monitor/skywalking/bridge/ServiceBridge.kt | 12 ++++++++++-- .../spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt | 4 +++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt index d09cfbc45..0441cd752 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt @@ -43,7 +43,8 @@ class SkywalkingMonitor( private val serverUrl: String, private val jwtToken: String? = null, private val certificatePins: List = emptyList(), - private val verifyHost: Boolean + private val verifyHost: Boolean, + private val currentService: String? = null ) : CoroutineVerticle() { companion object { @@ -99,7 +100,7 @@ class SkywalkingMonitor( val timezone = Integer.parseInt(response.data!!.result!!.timezone) / 100 val skywalkingClient = SkywalkingClient(vertx, client, timezone) - vertx.deployVerticle(ServiceBridge(skywalkingClient)).await() + vertx.deployVerticle(ServiceBridge(skywalkingClient, currentService)).await() vertx.deployVerticle(ServiceInstanceBridge(skywalkingClient)).await() vertx.deployVerticle(EndpointBridge(skywalkingClient)).await() vertx.deployVerticle(EndpointMetricsBridge(skywalkingClient)).await() diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt index 85ceb7e48..047b9c1b4 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/ServiceBridge.kt @@ -35,7 +35,10 @@ import java.time.ZonedDateTime * @author [Brandon Fergerson](mailto:bfergerson@apache.org) */ @Suppress("MagicNumber") -class ServiceBridge(private val skywalkingClient: SkywalkingClient) : CoroutineVerticle() { +class ServiceBridge( + private val skywalkingClient: SkywalkingClient, + private val initServiceName: String? +) : CoroutineVerticle() { var currentService: Service? = null var activeServices: List = emptyList() @@ -51,7 +54,12 @@ class ServiceBridge(private val skywalkingClient: SkywalkingClient) : CoroutineV vertx.cancelTimer(timerId) vertx.eventBus().publish(activeServicesUpdatedAddress, activeServices) - currentService = activeServices[0] + if (initServiceName != null) { + currentService = activeServices.find { it.name == initServiceName } + } + if (currentService == null) { + currentService = activeServices[0] + } vertx.eventBus().publish(currentServiceUpdatedAddress, currentService) } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 790a3c54b..67e3e6489 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -531,7 +531,9 @@ object SourceMarkerPlugin { deploymentIds.add( vertx.deployVerticle( - SkywalkingMonitor(skywalkingHost, config.serviceToken, certificatePins, config.verifyHost) + SkywalkingMonitor( + skywalkingHost, config.serviceToken, certificatePins, config.verifyHost, config.serviceName + ) ).await() ) } From 87680f16c1b7e84ce9607ee4d493e2ed23d1a08b Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 11:43:21 +0100 Subject: [PATCH 069/115] remove portal config from status bars --- .../command/ControlBarController.kt | 4 ---- .../sourcemarker/status/LiveStatusManager.kt | 24 ------------------- 2 files changed, 28 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt index 67fe07199..6d4966326 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt @@ -293,10 +293,6 @@ object ControlBarController { inlayMark.visible.set(true) inlayMark.apply() - val sourcePortal = inlayMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - sourcePortal.configuration.currentPage = PageType.LOGS - sourcePortal.configuration.statusBar = true - controlBar.focus() } } else if (tryingAboveLine) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index 29138cb11..5ca626d97 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -151,10 +151,6 @@ object LiveStatusManager : SourceMarkEventListener { inlayMark.visible.set(true) inlayMark.apply() - val sourcePortal = inlayMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! -// sourcePortal.configuration.currentPage = PageType.BREAKPOINTS - sourcePortal.configuration.statusBar = true - statusBar.focus() } } @@ -252,10 +248,6 @@ object LiveStatusManager : SourceMarkEventListener { inlayMark.visible.set(true) inlayMark.apply() - val sourcePortal = inlayMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - sourcePortal.configuration.currentPage = PageType.LOGS - sourcePortal.configuration.statusBar = true - if (!watchExpression) { SourceMarkerPlugin.vertx.eventBus().consumer(DisplayLogs(sourcePortal.portalUuid)) { val latestLog = it.body().logs.first() @@ -304,10 +296,6 @@ object LiveStatusManager : SourceMarkEventListener { inlayMark.visible.set(true) inlayMark.apply() - val sourcePortal = inlayMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! -// sourcePortal.configuration.currentPage = PageType.METERS - sourcePortal.configuration.statusBar = true - statusBar.focus() } } @@ -349,10 +337,6 @@ object LiveStatusManager : SourceMarkEventListener { inlayMark.visible.set(true) inlayMark.apply() - val sourcePortal = inlayMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! -// sourcePortal.configuration.currentPage = PageType.METERS - sourcePortal.configuration.statusBar = true - statusBar.focus() } } @@ -386,10 +370,6 @@ object LiveStatusManager : SourceMarkEventListener { override fun makeSwingComponent(sourceMark: SourceMark): JComponent = wrapperPanel } inlayMark.apply() - - val sourcePortal = inlayMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - //sourcePortal.configuration.currentPage = PageType.BREAKPOINTS - sourcePortal.configuration.statusBar = true } } else { log.warn("No detected expression at line {}. Inlay mark ignored", liveBreakpoint.location.line) @@ -428,10 +408,6 @@ object LiveStatusManager : SourceMarkEventListener { } inlayMark.apply() - val sourcePortal = inlayMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - sourcePortal.configuration.currentPage = PageType.LOGS - sourcePortal.configuration.statusBar = true - val detector = inlayMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! detector.addLiveLog(editor, inlayMark, liveLog.logFormat, liveLog.location.line) From b3c2a57b2d092e1328202d72467ccd57fe02141c Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 11:46:46 +0100 Subject: [PATCH 070/115] translations --- plugin/src/main/resources/messages/PluginBundle_zh.properties | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/src/main/resources/messages/PluginBundle_zh.properties b/plugin/src/main/resources/messages/PluginBundle_zh.properties index 88c1889ff..e67134ca3 100644 --- a/plugin/src/main/resources/messages/PluginBundle_zh.properties +++ b/plugin/src/main/resources/messages/PluginBundle_zh.properties @@ -1,3 +1,7 @@ +plugin_name=Source++ +service_settings=服务设置 +service_host=主机 +service_certificate=证书 host=主办最近3小时 port=端口 root_source_package=根源包 From d68b2c52485feb0ab40d6c44ffcdb07acca75a48 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 12:46:03 +0100 Subject: [PATCH 071/115] skywalking reroute --- .../listeners/PortalEventListener.kt | 680 ------------------ 1 file changed, 680 deletions(-) delete mode 100644 plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt deleted file mode 100644 index 11bf9c651..000000000 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.sourcemarker.listeners - -import com.intellij.ide.ui.laf.IntelliJLaf -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.runReadAction -import com.intellij.openapi.project.ProjectManager -import com.intellij.psi.PsiNameIdentifierOwner -import com.intellij.util.PsiNavigateUtil -import io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND -import io.vertx.core.eventbus.ReplyException -import io.vertx.core.json.Json -import io.vertx.core.json.JsonObject -import io.vertx.kotlin.coroutines.CoroutineVerticle -import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.launch -import kotlinx.datetime.Instant -import org.slf4j.LoggerFactory -import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.marker.SourceMarker.creationService -import spp.jetbrains.marker.jvm.ArtifactNavigator -import spp.jetbrains.marker.jvm.ArtifactSearch.findArtifact -import spp.jetbrains.marker.source.SourceFileMarker -import spp.jetbrains.marker.source.mark.api.ClassSourceMark -import spp.jetbrains.marker.source.mark.api.MethodSourceMark -import spp.jetbrains.marker.source.mark.api.SourceMark -import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent -import spp.jetbrains.monitor.skywalking.SkywalkingClient -import spp.jetbrains.monitor.skywalking.average -import spp.jetbrains.monitor.skywalking.bridge.EndpointMetricsBridge -import spp.jetbrains.monitor.skywalking.bridge.EndpointTracesBridge -import spp.jetbrains.monitor.skywalking.bridge.LogsBridge -import spp.jetbrains.monitor.skywalking.bridge.LogsBridge.GetEndpointLogs -import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics -import spp.jetbrains.monitor.skywalking.model.GetEndpointTraces -import spp.jetbrains.monitor.skywalking.model.ZonedDuration -import spp.jetbrains.monitor.skywalking.toProtocol -import spp.jetbrains.portal.SourcePortal -import spp.jetbrains.sourcemarker.PluginBundle -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR -import spp.jetbrains.sourcemarker.search.SourceMarkSearch -import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactLogUpdated -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactTracesUpdated -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.CanNavigateToArtifact -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ClickedStackTraceElement -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ClosePortal -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.FindAndOpenPortal -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.FindPortal -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.GetPortalConfiguration -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.GetPortalTranslations -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.NavigateToArtifact -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.OpenPortal -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.QueryTraceStack -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshActivity -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshLogs -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshOverview -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshPortal -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshTraces -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.SetCurrentPage -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.TraceSpanUpdated -import spp.jetbrains.portal.protocol.ProtocolAddress.Portal.UpdateEndpoints -import spp.protocol.SourceServices.Instance -import spp.protocol.artifact.ArtifactNameUtils -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import spp.jetbrains.portal.protocol.artifact.endpoint.EndpointResult -import spp.jetbrains.portal.protocol.artifact.endpoint.EndpointType -import spp.protocol.artifact.exception.LiveStackTraceElement -import spp.jetbrains.portal.protocol.artifact.metrics.ArtifactSummarizedMetrics -import spp.jetbrains.portal.protocol.artifact.metrics.ArtifactSummarizedResult -import spp.protocol.artifact.metrics.MetricType -import spp.protocol.artifact.trace.TraceResult -import spp.protocol.artifact.trace.TraceSpan -import spp.protocol.instrument.LiveSourceLocation -import spp.jetbrains.portal.protocol.portal.PageType -import spp.protocol.view.LiveViewConfig -import spp.protocol.view.LiveViewSubscription -import java.net.URI -import java.time.ZonedDateTime -import java.time.temporal.ChronoUnit -import javax.swing.UIManager - -/** - * todo: description. - * - * @since 0.1.0 - * @author [Brandon Fergerson](mailto:bfergerson@apache.org) - */ -@Suppress("MagicNumber") -class PortalEventListener( - private val markerConfig: SourceMarkerConfig, - private val hostTranslations: Boolean = true -) : CoroutineVerticle() { - - companion object { - private val log = LoggerFactory.getLogger(PortalEventListener::class.java) - } - - private var lastDisplayedInternalPortal: SourcePortal? = null - - override suspend fun start() { - //listen for theme changes - UIManager.addPropertyChangeListener { - if (lastDisplayedInternalPortal != null) { - lastDisplayedInternalPortal!!.configuration.darkMode = (it.newValue !is IntelliJLaf) - val sourceMark = SourceMarker.getSourceMark( - lastDisplayedInternalPortal!!.viewingArtifact, SourceMark.Type.GUTTER - ) - if (sourceMark != null) { - val jcefComponent = sourceMark.sourceMarkComponent as SourceMarkJcefComponent - jcefComponent.getBrowser().cefBrowser.reload() - } - } - } - - vertx.eventBus().consumer(RefreshPortal) { - val portal = if (it.body() is String) { - SourcePortal.getPortal(it.body() as String) - } else { - it.body() as SourcePortal - }!! - when (portal.configuration.currentPage) { - PageType.OVERVIEW -> vertx.eventBus().send(RefreshOverview, portal) - PageType.ACTIVITY -> vertx.eventBus().send(RefreshActivity, portal) - PageType.LOGS -> vertx.eventBus().send(RefreshLogs, portal) - PageType.TRACES -> vertx.eventBus().send(RefreshTraces, portal) - PageType.CONFIGURATION -> TODO() - } - } - vertx.eventBus().consumer(SetCurrentPage) { - if (it.body() is JsonObject) { - val body = (it.body() as JsonObject) - val portalUuid = body.getString("portalUuid") - val pageType = PageType.valueOf(body.getString("pageType")) - val portal = SourcePortal.getPortal(portalUuid)!! - portal.configuration.currentPage = pageType - it.reply(JsonObject.mapFrom(portal.configuration)) - log.info("Set portal ${portal.portalUuid} page type to $pageType") - vertx.eventBus().publish(RefreshPortal, portal) - } else { - val portal = it.body() as SourcePortal - if (lastDisplayedInternalPortal == null) { - configureDisplayedPortal(portal) - } else { - val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) - val jcefComponent = sourceMark!!.sourceMarkComponent as SourceMarkJcefComponent - val port = vertx.sharedData().getLocalMap("portal")["http.port"]!! - val host = "http://localhost:$port" - val currentUrl = "$host/?portalUuid=${portal.portalUuid}" - jcefComponent.getBrowser().cefBrowser.executeJavaScript( - "window.location.href = '$currentUrl';", currentUrl, 0 - ) - } - it.reply(JsonObject.mapFrom(portal.configuration)) - log.info("Updated portal ${portal.portalUuid} current page") - } - } - vertx.eventBus().consumer(GetPortalConfiguration) { - val portalUuid = it.body() - if (!portalUuid.isNullOrEmpty()) { - log.info("Getting portal configuration. Portal UUID: $portalUuid") - val portal = SourcePortal.getPortal(portalUuid) - if (portal == null) { - log.error("Failed to find portal: $portalUuid") - it.fail(NOT_FOUND.code(), "Portal $portalUuid does not exist") - } else { - it.reply(JsonObject.mapFrom(portal.configuration)) - } - } else { - log.error("Failed to get portal configuration. Missing portalUuid"); - } - } - if (hostTranslations) { - vertx.eventBus().consumer(GetPortalTranslations) { - val map = HashMap() - val keys = PluginBundle.resourceBundle.keys - while (keys.hasMoreElements()) { - val key = keys.nextElement() - map[key] = PluginBundle.resourceBundle.getString(key) - } - it.reply(JsonObject.mapFrom(map)) - } - } - vertx.eventBus().consumer(FindPortal) { - val artifactQualifiedName = it.body() - val sourceMarks = SourceMarker.getSourceMarks(artifactQualifiedName) - if (sourceMarks.isNotEmpty()) { - it.reply(sourceMarks[0].getUserData(SourceMarkKeys.SOURCE_PORTAL)!!) - } else { - launch(vertx.dispatcher()) { - val classArtifact = findArtifact( - vertx, artifactQualifiedName.copy( - identifier = ArtifactNameUtils.getQualifiedClassName(artifactQualifiedName.identifier)!!, - operationName = null, - type = ArtifactType.CLASS - ) - ) - val fileMarker = SourceMarker.getSourceFileMarker(classArtifact!!.containingFile)!! - val searchArtifact = findArtifact(vertx, artifactQualifiedName) as PsiNameIdentifierOwner - runReadAction { - val gutterMark = creationService.getOrCreateMethodGutterMark( - fileMarker, searchArtifact.nameIdentifier!! - )!! - it.reply(gutterMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!) - } - } - } - } - vertx.eventBus().consumer(FindAndOpenPortal) { - val artifactQualifiedName = it.body() - runReadAction { - val sourceMarks = SourceMarker.getSourceMarks(artifactQualifiedName) - if (sourceMarks.isNotEmpty()) { - val sourceMark = sourceMarks[0] - ApplicationManager.getApplication().invokeLater { - PsiNavigateUtil.navigate(sourceMark.getPsiElement()) - - val portal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - openPortal(portal) - it.reply(portal) - } - } else { - log.warn("Failed to find portal for artifact: $artifactQualifiedName") - } - } - } - vertx.eventBus().consumer(OpenPortal) { openPortal(it.body()); it.reply(it.body()) } - vertx.eventBus().consumer(ClosePortal) { closePortal(it.body()) } - vertx.eventBus().consumer(RefreshOverview) { - runReadAction { - val fileMarker = SourceMarker.getSourceFileMarker(it.body().viewingArtifact)!! - launch(vertx.dispatcher()) { - refreshOverview(fileMarker, it.body()) - } - - //todo: update subscriptions - } - } - vertx.eventBus().consumer(RefreshActivity) { - val portal = it.body() - //pull from skywalking - launch(vertx.dispatcher()) { - pullLatestActivity(portal) - } - - //update subscriptions - if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions().onComplete { - if (it.succeeded()) { - launch(vertx.dispatcher()) { - val sourceMark = SourceMarker.getSourceMark( - portal.viewingArtifact, SourceMark.Type.GUTTER - ) ?: return@launch - val endpointName = sourceMark.getUserData( - ENDPOINT_DETECTOR - )?.getOrFindEndpointName(sourceMark) ?: return@launch - - Instance.liveView!!.addLiveViewSubscription( - LiveViewSubscription( - null, - listOf(endpointName), - portal.viewingArtifact, - LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) - ) - ).onComplete { - if (it.failed()) { - log.error("Failed to add live view subscription", it.cause()) - } - } - } - } else { - log.error("Failed to clear live view subscriptions", it.cause()) - } - } - } - } - vertx.eventBus().consumer(RefreshTraces) { - val portal = it.body() - //pull from skywalking - launch(vertx.dispatcher()) { - pullLatestTraces(it.body()) - } - - //update subscriptions - if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions().onComplete { - if (it.succeeded()) { - launch(vertx.dispatcher()) { - val sourceMark = SourceMarker.getSourceMark( - portal.viewingArtifact, SourceMark.Type.GUTTER - ) ?: return@launch - val endpointName = sourceMark.getUserData( - ENDPOINT_DETECTOR - )?.getOrFindEndpointName(sourceMark) ?: return@launch - - Instance.liveView!!.addLiveViewSubscription( - LiveViewSubscription( - null, - listOf(endpointName), - portal.viewingArtifact, - LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig("TRACES", listOf("endpoint_traces")) - ) - ).onComplete { - if (it.failed()) { - log.error("Failed to add live view subscription", it.cause()) - } - } - } - } else { - log.error("Failed to clear live view subscriptions", it.cause()) - } - } - } - } - vertx.eventBus().consumer(RefreshLogs) { - val portal = it.body() - //pull from skywalking - launch(vertx.dispatcher()) { - pullLatestLogs(portal) - } - - //update subscriptions - if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions().onComplete { - if (it.succeeded()) { - launch(vertx.dispatcher()) { - val sourceMark = SourceMarker.getSourceMark( - portal.viewingArtifact, SourceMark.Type.GUTTER - ) - - val logPatterns = if (sourceMark is ClassSourceMark) { - sourceMark.sourceFileMarker.getSourceMarks().filterIsInstance() - .flatMap { - it.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! - .getOrFindLoggerStatements(it) - }.map { it.logPattern } - } else if (sourceMark is MethodSourceMark) { - sourceMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! - .getOrFindLoggerStatements(sourceMark).map { it.logPattern } - } else { - throw IllegalStateException("Unsupported source mark type") - } - - Instance.liveView!!.addLiveViewSubscription( - LiveViewSubscription( - null, - logPatterns, - portal.viewingArtifact, - LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig("LOGS", listOf("endpoint_logs")) - ) - ).onComplete { - if (it.failed()) { - log.error("Failed to add live view subscription", it.cause()) - } - } - } - } else { - log.error("Failed to clear live view subscriptions", it.cause()) - } - } - } - } - vertx.eventBus().consumer(QueryTraceStack) { handler -> - val traceId = handler.body() - launch(vertx.dispatcher()) { - handler.reply(EndpointTracesBridge.getTraceStack(traceId, vertx)) - } - } - vertx.eventBus().consumer(ClickedStackTraceElement) { handler -> - val message = handler.body() - val portalUuid = message.getString("portalUuid") - val portal = SourcePortal.getPortal(portalUuid)!! - if (!portal.configuration.external) vertx.eventBus().send(ClosePortal, portal) - - val element = Json.decodeValue( - message.getJsonObject("stackTraceElement").toString(), - LiveStackTraceElement::class.java - ) - log.info("Clicked stack trace element: $element") - - val project = ProjectManager.getInstance().openProjects[0] - ArtifactNavigator.navigateTo(project, element) - } - vertx.eventBus().consumer(CanNavigateToArtifact) { - val artifactQualifiedName = it.body() - val project = ProjectManager.getInstance().openProjects[0] - launch(vertx.dispatcher()) { - it.reply(ArtifactNavigator.canNavigateTo(project, artifactQualifiedName)) - } - } - vertx.eventBus().consumer(NavigateToArtifact) { msg -> - launch(vertx.dispatcher()) { - ArtifactNavigator.navigateTo(vertx, msg.body()) { - if (it.succeeded()) { - log.info("Navigated to artifact $it") - msg.reply(it.result()) - } else { - log.error("Failed to navigate to artifact", it.cause()) - msg.fail(500, it.cause().message) - } - } - } - } - } - - private suspend fun pullLatestTraces(portal: SourcePortal) { - val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) - if (sourceMark != null && sourceMark is MethodSourceMark) { - val endpointId = sourceMark.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(sourceMark) - if (endpointId != null) { - launch(vertx.dispatcher()) { - val traceResult = EndpointTracesBridge.getTraces( - GetEndpointTraces( - artifactQualifiedName = portal.viewingArtifact, - endpointId = endpointId, - zonedDuration = ZonedDuration( - ZonedDateTime.now().minusHours(24), - ZonedDateTime.now(), - SkywalkingClient.DurationStep.MINUTE - ), - orderType = portal.tracesView.orderType, - pageSize = portal.tracesView.viewTraceAmount, - pageNumber = portal.tracesView.pageNumber - ), vertx - ) - - handleTraceResult(traceResult, portal, portal.viewingArtifact) - } - } - } - } - - private fun handleTraceResult( - traceResult: TraceResult, - portal: SourcePortal, - artifactQualifiedName: ArtifactQualifiedName - ) { - //todo: rename {GET} to [GET] in skywalking - if (markerConfig.autoResolveEndpointNames) { - launch(vertx.dispatcher()) { - //todo: only try to auto resolve endpoint names with dynamic ids - //todo: support multiple operationsNames/traceIds - traceResult.traces.forEach { - if (!portal.tracesView.resolvedEndpointNames.containsKey(it.traceIds[0])) { - val traceStack = EndpointTracesBridge.getTraceStack(it.traceIds[0], vertx) - val entrySpan: TraceSpan? = traceStack.traceSpans.firstOrNull { it.type == "Entry" } - if (entrySpan != null) { - val url = entrySpan.tags["url"] - val httpMethod = entrySpan.tags["http.method"] - if (url != null && httpMethod != null) { - val updatedEndpointName = "{$httpMethod}${URI(url).path}" - vertx.eventBus().send( - TraceSpanUpdated, entrySpan.copy( - endpointName = updatedEndpointName, - artifactQualifiedName = artifactQualifiedName - ) - ) - } - } - } - } - } - } - vertx.eventBus().send(ArtifactTracesUpdated, traceResult) - } - - private suspend fun pullLatestLogs(portal: SourcePortal) { - if (log.isTraceEnabled) log.trace("Refreshing logs. Portal: {}", portal.portalUuid) - val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) - launch(vertx.dispatcher()) { - val logsResult = LogsBridge.queryLogs( - GetEndpointLogs( - endpointId = if (sourceMark is MethodSourceMark) { - sourceMark.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(sourceMark) - } else null, - zonedDuration = ZonedDuration( - ZonedDateTime.now().minusMinutes(15), //todo: method filtering in skywalking - ZonedDateTime.now(), - SkywalkingClient.DurationStep.MINUTE - ), - orderType = portal.logsView.orderType, - pageSize = portal.logsView.viewLogAmount * 25, //todo: method filtering in skywalking - pageNumber = portal.logsView.pageNumber - ), vertx - ) - if (logsResult.succeeded()) { - //todo: impl method filtering in skywalking - for ((content, logs) in logsResult.result().logs.groupBy { it.content }) { - SourceMarkSearch.findInheritedSourceMarks(content).forEach { - vertx.eventBus().send( - ArtifactLogUpdated, logsResult.result().copy( - artifactQualifiedName = it.artifactQualifiedName, - total = logs.size, - logs = logs, - ) - ) - } - } - } else { - val replyException = logsResult.cause() as ReplyException - if (replyException.failureCode() == 404) { - log.warn("Failed to fetch logs. Service(s) unavailable") - } else { - log.error("Failed to fetch logs", logsResult.cause()) - } - } - } - } - - private suspend fun refreshOverview(fileMarker: SourceFileMarker, portal: SourcePortal) { - val endpointMarks = fileMarker.getSourceMarks().filterIsInstance().filter { - it.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(it) != null - } - - val fetchMetricTypes = listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla") - val requestDuration = ZonedDuration( - ZonedDateTime.now().minusMinutes(portal.overviewView.timeFrame.minutes.toLong()), - ZonedDateTime.now(), - SkywalkingClient.DurationStep.MINUTE - ) - val endpointMetricResults = mutableListOf() - endpointMarks.forEach { - val metricsRequest = GetEndpointMetrics( - fetchMetricTypes, - it.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(it)!!, - requestDuration - ) - val metrics = EndpointMetricsBridge.getMetrics(metricsRequest, vertx) - val endpointName = it.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointName(it)!! - - val summarizedMetrics = mutableListOf() - for (i in metrics.indices) { - val avg = metrics[i].values.average() - val metricType = MetricType.realValueOf(fetchMetricTypes[i]) - summarizedMetrics.add(ArtifactSummarizedMetrics(metricType, avg)) - } - - endpointMetricResults.add( - ArtifactSummarizedResult( - it.artifactQualifiedName.copy(operationName = endpointName), - summarizedMetrics, - EndpointType.HTTP - ) - ) - } - - vertx.eventBus().send( - UpdateEndpoints(portal.portalUuid), - JsonObject( - Json.encode( - EndpointResult( - portal.overviewView.timeFrame, - start = Instant.fromEpochMilliseconds(requestDuration.start.toInstant().toEpochMilli()), - stop = Instant.fromEpochMilliseconds(requestDuration.stop.toInstant().toEpochMilli()), - step = requestDuration.step.name, - endpointMetricResults - ) - ) - ) - ) - } - - private suspend fun pullLatestActivity(portal: SourcePortal) { - val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) - if (sourceMark != null && sourceMark is MethodSourceMark) { - val endpointId = sourceMark.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(sourceMark) - if (endpointId != null) { - pullLatestActivity(portal, endpointId) - } - } - } - - private suspend fun pullLatestActivity(portal: SourcePortal, endpointId: String) { - val endTime = ZonedDateTime.now().plusMinutes(1).truncatedTo(ChronoUnit.MINUTES) - val startTime = endTime.minusMinutes(portal.activityView.timeFrame.minutes.toLong()) - val metricsRequest = GetEndpointMetrics( - listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla"), - endpointId, - ZonedDuration(startTime, endTime, SkywalkingClient.DurationStep.MINUTE) - ) - val metrics = EndpointMetricsBridge.getMetrics(metricsRequest, vertx) - val metricResult = toProtocol( - portal.viewingArtifact, - portal.activityView.timeFrame, - portal.activityView.activeChartMetric, - metricsRequest, - metrics - ) - - val finalArtifactMetrics = metricResult.artifactMetrics.toMutableList() - vertx.eventBus().send(ArtifactMetricsUpdated, metricResult.copy(artifactMetrics = finalArtifactMetrics)) - } - - private fun openPortal(portal: SourcePortal) { - val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) - if (sourceMark != null) { - configureDisplayedPortal(portal) - ApplicationManager.getApplication().invokeLater(sourceMark::displayPopup) - } - } - - private fun configureDisplayedPortal(portal: SourcePortal) { - val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) - if (sourceMark != null) { - val jcefComponent = sourceMark.sourceMarkComponent as SourceMarkJcefComponent - if (portal != lastDisplayedInternalPortal) { - portal.configuration.darkMode = UIManager.getLookAndFeel() !is IntelliJLaf - - val externalEndpoint = sourceMark.getUserData(ENDPOINT_DETECTOR)?.isExternalEndpoint(sourceMark) == true - if (externalEndpoint) { - portal.configuration.visibleActivity = true - portal.configuration.visibleTraces = true - portal.configuration.visibleLogs = true //todo: can hide based on if there is logs - } else { - //non-endpoint artifact; hide activity/traces till manually shown - portal.configuration.visibleActivity = false - portal.configuration.visibleTraces = portal.tracesView.innerTraceStack - - //default to logs if method - if (sourceMark is MethodSourceMark && !portal.configuration.visibleTraces) { - portal.configuration.currentPage = PageType.LOGS - } - - //hide overview if class and no child endpoints and default to logs - if (sourceMark is ClassSourceMark) { - val hasChildEndpoints = sourceMark.sourceFileMarker.getSourceMarks().firstOrNull { - it.getUserData(ENDPOINT_DETECTOR)?.getEndpointId(it) != null - } != null - portal.configuration.visibleOverview = hasChildEndpoints - if (!hasChildEndpoints) { - portal.configuration.currentPage = PageType.LOGS - } - } - } - - val port = vertx.sharedData().getLocalMap("portal")["http.port"]!! - val host = "http://localhost:$port" - val currentUrl = "$host/?portalUuid=${portal.portalUuid}" - - if (lastDisplayedInternalPortal == null) { - jcefComponent.configuration.initialUrl = currentUrl - } else { - jcefComponent.getBrowser().cefBrowser.executeJavaScript( - "window.location.href = '$currentUrl';", currentUrl, 0 - ) - } - lastDisplayedInternalPortal = portal - } - } - } - - private fun closePortal(portal: SourcePortal) { - val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) - if (sourceMark != null) { - ApplicationManager.getApplication().invokeLater(sourceMark::closePopup) - } - } -} From 824aa0cc0b1b76292d2c47fbf7eba4992a3658f0 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 12:53:31 +0100 Subject: [PATCH 072/115] skywalking reroute --- .../spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt | 7 +++++++ .../spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt index 0441cd752..ed7242893 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt @@ -61,6 +61,13 @@ class SkywalkingMonitor( private suspend fun setup() { log.debug("Apache SkyWalking server: $serverUrl") val httpBuilder = OkHttpClient().newBuilder() + .addInterceptor { chain -> + chain.proceed( + chain.request().newBuilder() + .addHeader("spp-skywalking-reroute", "true") + .build() + ) + } .hostnameVerifier { _, _ -> true } if (!jwtToken.isNullOrEmpty()) { httpBuilder.addInterceptor { chain -> diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 67e3e6489..fb314dc9b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -519,8 +519,7 @@ object SourceMarkerPlugin { val scheme = if (config.isSsl()) "https" else "http" val skywalkingHost = "$scheme://${config.serviceHostNormalized}:" + - "${config.getServicePortNormalized(hardcodedConfig.getInteger("service_port"))}" + - "/graphql/skywalking" + "${config.getServicePortNormalized(hardcodedConfig.getInteger("service_port"))}/graphql" val certificatePins = mutableListOf() certificatePins.addAll(config.certificatePins) From f32be037228fff19450274a139726fa6d72fb892 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 14:12:29 +0100 Subject: [PATCH 073/115] bump --- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 6ed34f049..770ae9cdc 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") + compileOnly("com.github.sourceplusplus.protocol:protocol:22d08b05c5") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 4aaa44cad..a23e1ff21 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") + compileOnly("com.github.sourceplusplus.protocol:protocol:22d08b05c5") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 005753418..c53484045 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") + compileOnly("com.github.sourceplusplus.protocol:protocol:22d08b05c5") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index b81cb760d..0b2b52517 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") + implementation("com.github.sourceplusplus.protocol:protocol:22d08b05c5") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 2dda7ffca..e353aa20e 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4cd858772b") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:2bd4bea9ad") + implementation("com.github.sourceplusplus.protocol:protocol:22d08b05c5") } implementation("org.jooq:joor:$joorVersion") From 710134daeca3c8ad06f79dff6457605b0884f675 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 15:13:03 +0100 Subject: [PATCH 074/115] remove hardcoded config --- .../sourcemarker/SourceMarkerPlugin.kt | 117 +++++------------- .../discover/TCPServiceDiscoveryBackend.kt | 8 +- .../sourcemarker/reporting/error-report.kt | 16 +-- .../settings/SourceMarkerConfig.kt | 13 +- .../main/resources/plugin-configuration.json | 12 -- 5 files changed, 43 insertions(+), 123 deletions(-) delete mode 100644 plugin/src/main/resources/plugin-configuration.json diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index fb314dc9b..53c44a174 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -27,8 +27,6 @@ import com.fasterxml.jackson.datatype.guava.GuavaModule import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.KotlinModule -import com.google.common.base.Charsets -import com.google.common.io.Resources import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer import com.intellij.ide.util.PropertiesComponent import com.intellij.notification.Notification @@ -113,7 +111,6 @@ import spp.protocol.service.LiveService import spp.protocol.service.LiveViewService import java.awt.Dimension import java.io.File -import java.io.IOException /** * Sets up the SourceMarker plugin by configuring and initializing the various plugin modules. @@ -311,16 +308,6 @@ object SourceMarkerPlugin { } private suspend fun discoverAvailableServices(config: SourceMarkerConfig, project: Project) { - val hardcodedConfig: JsonObject = try { - JsonObject( - Resources.toString( - Resources.getResource(javaClass, "/plugin-configuration.json"), Charsets.UTF_8 - ) - ) - } catch (e: IOException) { - throw RuntimeException(e) - } - val discovery: ServiceDiscovery val originalClassLoader = Thread.currentThread().contextClassLoader try { @@ -330,7 +317,6 @@ object SourceMarkerPlugin { ServiceDiscoveryOptions().setBackendConfiguration( JsonObject() .put("backend-name", "tcp-service-discovery") - .put("hardcoded_config", hardcodedConfig) .put("sourcemarker_plugin_config", JsonObject.mapFrom(config)) ) ) @@ -354,47 +340,39 @@ object SourceMarkerPlugin { } //live instrument - if (hardcodedConfig.getJsonObject("services").getBoolean("live_instrument")) { - if (availableRecords.any { it.name == SourceServices.Utilize.LIVE_INSTRUMENT }) { - log.info("Live instruments available") - SourceMarker.addGlobalSourceMarkEventListener(LiveStatusManager) - - Instance.liveInstrument = ServiceProxyBuilder(vertx) - .apply { config.serviceToken?.let { setToken(it) } } - .setAddress(SourceServices.Utilize.LIVE_INSTRUMENT) - .build(LiveInstrumentService::class.java) - ApplicationManager.getApplication().invokeLater { - BreakpointHitWindowService.getInstance(project).showEventsWindow() - } - val breakpointListener = LiveInstrumentManager(project, config) - GlobalScope.launch(vertx.dispatcher()) { - deploymentIds.add(vertx.deployVerticle(breakpointListener).await()) - } - } else { - log.warn("Live instruments unavailable") + if (availableRecords.any { it.name == SourceServices.Utilize.LIVE_INSTRUMENT }) { + log.info("Live instruments available") + SourceMarker.addGlobalSourceMarkEventListener(LiveStatusManager) + + Instance.liveInstrument = ServiceProxyBuilder(vertx) + .apply { config.serviceToken?.let { setToken(it) } } + .setAddress(SourceServices.Utilize.LIVE_INSTRUMENT) + .build(LiveInstrumentService::class.java) + ApplicationManager.getApplication().invokeLater { + BreakpointHitWindowService.getInstance(project).showEventsWindow() + } + val breakpointListener = LiveInstrumentManager(project, config) + GlobalScope.launch(vertx.dispatcher()) { + deploymentIds.add(vertx.deployVerticle(breakpointListener).await()) } } else { - log.info("Live instruments disabled") + log.warn("Live instruments unavailable") } //live view - if (hardcodedConfig.getJsonObject("services").getBoolean("live_view")) { - if (availableRecords.any { it.name == SourceServices.Utilize.LIVE_VIEW }) { - log.info("Live views available") - Instance.liveView = ServiceProxyBuilder(vertx) - .apply { config.serviceToken?.let { setToken(it) } } - .setAddress(SourceServices.Utilize.LIVE_VIEW) - .build(LiveViewService::class.java) - - val viewListener = LiveViewManager(config) - GlobalScope.launch(vertx.dispatcher()) { - deploymentIds.add(vertx.deployVerticle(viewListener).await()) - } - } else { - log.warn("Live views unavailable") + if (availableRecords.any { it.name == SourceServices.Utilize.LIVE_VIEW }) { + log.info("Live views available") + Instance.liveView = ServiceProxyBuilder(vertx) + .apply { config.serviceToken?.let { setToken(it) } } + .setAddress(SourceServices.Utilize.LIVE_VIEW) + .build(LiveViewService::class.java) + + val viewListener = LiveViewManager(config) + GlobalScope.launch(vertx.dispatcher()) { + deploymentIds.add(vertx.deployVerticle(viewListener).await()) } } else { - log.info("Live views disabled") + log.warn("Live views unavailable") } } @@ -417,24 +395,10 @@ object SourceMarkerPlugin { } private suspend fun initServices(project: Project, config: SourceMarkerConfig) { - val hardcodedConfig: JsonObject = try { - JsonObject( - Resources.toString( - Resources.getResource(javaClass, "/plugin-configuration.json"), Charsets.UTF_8 - ) - ) - } catch (e: IOException) { - throw RuntimeException(e) - } - if (!config.serviceHost.isNullOrBlank()) { - val servicePort = config.getServicePortNormalized(hardcodedConfig.getInteger("service_port"))!! + val servicePort = config.getServicePortNormalized()!! val certificatePins = mutableListOf() certificatePins.addAll(config.certificatePins) - val hardcodedPin = hardcodedConfig.getString("certificate_pin") - if (!hardcodedPin.isNullOrBlank()) { - certificatePins.add(hardcodedPin) - } val httpClientOptions = if (certificatePins.isNotEmpty()) { HttpClientOptions() .setTrustOptions( @@ -453,7 +417,7 @@ object SourceMarkerPlugin { } } - val tokenUri = hardcodedConfig.getString("token_uri") + "?access_token=" + config.accessToken + val tokenUri = "/api/new-token?access_token=" + config.accessToken val req = vertx.createHttpClient(httpClientOptions).request( RequestOptions() .setSsl(config.isSsl()) @@ -474,12 +438,12 @@ object SourceMarkerPlugin { } else { //try default local access val defaultAccessToken = "change-me" - val tokenUri = hardcodedConfig.getString("token_uri") + "?access_token=$defaultAccessToken" + val tokenUri = "/api/new-token?access_token=$defaultAccessToken" val req = vertx.createHttpClient(HttpClientOptions().setSsl(true).setVerifyHost(false).setTrustAll(true)) .request( RequestOptions() .setHost("localhost") - .setPort(hardcodedConfig.getInteger("service_port")) + .setPort(SourceMarkerConfig.DEFAULT_SERVICE_PORT) .setURI(tokenUri) ).await() req.end().await() @@ -487,7 +451,7 @@ object SourceMarkerPlugin { if (resp.statusCode() in 200..299) { val body = resp.body().await().toString() config.serviceToken = body - config.serviceHost = "https://localhost:" + hardcodedConfig.getInteger("service_port") + config.serviceHost = "https://localhost:" + SourceMarkerConfig.DEFAULT_SERVICE_PORT config.accessToken = defaultAccessToken config.verifyHost = false @@ -507,27 +471,10 @@ object SourceMarkerPlugin { } private suspend fun initMonitor(config: SourceMarkerConfig) { - val hardcodedConfig: JsonObject = try { - JsonObject( - Resources.toString( - Resources.getResource(javaClass, "/plugin-configuration.json"), Charsets.UTF_8 - ) - ) - } catch (e: IOException) { - throw RuntimeException(e) - } - val scheme = if (config.isSsl()) "https" else "http" - val skywalkingHost = "$scheme://${config.serviceHostNormalized}:" + - "${config.getServicePortNormalized(hardcodedConfig.getInteger("service_port"))}/graphql" - + val skywalkingHost = "$scheme://${config.serviceHostNormalized}:${config.getServicePortNormalized()}/graphql" val certificatePins = mutableListOf() certificatePins.addAll(config.certificatePins) - val hardcodedPin = hardcodedConfig.getString("certificate_pin") - if (!hardcodedPin.isNullOrBlank()) { - certificatePins.add(hardcodedPin) - } - deploymentIds.add( vertx.deployVerticle( SkywalkingMonitor( diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt index 91ace2a07..f3aaeecbb 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt @@ -75,14 +75,8 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { ) val serviceHost = pluginConfig.serviceHostNormalized!! - val hardcodedConfig = config.getJsonObject("hardcoded_config") - val servicePort = hardcodedConfig.getInteger("tcp_service_port") val certificatePins = mutableListOf() certificatePins.addAll(pluginConfig.certificatePins) - val hardcodedPin = hardcodedConfig.getString("certificate_pin") - if (!hardcodedPin.isNullOrBlank()) { - certificatePins.add(hardcodedPin) - } GlobalScope.launch(vertx.dispatcher()) { try { @@ -109,7 +103,7 @@ class TCPServiceDiscoveryBackend : ServiceDiscoveryBackend { } vertx.createNetClient(options) } - socket = client.connect(servicePort, serviceHost).await() + socket = client.connect(SourceMarkerConfig.DEFAULT_TCP_SERVICE_PORT, serviceHost).await() } catch (ex: Exception) { log.error("Failed to connect to service discovery server", ex) setupPromise.fail(ex) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt index 6e3e4309c..d7b1ce88f 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt @@ -17,8 +17,6 @@ */ package spp.jetbrains.sourcemarker.reporting -import com.google.common.base.Charsets -import com.google.common.io.Resources import com.intellij.diagnostic.AbstractMessage import com.intellij.diagnostic.LogMessage import com.intellij.diagnostic.ReportMessages @@ -45,7 +43,6 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.SystemInfo import com.intellij.util.Consumer import com.intellij.util.io.decodeBase64 -import io.vertx.core.json.JsonObject import org.eclipse.egit.github.core.Issue import org.eclipse.egit.github.core.Label import org.eclipse.egit.github.core.RepositoryId @@ -53,9 +50,7 @@ import org.eclipse.egit.github.core.client.GitHubClient import org.eclipse.egit.github.core.service.IssueService import org.slf4j.LoggerFactory import spp.jetbrains.sourcemarker.PluginBundle -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import java.awt.Component -import java.io.IOException import java.io.PrintWriter import java.io.StringWriter import java.util.* @@ -268,17 +263,8 @@ private fun getKeyValuePairs( appInfo: ApplicationInfoEx, namesInfo: ApplicationNamesInfo ): MutableMap { - val hardcodedConfig: JsonObject = try { - JsonObject( - Resources.toString( - Resources.getResource(SourceMarkerPlugin::class.java, "/plugin-configuration.json"), Charsets.UTF_8 - ) - ) - } catch (e: IOException) { - throw RuntimeException(e) - } PluginManagerCore.getPlugin( - PluginId.findId(hardcodedConfig.getString("plugin_id"), hardcodedConfig.getString("plugin_id")) + PluginId.findId("com.sourceplusplus.plugin.intellij") )?.run { if (error.pluginName.isBlank()) error.pluginName = name if (error.pluginVersion.isBlank()) error.pluginVersion = version diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/settings/SourceMarkerConfig.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/settings/SourceMarkerConfig.kt index ea652b60b..0327ddd19 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/settings/SourceMarkerConfig.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/settings/SourceMarkerConfig.kt @@ -34,7 +34,12 @@ data class SourceMarkerConfig( var serviceToken: String? = null, var verifyHost: Boolean = true, val serviceName: String? = null -) +) { + companion object { + const val DEFAULT_SERVICE_PORT = 5445 + const val DEFAULT_TCP_SERVICE_PORT = 5455 + } +} val SourceMarkerConfig.serviceHostNormalized: String? get() { @@ -48,15 +53,15 @@ val SourceMarkerConfig.serviceHostNormalized: String? return serviceHost } -fun SourceMarkerConfig.getServicePortNormalized(defaultServicePort: Int?): Int? { +fun SourceMarkerConfig.getServicePortNormalized(): Int? { if (serviceHost == null) return null val hostStr = serviceHost!!.substringAfter("https://").substringAfter("http://") if (hostStr.contains(":")) { return hostStr.split(":")[1].toInt() } - return defaultServicePort + return SourceMarkerConfig.DEFAULT_SERVICE_PORT } fun SourceMarkerConfig.isSsl(): Boolean { - return getServicePortNormalized(null) == 443 || serviceHost?.startsWith("https://") == true + return getServicePortNormalized() == 443 || serviceHost?.startsWith("https://") == true } diff --git a/plugin/src/main/resources/plugin-configuration.json b/plugin/src/main/resources/plugin-configuration.json deleted file mode 100644 index 6e8893a69..000000000 --- a/plugin/src/main/resources/plugin-configuration.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "plugin_name": "Source++", - "plugin_id": "com.sourceplusplus.plugin.intellij", - "token_uri": "/api/new-token", - "certificate_pin": null, - "service_port": 5445, - "tcp_service_port": 5455, - "services": { - "live_instrument": true, - "live_view": true - } -} \ No newline at end of file From 198611f1b2a634738b2201edfbe1d53b080453f4 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 20:08:10 +0100 Subject: [PATCH 075/115] view event listener merged instrument id source keys --- .../status/BreakpointStatusBar.java | 2 +- .../sourcemarker/status/LogStatusBar.java | 71 ++++--- .../sourcemarker/mark/SourceMarkKeys.kt | 9 +- .../sourcemarker/search/SourceMarkSearch.kt | 22 +- .../service/LiveInstrumentManager.kt | 39 +--- .../sourcemarker/service/LiveViewManager.kt | 193 +----------------- .../sourcemarker/service/ViewEventListener.kt | 30 +++ .../sourcemarker/status/LiveStatusManager.kt | 38 ++-- 8 files changed, 121 insertions(+), 283 deletions(-) create mode 100644 plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/ViewEventListener.kt diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index 5fa2718e1..54e4bf355 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -453,7 +453,7 @@ private void saveLiveBreakpoint() { INSTANCE.getLiveInstrument().addLiveInstrument(instrument).onComplete(it -> { if (it.succeeded()) { liveBreakpoint = (LiveBreakpoint) it.result(); - inlayMark.putUserData(SourceMarkKeys.INSTANCE.getBREAKPOINT_ID(), liveBreakpoint.getId()); + inlayMark.putUserData(SourceMarkKeys.INSTANCE.getINSTRUMENT_ID(), liveBreakpoint.getId()); LiveStatusManager.INSTANCE.addActiveLiveInstrument(liveBreakpoint); } else { it.cause().printStackTrace(); diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index 400054036..fb0f8f098 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -12,22 +12,23 @@ import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; -import io.vertx.core.json.JsonObject; +import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import net.miginfocom.swing.MigLayout; import org.jetbrains.annotations.NotNull; import spp.jetbrains.marker.source.mark.inlay.InlayMark; import spp.jetbrains.sourcemarker.PluginIcons; import spp.jetbrains.sourcemarker.PluginUI; -import spp.jetbrains.sourcemarker.SourceMarkerPlugin; import spp.jetbrains.sourcemarker.command.AutocompleteFieldRow; import spp.jetbrains.sourcemarker.mark.SourceMarkKeys; import spp.jetbrains.sourcemarker.service.InstrumentEventListener; +import spp.jetbrains.sourcemarker.service.ViewEventListener; import spp.jetbrains.sourcemarker.service.log.LogHitColumnInfo; import spp.jetbrains.sourcemarker.service.log.VariableParser; import spp.jetbrains.sourcemarker.settings.LiveLogConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.artifact.log.Log; +import spp.protocol.artifact.log.LogOrderType; import spp.protocol.artifact.log.LogResult; import spp.protocol.instrument.LiveInstrument; import spp.protocol.instrument.LiveLog; @@ -37,6 +38,7 @@ import spp.protocol.instrument.event.LiveLogHit; import spp.protocol.instrument.throttle.InstrumentThrottle; import spp.protocol.instrument.throttle.ThrottleStep; +import spp.protocol.view.LiveViewEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -50,6 +52,7 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.concurrent.atomic.AtomicLong; @@ -61,13 +64,13 @@ import static spp.jetbrains.marker.SourceMarker.conditionParser; import static spp.jetbrains.sourcemarker.PluginUI.*; import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; -import static spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactLogUpdated; -import static spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved; import static spp.protocol.SourceServices.Instance.INSTANCE; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_HIT; import static spp.protocol.instrument.event.LiveInstrumentEventType.LOG_REMOVED; +import static spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved; -public class LogStatusBar extends JPanel implements StatusBar, VisibleAreaListener, InstrumentEventListener { +public class LogStatusBar extends JPanel implements StatusBar, VisibleAreaListener, + InstrumentEventListener, ViewEventListener { private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("hh:mm:ss a") .withZone(ZoneId.systemDefault()); @@ -152,33 +155,15 @@ public Icon getIcon() { setupComponents(); if (watchExpression) { + LiveStatusManager.addViewEventListener(inlayMark, this); liveLogTextField.setCanShowSaveButton(false); liveLogTextField.setEditMode(false); removeActiveDecorations(); configDropdownLabel.setVisible(false); displayTimeField(); addExpandButton(); - - SourceMarkerPlugin.INSTANCE.getVertx().eventBus().consumer(ArtifactLogUpdated, event -> { - LogResult logResult = (LogResult) event.body(); - if (!inlayMark.getArtifactQualifiedName().equals(logResult.getArtifactQualifiedName())) { - return; - } - Log latestLog = logResult.getLogs().get(0); - setLatestLog(Instant.now(), latestLog); - - JsonObject logJson = JsonObject.mapFrom(new LiveLogHit( //todo: real hit info - "-1", latestLog.getTimestamp(), "null", "null", logResult - )); - logJson.getJsonObject("logResult").getJsonArray("logs").forEach(it -> { - JsonObject log = (JsonObject) it; - log.remove("formattedMessage"); - }); - - LiveInstrumentEvent liveInstrumentEvent = new LiveInstrumentEvent(LOG_HIT, logJson.toString()); - commandModel.insertRow(0, liveInstrumentEvent); - }); } else { + LiveStatusManager.addStatusBar(inlayMark, this); showEditableMode(); liveLogTextField.setEditMode(true); liveLogTextField.addSaveListener(this::saveLiveLog); @@ -194,7 +179,6 @@ public void setLiveInstrument(LiveInstrument liveInstrument) { displayTimeField(); addExpandButton(); repaint(); - LiveStatusManager.INSTANCE.addStatusBar(inlayMark, this); } public void setWrapperPanel(JPanel wrapperPanel) { @@ -264,6 +248,13 @@ private void displayTimeField() { public void accept(@NotNull LiveInstrumentEvent event) { if (event.getEventType() == LOG_HIT) { commandModel.insertRow(0, event); + + LiveLogHit logHit = Json.decodeValue(event.getData(), LiveLogHit.class); + //LiveLogHit logHit = ProtocolMarshaller.deserializeLiveLogHit(new JsonObject(event.getData())); + setLatestLog( + Instant.ofEpochMilli(logHit.getLogResult().getTimestamp().toEpochMilliseconds()), + logHit.getLogResult().getLogs().get(0) + ); } else if (event.getEventType() == LOG_REMOVED) { removed = true; @@ -284,6 +275,32 @@ public void accept(@NotNull LiveInstrumentEvent event) { } } + @Override + public void accept(@NotNull LiveViewEvent event) { + JsonObject rawMetrics = new JsonObject(event.getMetricsData()); + Log logData = Json.decodeValue(rawMetrics.getJsonObject("log").toString(), Log.class); + LogResult logResult = new LogResult( + event.getArtifactQualifiedName(), + LogOrderType.NEWEST_LOGS, + logData.getTimestamp(), + Collections.singletonList(logData), + Integer.MAX_VALUE + ); + Log latestLog = logResult.getLogs().get(0); + setLatestLog(Instant.now(), latestLog); + + JsonObject logJson = JsonObject.mapFrom(new LiveLogHit( //todo: real hit info + "-1", latestLog.getTimestamp(), "null", "null", logResult + )); + logJson.getJsonObject("logResult").getJsonArray("logs").forEach(it -> { + JsonObject log = (JsonObject) it; + log.remove("formattedMessage"); + }); + + LiveInstrumentEvent liveInstrumentEvent = new LiveInstrumentEvent(LOG_HIT, logJson.toString()); + commandModel.insertRow(0, liveInstrumentEvent); + } + private void addExpandButton() { if (expandLabel != null) { remove(expandLabel); @@ -636,7 +653,7 @@ private void saveLiveLog() { INSTANCE.getLiveInstrument().addLiveInstrument(instrument).onComplete(it -> { if (it.succeeded()) { liveLog = (LiveLog) it.result(); - inlayMark.putUserData(SourceMarkKeys.INSTANCE.getLOG_ID(), it.result().getId()); + inlayMark.putUserData(SourceMarkKeys.INSTANCE.getINSTRUMENT_ID(), it.result().getId()); LiveStatusManager.INSTANCE.addActiveLiveInstrument(liveLog); inlayMark.getUserData(SourceMarkKeys.INSTANCE.getLOGGER_DETECTOR()) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt index b1df1a0b5..c93c6f75a 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt @@ -19,10 +19,11 @@ package spp.jetbrains.sourcemarker.mark import spp.jetbrains.marker.jvm.psi.EndpointDetector import spp.jetbrains.marker.jvm.psi.LoggerDetector +import spp.jetbrains.marker.portal.SourcePortal import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.key.SourceKey -import spp.jetbrains.portal.SourcePortal import spp.jetbrains.sourcemarker.service.InstrumentEventListener +import spp.jetbrains.sourcemarker.service.ViewEventListener import spp.jetbrains.sourcemarker.status.StatusBar /** @@ -35,10 +36,10 @@ object SourceMarkKeys { val SOURCE_PORTAL = SourceKey("SOURCE_PORTAL") val ENDPOINT_DETECTOR = SourceKey("ENDPOINT_DETECTOR") val LOGGER_DETECTOR = SourceKey("LOGGER_DETECTOR") - val BREAKPOINT_ID = SourceKey("BREAKPOINT_ID") - val LOG_ID = SourceKey("LOG_ID") - val METER_ID = SourceKey("METER_ID") + val INSTRUMENT_ID = SourceKey("INSTRUMENT_ID") + val VIEW_SUBSCRIPTION_ID = SourceKey("VIEW_SUBSCRIPTION_ID") val GROUPED_MARKS = SourceKey>("GROUPED_MARKS") val INSTRUMENT_EVENT_LISTENERS = SourceKey>("INSTRUMENT_EVENT_LISTENERS") + val VIEW_EVENT_LISTENERS = SourceKey>("VIEW_EVENT_LISTENERS") val STATUS_BAR = SourceKey("STATUS_BAR") } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt index 48f94aab8..00886ddad 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt @@ -34,19 +34,21 @@ import spp.protocol.artifact.ArtifactType object SourceMarkSearch { fun findByEndpointName(endpointName: String): SourceMark? { - return SourceMarker.getSourceMarks() - .firstOrNull { - it.getUserData(SourceMarkKeys.ENDPOINT_DETECTOR)?.getEndpointName(it) == endpointName - } + return SourceMarker.getSourceMarks().firstOrNull { + it.getUserData(SourceMarkKeys.ENDPOINT_DETECTOR)?.getEndpointName(it) == endpointName + } } fun findByInstrumentId(instrumentId: String): SourceMark? { - return SourceMarker.getSourceMarks() - .firstOrNull { - it.getUserData(SourceMarkKeys.BREAKPOINT_ID) == instrumentId - || it.getUserData(SourceMarkKeys.LOG_ID) == instrumentId - || it.getUserData(SourceMarkKeys.METER_ID) == instrumentId - } + return SourceMarker.getSourceMarks().firstOrNull { + it.getUserData(SourceMarkKeys.INSTRUMENT_ID) == instrumentId + } + } + + fun findBySubscriptionId(subscriptionId: String): SourceMark? { + return SourceMarker.getSourceMarks().firstOrNull { + it.getUserData(SourceMarkKeys.VIEW_SUBSCRIPTION_ID) == subscriptionId + } } suspend fun findSourceMark(artifact: ArtifactQualifiedName): SourceMark? { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index de0dc2dcb..609679567 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -36,7 +36,6 @@ import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.status.LiveStatusManager -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactLogUpdated import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide.toLiveInstrumentSubscriberAddress import spp.protocol.instrument.LiveBreakpoint @@ -117,7 +116,7 @@ class LiveInstrumentManager( if (fileMarker != null) { val smId = logAdded.meta["original_source_mark"] as String? ?: return@invokeLater val inlayMark = SourceMarker.getSourceMark(smId) ?: return@invokeLater - inlayMark.putUserData(SourceMarkKeys.LOG_ID, logAdded.id) + inlayMark.putUserData(SourceMarkKeys.INSTRUMENT_ID, logAdded.id) inlayMark.getUserData(SourceMarkKeys.STATUS_BAR)!!.setLiveInstrument(logAdded) } else { LiveStatusManager.addActiveLiveInstrument(logAdded) @@ -132,7 +131,7 @@ class LiveInstrumentManager( if (fileMarker != null) { val smId = bpAdded.meta["original_source_mark"] as String? ?: return@invokeLater val inlayMark = SourceMarker.getSourceMark(smId) ?: return@invokeLater - inlayMark.putUserData(SourceMarkKeys.BREAKPOINT_ID, bpAdded.id) + inlayMark.putUserData(SourceMarkKeys.INSTRUMENT_ID, bpAdded.id) inlayMark.getUserData(SourceMarkKeys.STATUS_BAR)!!.setLiveInstrument(bpAdded) } } @@ -152,18 +151,18 @@ class LiveInstrumentManager( } private fun handleBreakpointHitEvent(liveEvent: LiveInstrumentEvent) { + if (!SourceMarker.enabled) { + log.debug("SourceMarker disabled. Ignored breakpoint hit") + return + } + val bpHit = ProtocolMarshaller.deserializeLiveBreakpointHit(JsonObject(liveEvent.data)) ApplicationManager.getApplication().invokeLater { val project = ProjectManager.getInstance().openProjects[0] BreakpointHitWindowService.getInstance(project).addBreakpointHit(bpHit) - val inlayMark = SourceMarkSearch.findByInstrumentId(bpHit.breakpointId) - if (inlayMark != null) { - val eventListeners = inlayMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) - if (eventListeners?.isNotEmpty() == true) { - eventListeners.forEach { it.accept(liveEvent) } - } - } + SourceMarkSearch.findByInstrumentId(bpHit.breakpointId) + ?.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS)?.forEach { it.accept(liveEvent) } } } @@ -173,24 +172,8 @@ class LiveInstrumentManager( return } - //todo: can get log hit without log added (race) try open val logHit = Json.decodeValue(liveEvent.data, LiveLogHit::class.java) - ApplicationManager.getApplication().invokeLater { - val inlayMark = SourceMarkSearch.findByInstrumentId(logHit.logId) - if (inlayMark != null) { - val eventListeners = inlayMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) - if (eventListeners?.isNotEmpty() == true) { - eventListeners.forEach { it.accept(liveEvent) } - } - - SourceMarkSearch.findInheritedSourceMarks(inlayMark).forEach { - val portal = it.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - vertx.eventBus().send( - ArtifactLogUpdated, - logHit.logResult.copy(artifactQualifiedName = portal.viewingArtifact) - ) - } - } - } + SourceMarkSearch.findByInstrumentId(logHit.logId) + ?.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS)?.forEach { it.accept(liveEvent) } } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index 25fbf3881..18bd150f3 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -18,59 +18,24 @@ package spp.jetbrains.sourcemarker.service import io.vertx.core.json.Json -import io.vertx.core.json.JsonArray import io.vertx.core.json.JsonObject import io.vertx.ext.auth.impl.jose.JWT import io.vertx.ext.bridge.BridgeEventType import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper import io.vertx.kotlin.coroutines.CoroutineVerticle -import io.vertx.kotlin.coroutines.dispatcher -import kotlinx.coroutines.launch -import kotlinx.datetime.toJavaInstant -import kotlinx.datetime.toKotlinInstant import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.marker.source.mark.api.SourceMark -import spp.jetbrains.portal.SourcePortal import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.search.SourceMarkSearch import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.jetbrains.portal.protocol.ProtocolAddress -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactTracesUpdated -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.TraceSpanUpdated import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress -import spp.protocol.artifact.ArtifactType -import spp.protocol.artifact.QueryTimeFrame -import spp.protocol.artifact.log.Log -import spp.protocol.artifact.log.LogOrderType -import spp.protocol.artifact.log.LogResult -import spp.protocol.artifact.metrics.ArtifactMetricResult -import spp.protocol.artifact.metrics.ArtifactMetrics -import spp.protocol.artifact.metrics.MetricType -import spp.protocol.artifact.trace.Trace -import spp.protocol.artifact.trace.TraceOrderType -import spp.protocol.artifact.trace.TraceResult -import spp.protocol.artifact.trace.TraceSpan -import spp.protocol.instrument.event.LiveInstrumentEvent -import spp.protocol.instrument.event.LiveInstrumentEventType.METER_UPDATED -import spp.protocol.instrument.meter.MeterType import spp.protocol.view.LiveViewEvent -import java.net.URI -import java.time.Instant -import java.time.ZoneOffset -import java.time.format.DateTimeFormatterBuilder class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineVerticle() { private val log = LoggerFactory.getLogger(LiveViewManager::class.java) - private val formatter = DateTimeFormatterBuilder() - .appendPattern("yyyyMMddHHmm") - .toFormatter() - .withZone(ZoneOffset.UTC) //todo: load from SkywalkingMonitor - override suspend fun start() { //register listener var developer = "system" @@ -87,27 +52,8 @@ class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineV return@consumer } - when (event.viewConfig.viewName) { - "LIVE_METER" -> launch(vertx.dispatcher()) { consumeLiveMeterEvent(event) } - "LOGS" -> launch(vertx.dispatcher()) { consumeLogsViewEvent(event) } - "TRACES" -> { - val sourceMark = SourceMarkSearch.findByEndpointName(event.entityId) - if (sourceMark == null) { - log.info("Could not find source mark for: " + event.entityId) - return@consumer - } - consumeTracesViewEvent(event, sourceMark) - } - else -> { - val sourceMark = SourceMarkSearch.findByEndpointName(event.entityId) - if (sourceMark == null) { - log.info("Could not find source mark for: " + event.entityId) - return@consumer - } - val portal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - consumeActivityViewEvent(event, sourceMark, portal) - } - } + SourceMarkSearch.findBySubscriptionId(event.subscriptionId) + ?.getUserData(SourceMarkKeys.VIEW_EVENT_LISTENERS)?.forEach { it.accept(event) } } FrameHelper.sendFrame( @@ -117,139 +63,4 @@ class LiveViewManager(private val pluginConfig: SourceMarkerConfig) : CoroutineV null, null, TCPServiceDiscoveryBackend.socket!! ) } - - private fun consumeLiveMeterEvent(event: LiveViewEvent) { - val meterTypeStr = event.entityId.substringAfter("spp_").substringBefore("_").toUpperCase() - val meterType = MeterType.valueOf(meterTypeStr) - val meterId = event.entityId.substringAfter(meterType.name.toLowerCase() + "_").replace("_", "-") - val meterMark = SourceMarkSearch.findByInstrumentId(meterId) - if (meterMark == null) { - log.info("Could not find source mark for: " + event.entityId) - return - } - - //todo: event listener that works with LiveViewEvent and LiveInstrumentEvent - val eventListeners = meterMark.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS) - if (eventListeners?.isNotEmpty() == true) { - eventListeners.forEach { it.accept(LiveInstrumentEvent(METER_UPDATED, Json.encode(event))) } - } - } - - private suspend fun consumeLogsViewEvent(event: LiveViewEvent) { - val rawMetrics = JsonObject(event.metricsData) - val logData = Json.decodeValue(rawMetrics.getJsonObject("log").toString(), Log::class.java) - val logsResult = LogResult( - event.artifactQualifiedName, - LogOrderType.NEWEST_LOGS, - logData.timestamp, - listOf(logData), - Int.MAX_VALUE - ) - - if (event.artifactQualifiedName.type == ArtifactType.EXPRESSION) { - val expressionMark = SourceMarkSearch.findSourceMark(event.artifactQualifiedName) - if (expressionMark != null) { - vertx.eventBus().send(ProtocolAddress.Global.ArtifactLogUpdated, logsResult) - } - } else { - for ((content, logs) in logsResult.logs.groupBy { it.content }) { - SourceMarkSearch.findInheritedSourceMarks(content).forEach { - vertx.eventBus().send( - ProtocolAddress.Global.ArtifactLogUpdated, - logsResult.copy( - artifactQualifiedName = it.artifactQualifiedName, - total = logs.size, - logs = logs, - ) - ) - } - } - } - } - - private fun consumeTracesViewEvent( - event: LiveViewEvent, - sourceMark: SourceMark - ) { - val rawMetrics = JsonObject(event.metricsData) - val traces = mutableListOf() - val trace = Json.decodeValue(rawMetrics.getJsonObject("trace").toString(), Trace::class.java) - traces.add(trace) - - val traceResult = TraceResult( - sourceMark.artifactQualifiedName, - null, - TraceOrderType.LATEST_TRACES, - trace.start, - trace.start.toJavaInstant().minusMillis(trace.duration.toLong()).toKotlinInstant(), - "minute", - traces, - Int.MAX_VALUE - ) - vertx.eventBus().send(ArtifactTracesUpdated, traceResult) - - val url = trace.meta["url"] - val httpMethod = trace.meta["http.method"] - if (url != null && httpMethod != null) { - val updatedEndpointName = "$httpMethod:${URI(url).path}" - val entrySpan = Json.decodeValue(trace.meta["entrySpan"], TraceSpan::class.java) - vertx.eventBus().send( - TraceSpanUpdated, entrySpan.copy( - endpointName = updatedEndpointName, - artifactQualifiedName = event.artifactQualifiedName - ) - ) - } - } - - private fun consumeActivityViewEvent( - event: LiveViewEvent, - sourceMark: SourceMark, - portal: SourcePortal - ) { - val artifactMetrics = toArtifactMetrics(event) - val metricResult = ArtifactMetricResult( - sourceMark.artifactQualifiedName, - QueryTimeFrame.valueOf(1), - portal.activityView.activeChartMetric, //todo: assumes activity view - formatter.parse(event.timeBucket, Instant::from).toKotlinInstant(), - formatter.parse(event.timeBucket, Instant::from).plusSeconds(60).toKotlinInstant(), - "minute", - artifactMetrics, - true - ) - vertx.eventBus().send(ArtifactMetricsUpdated, metricResult) - } - - private fun toArtifactMetrics(event: LiveViewEvent): List { - val rawMetrics = mutableListOf() - if (event.viewConfig.viewMetrics.size > 1) { - val multiMetrics = JsonArray(event.metricsData) - for (i in 0 until multiMetrics.size()) { - val metricsName = multiMetrics.getJsonObject(i).getJsonObject("meta").getString("metricsName") - val value = when (MetricType.realValueOf(metricsName)) { - MetricType.Throughput_Average -> multiMetrics.getJsonObject(i) - .getInteger("value") - MetricType.ResponseTime_Average -> multiMetrics.getJsonObject(i) - .getInteger("value") - MetricType.ServiceLevelAgreement_Average -> multiMetrics.getJsonObject(i) - .getInteger("percentage") - else -> TODO(metricsName) - } - rawMetrics.add(value) - } - } else { - val value = when (val metricType = MetricType.realValueOf(event.viewConfig.viewMetrics.first())) { - MetricType.Throughput_Average -> JsonObject(event.metricsData).getInteger("value") - MetricType.ResponseTime_Average -> JsonObject(event.metricsData).getInteger("value") - MetricType.ServiceLevelAgreement_Average -> JsonObject(event.metricsData).getInteger("percentage") - else -> TODO(metricType.name) - } - rawMetrics.add(value) - } - val artifactMetrics = rawMetrics.mapIndexed { i: Int, it: Int -> - ArtifactMetrics(MetricType.realValueOf(event.viewConfig.viewMetrics[i]), listOf(it.toDouble())) - } - return artifactMetrics - } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/ViewEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/ViewEventListener.kt new file mode 100644 index 000000000..829c40635 --- /dev/null +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/ViewEventListener.kt @@ -0,0 +1,30 @@ +/* + * Source++, the open-source live coding platform. + * Copyright (C) 2022 CodeBrig, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package spp.jetbrains.sourcemarker.service + +import spp.protocol.view.LiveViewEvent + +/** + * todo: description. + * + * @since 0.5.0 + * @author [Brandon Fergerson](mailto:bfergerson@apache.org) + */ +fun interface ViewEventListener { + fun accept(event: LiveViewEvent) +} diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index 5ca626d97..8ad259920 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -36,31 +36,28 @@ import spp.jetbrains.marker.source.mark.api.component.swing.SwingSourceMarkCompo import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventListener -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_METER_COUNT_ICON import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_METER_GAUGE_ICON import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_METER_HISTOGRAM_ICON import spp.jetbrains.sourcemarker.mark.SourceMarkKeys -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.BREAKPOINT_ID import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.LOG_ID +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.INSTRUMENT_ID +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.VIEW_EVENT_LISTENERS +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.VIEW_SUBSCRIPTION_ID import spp.jetbrains.sourcemarker.service.InstrumentEventListener +import spp.jetbrains.sourcemarker.service.ViewEventListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig -import spp.jetbrains.portal.protocol.ProtocolAddress.Portal.DisplayLogs import spp.protocol.SourceServices import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType -import spp.protocol.artifact.log.LogResult import spp.protocol.instrument.* import spp.protocol.instrument.meter.MeterType -import spp.jetbrains.portal.protocol.portal.PageType import spp.protocol.view.LiveViewConfig import spp.protocol.view.LiveViewSubscription import java.awt.BorderLayout import java.awt.Dimension import java.awt.GridBagConstraints import java.awt.GridBagLayout -import java.time.Instant import java.util.concurrent.CopyOnWriteArrayList import javax.swing.JComponent import javax.swing.JPanel @@ -204,6 +201,7 @@ object LiveStatusManager : SourceMarkEventListener { ) ).onComplete { if (it.succeeded()) { + inlayMark.putUserData(VIEW_SUBSCRIPTION_ID, it.result().subscriptionId) inlayMark.addEventListener { event -> if (event.eventCode == SourceMarkEventCode.MARK_REMOVED) { SourceServices.Instance.liveView!!.removeLiveViewSubscription( @@ -249,11 +247,6 @@ object LiveStatusManager : SourceMarkEventListener { inlayMark.apply() if (!watchExpression) { - SourceMarkerPlugin.vertx.eventBus().consumer(DisplayLogs(sourcePortal.portalUuid)) { - val latestLog = it.body().logs.first() - statusBar.setLatestLog(Instant.ofEpochMilli(latestLog.timestamp.toEpochMilliseconds()), latestLog) - } - statusBar.focus() } } @@ -348,7 +341,7 @@ object LiveStatusManager : SourceMarkEventListener { if (findInlayMark.isPresent) { val inlayMark = findInlayMark.get() if (!fileMarker.containsSourceMark(inlayMark)) { - inlayMark.putUserData(BREAKPOINT_ID, liveBreakpoint.id) + inlayMark.putUserData(INSTRUMENT_ID, liveBreakpoint.id) val wrapperPanel = JPanel() wrapperPanel.layout = BorderLayout() @@ -384,7 +377,7 @@ object LiveStatusManager : SourceMarkEventListener { if (findInlayMark.isPresent) { val inlayMark = findInlayMark.get() if (!fileMarker.containsSourceMark(inlayMark)) { - inlayMark.putUserData(LOG_ID, liveLog.id) + inlayMark.putUserData(INSTRUMENT_ID, liveLog.id) val wrapperPanel = JPanel() wrapperPanel.layout = BorderLayout() @@ -410,13 +403,6 @@ object LiveStatusManager : SourceMarkEventListener { val detector = inlayMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! detector.addLiveLog(editor, inlayMark, liveLog.logFormat, liveLog.location.line) - - SourceMarkerPlugin.vertx.eventBus().consumer(DisplayLogs(sourcePortal.portalUuid)) { - val latestLog = it.body().logs.first() - statusBar.setLatestLog( - Instant.ofEpochMilli(latestLog.timestamp.toEpochMilliseconds()), latestLog - ) - } } } else { log.warn("No detected expression at line {}. Inlay mark ignored", liveLog.location.line) @@ -446,7 +432,7 @@ object LiveStatusManager : SourceMarkEventListener { sourceFileMarker, liveMeter.location.line, false ) if (gutterMark.isPresent) { - gutterMark.get().putUserData(SourceMarkKeys.METER_ID, liveMeter.id!!) + gutterMark.get().putUserData(INSTRUMENT_ID, liveMeter.id!!) when (liveMeter.meterType) { MeterType.COUNT -> gutterMark.get().configuration.icon = LIVE_METER_COUNT_ICON MeterType.GAUGE -> gutterMark.get().configuration.icon = LIVE_METER_GAUGE_ICON @@ -481,6 +467,14 @@ object LiveStatusManager : SourceMarkEventListener { sourceMark.getUserData(INSTRUMENT_EVENT_LISTENERS)!!.add(listener) } + @JvmStatic + fun addViewEventListener(sourceMark: SourceMark, listener: ViewEventListener) { + if (sourceMark.getUserData(VIEW_EVENT_LISTENERS) == null) { + sourceMark.putUserData(VIEW_EVENT_LISTENERS, mutableSetOf()) + } + sourceMark.getUserData(VIEW_EVENT_LISTENERS)!!.add(listener) + } + fun addActiveLiveInstrument(instrument: LiveInstrument) { activeStatusBars.add(instrument) } From c1d7ee5fc9cc38cc6892a80d9c33dc12d2916371 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 20:09:35 +0100 Subject: [PATCH 076/115] remove portal --- .../sourcemarker/SourceMarkerPlugin.kt | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 53c44a174..a85799f1a 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -48,10 +48,6 @@ import io.vertx.core.json.Json import io.vertx.core.json.JsonObject import io.vertx.core.json.jackson.DatabindCodec import io.vertx.core.net.TrustOptions -import io.vertx.ext.bridge.PermittedOptions -import io.vertx.ext.web.Router -import io.vertx.ext.web.handler.sockjs.SockJSBridgeOptions -import io.vertx.ext.web.handler.sockjs.SockJSHandler import io.vertx.kotlin.coroutines.await import io.vertx.kotlin.coroutines.dispatcher import io.vertx.servicediscovery.ServiceDiscovery @@ -77,14 +73,11 @@ import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkSingleJcefC import spp.jetbrains.marker.source.mark.api.filter.CreateSourceMarkFilter import spp.jetbrains.marker.source.mark.gutter.config.GutterMarkConfiguration import spp.jetbrains.monitor.skywalking.SkywalkingMonitor -import spp.jetbrains.portal.SourcePortal -import spp.jetbrains.portal.backend.PortalServer import spp.jetbrains.sourcemarker.PluginBundle.message import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.INTELLIJ_PRODUCT_CODES import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.PYCHARM_PRODUCT_CODES import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.listeners.PluginSourceMarkEventListener -import spp.jetbrains.sourcemarker.listeners.PortalEventListener import spp.jetbrains.sourcemarker.service.LiveInstrumentManager import spp.jetbrains.sourcemarker.service.LiveViewManager import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService @@ -96,7 +89,6 @@ import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.SourceServices import spp.protocol.SourceServices.Instance import spp.protocol.artifact.ArtifactQualifiedName -import spp.jetbrains.portal.protocol.artifact.endpoint.EndpointResult import spp.protocol.artifact.exception.LiveStackTraceElement import spp.protocol.artifact.log.LogResult import spp.protocol.artifact.metrics.ArtifactMetricResult @@ -139,7 +131,6 @@ object SourceMarkerPlugin { } vertx = Vertx.vertx(options) log.debug("Registering SourceMarker protocol codecs") - vertx.eventBus().registerDefaultCodec(SourcePortal::class.java, LocalMessageCodec()) vertx.eventBus().registerDefaultCodec(ArtifactMetricResult::class.java, LocalMessageCodec()) vertx.eventBus().registerDefaultCodec(TraceResult::class.java, LocalMessageCodec()) vertx.eventBus().registerDefaultCodec(TraceStack::class.java, LocalMessageCodec()) @@ -484,28 +475,6 @@ object SourceMarkerPlugin { ) } - private suspend fun initPortal(config: SourceMarkerConfig) { - //todo: portal should be connected to event bus without bridge - val sockJSHandler = SockJSHandler.create(vertx) - val portalBridgeOptions = SockJSBridgeOptions() - .addInboundPermitted(PermittedOptions().setAddressRegex(".+")) - .addOutboundPermitted(PermittedOptions().setAddressRegex(".+")) - sockJSHandler.bridge(portalBridgeOptions) - - val router = Router.router(vertx) - router.route("/eventbus/*").handler(sockJSHandler) - val bridgePort = vertx.sharedData().getLocalMap("portal") - .getOrDefault("bridge.port", 0) - if (bridgePort != 0) { - log.info("Starting bridge server on port: {}", bridgePort) - } - val bridgeServer = vertx.createHttpServer().requestHandler(router).listen(bridgePort, "localhost").await() - - //todo: load portal config (custom themes, etc) - deploymentIds.add(vertx.deployVerticle(PortalServer(bridgeServer.actualPort())).await()) - deploymentIds.add(vertx.deployVerticle(PortalEventListener(config)).await()) - } - private fun initMarker(config: SourceMarkerConfig, project: Project) { log.info("Initializing marker") SourceMarker.addGlobalSourceMarkEventListener(PluginSourceMarkEventListener()) From b72c13c5b75e06ff6f132bfa30f4ab8ad7a539fc Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 20:10:38 +0100 Subject: [PATCH 077/115] bump --- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 770ae9cdc..d7ed91e41 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:22d08b05c5") + compileOnly("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index a23e1ff21..62766a3c1 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:22d08b05c5") + compileOnly("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index c53484045..aa9a3f75e 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:22d08b05c5") + compileOnly("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 0b2b52517..15e000a7a 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:22d08b05c5") + implementation("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index e353aa20e..739f87250 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4cd858772b") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:22d08b05c5") + implementation("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") } implementation("org.jooq:joor:$joorVersion") From 617a5a8e5aac37305dc1c9bdbfb35791693333dc Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 21:31:37 +0100 Subject: [PATCH 078/115] bump --- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index d7ed91e41..ab42cb026 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") + compileOnly("com.github.sourceplusplus.protocol:protocol:e540bbcccb") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 62766a3c1..1691ee6c2 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") + compileOnly("com.github.sourceplusplus.protocol:protocol:e540bbcccb") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index aa9a3f75e..ec603da2a 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") + compileOnly("com.github.sourceplusplus.protocol:protocol:e540bbcccb") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 15e000a7a..bc0333dd6 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") + implementation("com.github.sourceplusplus.protocol:protocol:e540bbcccb") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 739f87250..2c521f838 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4cd858772b") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:eacd2a58a0") + implementation("com.github.sourceplusplus.protocol:protocol:e540bbcccb") } implementation("org.jooq:joor:$joorVersion") From 0f2fc09e72a69a1cf37fd2a19387f01383ea8d4d Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 21:33:57 +0100 Subject: [PATCH 079/115] use marshaller --- .../jetbrains/sourcemarker/status/LogStatusBar.java | 7 +++---- .../sourcemarker/service/LiveInstrumentManager.kt | 2 +- .../sourcemarker/service/log/LogHitColumnInfo.kt | 11 +++++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index fb0f8f098..cfc7320e7 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -12,7 +12,6 @@ import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; -import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import net.miginfocom.swing.MigLayout; import org.jetbrains.annotations.NotNull; @@ -38,6 +37,7 @@ import spp.protocol.instrument.event.LiveLogHit; import spp.protocol.instrument.throttle.InstrumentThrottle; import spp.protocol.instrument.throttle.ThrottleStep; +import spp.protocol.marshall.ProtocolMarshaller; import spp.protocol.view.LiveViewEvent; import javax.swing.*; @@ -249,8 +249,7 @@ public void accept(@NotNull LiveInstrumentEvent event) { if (event.getEventType() == LOG_HIT) { commandModel.insertRow(0, event); - LiveLogHit logHit = Json.decodeValue(event.getData(), LiveLogHit.class); - //LiveLogHit logHit = ProtocolMarshaller.deserializeLiveLogHit(new JsonObject(event.getData())); + LiveLogHit logHit = ProtocolMarshaller.deserializeLiveLogHit(new JsonObject(event.getData())); setLatestLog( Instant.ofEpochMilli(logHit.getLogResult().getTimestamp().toEpochMilliseconds()), logHit.getLogResult().getLogs().get(0) @@ -278,7 +277,7 @@ public void accept(@NotNull LiveInstrumentEvent event) { @Override public void accept(@NotNull LiveViewEvent event) { JsonObject rawMetrics = new JsonObject(event.getMetricsData()); - Log logData = Json.decodeValue(rawMetrics.getJsonObject("log").toString(), Log.class); + Log logData = ProtocolMarshaller.deserializeLog(rawMetrics.getJsonObject("log")); LogResult logResult = new LogResult( event.getArtifactQualifiedName(), LogOrderType.NEWEST_LOGS, diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 609679567..0d44567d9 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -172,7 +172,7 @@ class LiveInstrumentManager( return } - val logHit = Json.decodeValue(liveEvent.data, LiveLogHit::class.java) + val logHit = ProtocolMarshaller.deserializeLiveLogHit(JsonObject(liveEvent.data)) SourceMarkSearch.findByInstrumentId(logHit.logId) ?.getUserData(SourceMarkKeys.INSTRUMENT_EVENT_LISTENERS)?.forEach { it.accept(liveEvent) } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt index dec67dd04..c525da58a 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt @@ -18,14 +18,13 @@ package spp.jetbrains.sourcemarker.service.log import com.intellij.util.ui.ColumnInfo -import io.vertx.core.json.Json import io.vertx.core.json.JsonObject import kotlinx.datetime.Clock import spp.jetbrains.sourcemarker.PluginBundle.message -import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType -import spp.protocol.instrument.event.LiveLogHit +import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved +import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveLogHit import spp.protocol.utils.toPrettyDuration /** @@ -40,14 +39,14 @@ class LogHitColumnInfo(name: String) : ColumnInfo(n return when (name) { "Time" -> Comparator { t: LiveInstrumentEvent, t2: LiveInstrumentEvent -> val obj1 = if (t.eventType == LiveInstrumentEventType.LOG_HIT) { - Json.decodeValue(t.data, LiveLogHit::class.java) + deserializeLiveLogHit(JsonObject(t.data)) } else if (t.eventType == LiveInstrumentEventType.LOG_REMOVED) { deserializeLiveInstrumentRemoved(JsonObject(t.data)) } else { throw IllegalArgumentException(t.eventType.name) } val obj2 = if (t2.eventType == LiveInstrumentEventType.LOG_HIT) { - Json.decodeValue(t2.data, LiveLogHit::class.java) + deserializeLiveLogHit(JsonObject(t2.data)) } else if (t2.eventType == LiveInstrumentEventType.LOG_REMOVED) { deserializeLiveInstrumentRemoved(JsonObject(t2.data)) } else { @@ -61,7 +60,7 @@ class LogHitColumnInfo(name: String) : ColumnInfo(n override fun valueOf(event: LiveInstrumentEvent): String { if (event.eventType == LiveInstrumentEventType.LOG_HIT) { - val item = Json.decodeValue(event.data, LiveLogHit::class.java) + val item = deserializeLiveLogHit(JsonObject(event.data)) return when (name) { "Message" -> item.logResult.logs.first().toFormattedMessage() "Time" -> From ced2a9cf0f80209a85b8563d3ef976a6d9d0400b Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 21:39:01 +0100 Subject: [PATCH 080/115] use marshaller --- .../service/breakpoint/BreakpointHitColumnInfo.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt index 73edda884..e8cae30f1 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt @@ -22,10 +22,10 @@ import io.vertx.core.json.Json import io.vertx.core.json.JsonObject import kotlinx.datetime.Clock import spp.jetbrains.sourcemarker.PluginBundle.message -import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved -import spp.protocol.instrument.event.LiveBreakpointHit import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType +import spp.protocol.marshall.ProtocolMarshaller +import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved import spp.protocol.utils.toPrettyDuration /** @@ -40,14 +40,14 @@ class BreakpointHitColumnInfo(name: String) : ColumnInfo Comparator { t: LiveInstrumentEvent, t2: LiveInstrumentEvent -> val obj1 = if (t.eventType == LiveInstrumentEventType.BREAKPOINT_HIT) { - Json.decodeValue(t.data, LiveBreakpointHit::class.java) + ProtocolMarshaller.deserializeLiveBreakpointHit(JsonObject(t.data)) } else if (t.eventType == LiveInstrumentEventType.BREAKPOINT_REMOVED) { deserializeLiveInstrumentRemoved(JsonObject(t.data)) } else { throw IllegalArgumentException(t.eventType.name) } val obj2 = if (t2.eventType == LiveInstrumentEventType.BREAKPOINT_HIT) { - Json.decodeValue(t2.data, LiveBreakpointHit::class.java) + ProtocolMarshaller.deserializeLiveBreakpointHit(JsonObject(t2.data)) } else if (t2.eventType == LiveInstrumentEventType.BREAKPOINT_REMOVED) { deserializeLiveInstrumentRemoved(JsonObject(t2.data)) } else { @@ -62,7 +62,7 @@ class BreakpointHitColumnInfo(name: String) : ColumnInfo>() if (event.eventType == LiveInstrumentEventType.BREAKPOINT_HIT) { - val item = Json.decodeValue(event.data, LiveBreakpointHit::class.java) + val item = ProtocolMarshaller.deserializeLiveBreakpointHit(JsonObject(event.data)) item.stackTrace.elements.first().variables.forEach { breakpointData.add(mapOf(it.name to it.value)) } From d9beea9e541cb620cfc594844091c770bf87b064 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Tue, 8 Mar 2022 21:40:24 +0100 Subject: [PATCH 081/115] use marshaller --- .../jetbrains/sourcemarker/status/BreakpointStatusBar.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index 54e4bf355..9aefacb00 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -12,7 +12,6 @@ import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; -import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import net.miginfocom.swing.MigLayout; import org.apache.commons.lang.StringUtils; @@ -34,6 +33,7 @@ import spp.protocol.instrument.event.LiveInstrumentRemoved; import spp.protocol.instrument.throttle.InstrumentThrottle; import spp.protocol.instrument.throttle.ThrottleStep; +import spp.protocol.marshall.ProtocolMarshaller; import javax.swing.*; import javax.swing.border.CompoundBorder; @@ -232,7 +232,9 @@ public void mouseClicked(MouseEvent e) { table.convertRowIndexToModel(table.getSelectedRow()) ); if (selectedEvent.getEventType() == BREAKPOINT_REMOVED) return; - LiveBreakpointHit selectedValue = Json.decodeValue(selectedEvent.getData(), LiveBreakpointHit.class); + LiveBreakpointHit selectedValue = ProtocolMarshaller.deserializeLiveBreakpointHit( + new JsonObject(selectedEvent.getData()) + ); if (selectedValue.equals(shownBreakpointHit.getAndSet(selectedValue))) return; SwingUtilities.invokeLater(() -> { From ae14f45ff3e530c204a0ea8aec0844c68322daf6 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 12:49:01 +0100 Subject: [PATCH 082/115] re-impl portal --- .../sourcemarker/SourceMarkerPlugin.kt | 108 +-- .../command/ControlBarController.kt | 27 +- .../PluginSourceMarkEventListener.kt | 43 +- .../listeners/PortalEventListener.kt | 679 ++++++++++++++++++ 4 files changed, 753 insertions(+), 104 deletions(-) create mode 100644 plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index a85799f1a..0d067487a 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -18,16 +18,11 @@ package spp.jetbrains.sourcemarker import com.apollographql.apollo3.exception.ApolloHttpException -import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.dataformat.yaml.YAMLMapper -import com.fasterxml.jackson.datatype.guava.GuavaModule -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import com.fasterxml.jackson.module.kotlin.KotlinModule import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer +import com.intellij.ide.ui.laf.IntelliJLaf import com.intellij.ide.util.PropertiesComponent import com.intellij.notification.Notification import com.intellij.notification.NotificationType @@ -69,15 +64,25 @@ import spp.jetbrains.marker.py.PythonArtifactScopeService import spp.jetbrains.marker.py.PythonConditionParser import spp.jetbrains.marker.source.mark.api.component.api.config.ComponentSizeEvaluator import spp.jetbrains.marker.source.mark.api.component.api.config.SourceMarkComponentConfiguration +import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkSingleJcefComponentProvider +import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode import spp.jetbrains.marker.source.mark.api.filter.CreateSourceMarkFilter import spp.jetbrains.marker.source.mark.gutter.config.GutterMarkConfiguration import spp.jetbrains.monitor.skywalking.SkywalkingMonitor +import spp.jetbrains.portal.SourcePortal +import spp.jetbrains.portal.backend.PortalServer +import spp.jetbrains.portal.protocol.portal.PageType import spp.jetbrains.sourcemarker.PluginBundle.message import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.INTELLIJ_PRODUCT_CODES import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.PYCHARM_PRODUCT_CODES +import spp.jetbrains.sourcemarker.command.ControlBarController +import spp.jetbrains.sourcemarker.command.LiveControlCommand +import spp.jetbrains.sourcemarker.command.LiveControlCommand.* import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.listeners.PluginSourceMarkEventListener +import spp.jetbrains.sourcemarker.listeners.PortalEventListener +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.service.LiveInstrumentManager import spp.jetbrains.sourcemarker.service.LiveViewManager import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService @@ -88,21 +93,13 @@ import spp.jetbrains.sourcemarker.settings.serviceHostNormalized import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.SourceServices import spp.protocol.SourceServices.Instance -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.exception.LiveStackTraceElement -import spp.protocol.artifact.log.LogResult -import spp.protocol.artifact.metrics.ArtifactMetricResult -import spp.protocol.artifact.trace.TraceResult -import spp.protocol.artifact.trace.TraceSpan -import spp.protocol.artifact.trace.TraceSpanStackQueryResult -import spp.protocol.artifact.trace.TraceStack import spp.protocol.marshall.KSerializers -import spp.protocol.marshall.LocalMessageCodec import spp.protocol.service.LiveInstrumentService import spp.protocol.service.LiveService import spp.protocol.service.LiveViewService import java.awt.Dimension import java.io.File +import javax.swing.UIManager /** * Sets up the SourceMarker plugin by configuring and initializing the various plugin modules. @@ -118,9 +115,6 @@ object SourceMarkerPlugin { val vertx: Vertx private var connectionJob: Job? = null - /** - * Setup Vert.x EventBus for communication between plugin modules. - */ init { SourceMarker.enabled = false val options = if (System.getProperty("sourcemarker.debug.unblocked_threads", "false")!!.toBoolean()) { @@ -130,28 +124,6 @@ object SourceMarkerPlugin { VertxOptions() } vertx = Vertx.vertx(options) - log.debug("Registering SourceMarker protocol codecs") - vertx.eventBus().registerDefaultCodec(ArtifactMetricResult::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(TraceResult::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(TraceStack::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(TraceSpanStackQueryResult::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(EndpointResult::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(LiveStackTraceElement::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(ArtifactQualifiedName::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(LogResult::class.java, LocalMessageCodec()) - vertx.eventBus().registerDefaultCodec(TraceSpan::class.java, LocalMessageCodec()) - - val module = SimpleModule() - module.addSerializer(Instant::class.java, KSerializers.KotlinInstantSerializer()) - module.addDeserializer(Instant::class.java, KSerializers.KotlinInstantDeserializer()) - DatabindCodec.mapper().registerModule(module) - - DatabindCodec.mapper().registerModule(GuavaModule()) - DatabindCodec.mapper().registerModule(Jdk8Module()) - DatabindCodec.mapper().registerModule(JavaTimeModule()) - DatabindCodec.mapper().registerModule(KotlinModule.Builder().build()) - DatabindCodec.mapper().enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) - DatabindCodec.mapper().enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) val productCode = ApplicationInfo.getInstance().build.productCode if (PYCHARM_PRODUCT_CODES.contains(productCode)) { @@ -475,6 +447,62 @@ object SourceMarkerPlugin { ) } + private suspend fun initPortal(config: SourceMarkerConfig) { + log.info("Initializing portal") + + val module = SimpleModule() + module.addSerializer(Instant::class.java, KSerializers.KotlinInstantSerializer()) + module.addDeserializer(Instant::class.java, KSerializers.KotlinInstantDeserializer()) + DatabindCodec.mapper().registerModule(module) + + val portalServer = PortalServer() + deploymentIds.add(vertx.deployVerticle(portalServer).await()) + deploymentIds.add(vertx.deployVerticle(PortalEventListener(config)).await()) + + SourceMarker.addGlobalSourceMarkEventListener { + if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED) { + //todo: only register when needed + //register portal for source mark + val portal = SourcePortal.getPortal( + SourcePortal.register(it.sourceMark.artifactQualifiedName, false) + )!! + it.sourceMark.putUserData(SourceMarkKeys.PORTAL_CONFIGURATION, portal.configuration) + portal.configuration.config["visibleOverview"] = it.sourceMark.isClassMark + portal.configuration.config["visibleActivity"] = true + portal.configuration.config["visibleTraces"] = true + portal.configuration.config["visibleLogs"] = true + portal.configuration.config["visibleConfiguration"] = false + + val genUrl = "http://localhost:${portalServer.serverPort}?portalUuid=${portal.portalUuid}" + it.sourceMark.addEventListener { + if (it.eventCode == SourceMarkEventCode.UPDATE_PORTAL_CONFIG) { + when (val command = it.params.first() as LiveControlCommand) { + VIEW_ACTIVITY -> portal.configuration.config["currentPage"] = PageType.ACTIVITY + VIEW_TRACES -> portal.configuration.config["currentPage"] = PageType.TRACES + VIEW_LOGS -> portal.configuration.config["currentPage"] = PageType.LOGS + else -> throw UnsupportedOperationException("Command input: $command") + } + + val jcefComponent = it.sourceMark.sourceMarkComponent as SourceMarkJcefComponent + jcefComponent.configuration.currentUrl = "#" + } else if (it.eventCode == SourceMarkEventCode.PORTAL_OPENING) { + val jcefComponent = it.sourceMark.sourceMarkComponent as SourceMarkJcefComponent + portal.configuration.darkMode = UIManager.getLookAndFeel() !is IntelliJLaf + + if (jcefComponent.configuration.currentUrl != genUrl) { + jcefComponent.configuration.initialUrl = genUrl + jcefComponent.configuration.currentUrl = genUrl + jcefComponent.getBrowser().cefBrowser.executeJavaScript( + "window.location.href = '$genUrl';", genUrl, 0 + ) + } + ApplicationManager.getApplication().invokeLater(it.sourceMark::displayPopup) + } + } + } + } + } + private fun initMarker(config: SourceMarkerConfig, project: Project) { log.info("Initializing marker") SourceMarker.addGlobalSourceMarkEventListener(PluginSourceMarkEventListener()) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt index 6d4966326..ee9164aa6 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt @@ -31,18 +31,15 @@ import spp.jetbrains.marker.source.mark.api.MethodSourceMark import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.component.swing.SwingSourceMarkComponentProvider import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent -import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode +import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode.* import spp.jetbrains.marker.source.mark.inlay.ExpressionInlayMark import spp.jetbrains.marker.source.mark.inlay.InlayMark import spp.jetbrains.sourcemarker.ControlBar -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.command.LiveControlCommand.* import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.status.LiveStatusManager -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.SetCurrentPage import spp.protocol.SourceServices import spp.protocol.instrument.LiveInstrumentType.* -import spp.jetbrains.portal.protocol.portal.PageType import java.awt.BorderLayout import javax.swing.JComponent import javax.swing.JPanel @@ -218,26 +215,12 @@ object ControlBarController { } if (sourceMark != null) { - val portal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - when (command) { - VIEW_ACTIVITY -> portal.configuration.currentPage = PageType.ACTIVITY - VIEW_TRACES -> portal.configuration.currentPage = PageType.TRACES - VIEW_LOGS -> portal.configuration.currentPage = PageType.LOGS - else -> throw UnsupportedOperationException("Command input: $command") - } - SourceMarkerPlugin.vertx.eventBus().request(SetCurrentPage, portal) { - sourceMark.triggerEvent(SourceMarkEvent(sourceMark, SourceMarkEventCode.PORTAL_OPENING)) + sourceMark.triggerEvent(SourceMarkEvent(sourceMark, UPDATE_PORTAL_CONFIG, command)) { + sourceMark.triggerEvent(SourceMarkEvent(sourceMark, PORTAL_OPENING)) } } else if (classSourceMark != null) { - val portal = classSourceMark!!.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - when (command) { - VIEW_ACTIVITY -> portal.configuration.currentPage = PageType.ACTIVITY - VIEW_TRACES -> portal.configuration.currentPage = PageType.TRACES - VIEW_LOGS -> portal.configuration.currentPage = PageType.LOGS - else -> throw UnsupportedOperationException("Command input: $command") - } - SourceMarkerPlugin.vertx.eventBus().request(SetCurrentPage, portal) { - classSourceMark!!.triggerEvent(SourceMarkEvent(classSourceMark!!, SourceMarkEventCode.PORTAL_OPENING)) + classSourceMark!!.triggerEvent(SourceMarkEvent(classSourceMark!!, UPDATE_PORTAL_CONFIG, command)) { + classSourceMark!!.triggerEvent(SourceMarkEvent(classSourceMark!!, PORTAL_OPENING)) } } else { log.warn("No source mark found for command: {}", command) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt index 5114217e2..3cc5833a1 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt @@ -23,19 +23,13 @@ import kotlinx.coroutines.launch import org.slf4j.LoggerFactory import spp.jetbrains.marker.jvm.psi.EndpointDetector import spp.jetbrains.marker.jvm.psi.LoggerDetector -import spp.jetbrains.marker.source.mark.api.ClassSourceMark import spp.jetbrains.marker.source.mark.api.MethodSourceMark import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode import spp.jetbrains.marker.source.mark.api.event.SynchronousSourceMarkEventListener -import spp.jetbrains.portal.SourcePortal import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.LOGGER_DETECTOR -import spp.jetbrains.portal.protocol.ProtocolAddress.Global.OpenPortal -import spp.protocol.artifact.ArtifactType -import spp.jetbrains.portal.protocol.portal.PageType /** * todo: description. @@ -56,41 +50,8 @@ class PluginSourceMarkEventListener : SynchronousSourceMarkEventListener { log.trace("Handling event: $event") } - if (event.eventCode == SourceMarkEventCode.PORTAL_OPENED) { + if (event.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED) { val sourceMark = event.sourceMark - val sourcePortal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - sourcePortal.visible = true - } else if (event.eventCode == SourceMarkEventCode.PORTAL_CLOSED) { - val sourceMark = event.sourceMark - val sourcePortal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! - sourcePortal.visible = false - } else if (event.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED) { - val sourceMark = event.sourceMark - - //register portal for source mark - val sourcePortal = SourcePortal.getPortal(SourcePortal.register( - sourceMark.artifactQualifiedName, false - )) - sourceMark.putUserData(SourceMarkKeys.SOURCE_PORTAL, sourcePortal!!) - sourceMark.addEventListener { - if (it.eventCode == SourceMarkEventCode.PORTAL_OPENING) { - vertx.eventBus().publish(OpenPortal, sourcePortal) - } - } - - if (sourceMark is ClassSourceMark) { - //class-based portals only have overview page - sourcePortal.configuration.currentPage = PageType.OVERVIEW - sourcePortal.configuration.visibleActivity = false - sourcePortal.configuration.visibleTraces = false - sourcePortal.configuration.artifactType = ArtifactType.CLASS - } else if (sourceMark is MethodSourceMark) { - //method-based portals don't have overview page - sourcePortal.configuration.visibleOverview = false - sourcePortal.configuration.artifactType = ArtifactType.METHOD - } else { - sourcePortal.configuration.artifactType = ArtifactType.EXPRESSION - } if (sourceMark is MethodSourceMark) { //setup endpoint detector and attempt detection @@ -102,8 +63,6 @@ class PluginSourceMarkEventListener : SynchronousSourceMarkEventListener { //setup logger detector sourceMark.putUserData(LOGGER_DETECTOR, loggerDetector) - } else if (event.eventCode == SourceMarkEventCode.MARK_REMOVED) { - event.sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!.close() } } } diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt new file mode 100644 index 000000000..b78d3d0ee --- /dev/null +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt @@ -0,0 +1,679 @@ +/* + * Source++, the open-source live coding platform. + * Copyright (C) 2022 CodeBrig, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package spp.jetbrains.sourcemarker.listeners + +import com.intellij.ide.ui.laf.IntelliJLaf +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.application.runReadAction +import com.intellij.openapi.project.ProjectManager +import io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND +import io.vertx.core.eventbus.ReplyException +import io.vertx.core.json.Json +import io.vertx.core.json.JsonObject +import io.vertx.kotlin.coroutines.CoroutineVerticle +import io.vertx.kotlin.coroutines.dispatcher +import kotlinx.coroutines.launch +import kotlinx.datetime.Instant +import org.slf4j.LoggerFactory +import spp.jetbrains.marker.SourceMarker +import spp.jetbrains.marker.jvm.ArtifactNavigator +import spp.jetbrains.marker.source.SourceFileMarker +import spp.jetbrains.marker.source.mark.api.ClassSourceMark +import spp.jetbrains.marker.source.mark.api.MethodSourceMark +import spp.jetbrains.marker.source.mark.api.SourceMark +import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent +import spp.jetbrains.monitor.skywalking.SkywalkingClient +import spp.jetbrains.monitor.skywalking.average +import spp.jetbrains.monitor.skywalking.bridge.EndpointMetricsBridge +import spp.jetbrains.monitor.skywalking.bridge.EndpointTracesBridge +import spp.jetbrains.monitor.skywalking.bridge.LogsBridge +import spp.jetbrains.monitor.skywalking.bridge.LogsBridge.GetEndpointLogs +import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics +import spp.jetbrains.monitor.skywalking.model.GetEndpointTraces +import spp.jetbrains.monitor.skywalking.model.ZonedDuration +import spp.jetbrains.monitor.skywalking.toProtocol +import spp.jetbrains.portal.SourcePortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactLogUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactMetricsUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ArtifactTracesUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.CanNavigateToArtifact +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ClickedStackTraceElement +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.ClosePortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.FindAndOpenPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.FindPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.GetPortalConfiguration +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.GetPortalTranslations +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.NavigateToArtifact +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.OpenPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.QueryTraceStack +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshActivity +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshLogs +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshOverview +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshPortal +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.RefreshTraces +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.SetCurrentPage +import spp.jetbrains.portal.protocol.ProtocolAddress.Global.TraceSpanUpdated +import spp.jetbrains.portal.protocol.ProtocolAddress.Portal.UpdateEndpoints +import spp.jetbrains.portal.protocol.artifact.endpoint.EndpointResult +import spp.jetbrains.portal.protocol.artifact.endpoint.EndpointType +import spp.jetbrains.portal.protocol.artifact.metrics.ArtifactSummarizedMetrics +import spp.jetbrains.portal.protocol.artifact.metrics.ArtifactSummarizedResult +import spp.jetbrains.portal.protocol.portal.PageType +import spp.jetbrains.sourcemarker.PluginBundle +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR +import spp.jetbrains.sourcemarker.search.SourceMarkSearch +import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig +import spp.protocol.SourceServices.Instance +import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.exception.LiveStackTraceElement +import spp.protocol.artifact.metrics.MetricType +import spp.protocol.artifact.trace.TraceResult +import spp.protocol.artifact.trace.TraceSpan +import spp.protocol.instrument.LiveSourceLocation +import spp.protocol.view.LiveViewConfig +import spp.protocol.view.LiveViewSubscription +import java.net.URI +import java.time.ZonedDateTime +import java.time.temporal.ChronoUnit +import javax.swing.UIManager + +/** + * todo: description. + * + * @since 0.1.0 + * @author [Brandon Fergerson](mailto:bfergerson@apache.org) + */ +@Suppress("MagicNumber") +class PortalEventListener( + private val markerConfig: SourceMarkerConfig, + private val hostTranslations: Boolean = true +) : CoroutineVerticle() { + + companion object { + private val log = LoggerFactory.getLogger(PortalEventListener::class.java) + } + + private var lastDisplayedInternalPortal: SourcePortal? = null + + override suspend fun start() { + //listen for theme changes + UIManager.addPropertyChangeListener { + if (lastDisplayedInternalPortal != null) { + lastDisplayedInternalPortal!!.configuration.darkMode = (it.newValue !is IntelliJLaf) + val sourceMark = SourceMarker.getSourceMark( + lastDisplayedInternalPortal!!.viewingArtifact, SourceMark.Type.GUTTER + ) + if (sourceMark != null) { + val jcefComponent = sourceMark.sourceMarkComponent as SourceMarkJcefComponent + jcefComponent.getBrowser().cefBrowser.reload() + } + } + } + + vertx.eventBus().consumer(RefreshPortal) { + val portal = if (it.body() is String) { + SourcePortal.getPortal(it.body() as String) + } else { + it.body() as SourcePortal + }!! + when (portal.configuration.config["currentPage"]) { + PageType.OVERVIEW -> vertx.eventBus().send(RefreshOverview, portal) + PageType.ACTIVITY -> vertx.eventBus().send(RefreshActivity, portal) + PageType.LOGS -> vertx.eventBus().send(RefreshLogs, portal) + PageType.TRACES -> vertx.eventBus().send(RefreshTraces, portal) + PageType.CONFIGURATION -> TODO() + } + } + vertx.eventBus().consumer(SetCurrentPage) { + if (it.body() is JsonObject) { + val body = (it.body() as JsonObject) + val portalUuid = body.getString("portalUuid") + val pageType = PageType.valueOf(body.getString("pageType")) + val portal = SourcePortal.getPortal(portalUuid)!! + portal.configuration.config["currentPage"] = pageType + it.reply(JsonObject.mapFrom(portal.configuration)) + log.info("Set portal ${portal.portalUuid} page type to $pageType") + vertx.eventBus().publish(RefreshPortal, portal) + } else { + val portal = it.body() as SourcePortal + if (lastDisplayedInternalPortal == null) { + configureDisplayedPortal(portal) + } else { + val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) + val jcefComponent = sourceMark!!.sourceMarkComponent as SourceMarkJcefComponent + val port = vertx.sharedData().getLocalMap("portal")["http.port"]!! + val host = "http://localhost:$port" + val currentUrl = "$host/?portalUuid=${portal.portalUuid}" + jcefComponent.getBrowser().cefBrowser.executeJavaScript( + "window.location.href = '$currentUrl';", currentUrl, 0 + ) + } + it.reply(JsonObject.mapFrom(portal.configuration)) + log.info("Updated portal ${portal.portalUuid} current page") + } + } + vertx.eventBus().consumer(GetPortalConfiguration) { + val portalUuid = it.body() + if (!portalUuid.isNullOrEmpty()) { + log.info("Getting portal configuration. Portal UUID: $portalUuid") + val portal = SourcePortal.getPortal(portalUuid) + if (portal == null) { + log.error("Failed to find portal: $portalUuid") + it.fail(NOT_FOUND.code(), "Portal $portalUuid does not exist") + } else { + it.reply(JsonObject.mapFrom(portal.configuration)) + } + } else { + log.error("Failed to get portal configuration. Missing portalUuid"); + } + } + if (hostTranslations) { + vertx.eventBus().consumer(GetPortalTranslations) { + val map = HashMap() + val keys = PluginBundle.resourceBundle.keys + while (keys.hasMoreElements()) { + val key = keys.nextElement() + map[key] = PluginBundle.resourceBundle.getString(key) + } + it.reply(JsonObject.mapFrom(map)) + } + } + vertx.eventBus().consumer(FindPortal) { +// val artifactQualifiedName = it.body() +// val sourceMarks = SourceMarker.getSourceMarks(artifactQualifiedName) +// if (sourceMarks.isNotEmpty()) { +// it.reply(sourceMarks[0].getUserData(SourceMarkKeys.SOURCE_PORTAL)!!) +// } else { +// launch(vertx.dispatcher()) { +// val classArtifact = findArtifact( +// vertx, artifactQualifiedName.copy( +// identifier = ArtifactNameUtils.getQualifiedClassName(artifactQualifiedName.identifier)!!, +// operationName = null, +// type = ArtifactType.CLASS +// ) +// ) +// val fileMarker = SourceMarker.getSourceFileMarker(classArtifact!!.containingFile)!! +// val searchArtifact = findArtifact(vertx, artifactQualifiedName) as PsiNameIdentifierOwner +// runReadAction { +// val gutterMark = creationService.getOrCreateMethodGutterMark( +// fileMarker, searchArtifact.nameIdentifier!! +// )!! +// it.reply(gutterMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!) +// } +// } +// } + } + vertx.eventBus().consumer(FindAndOpenPortal) { +// val artifactQualifiedName = it.body() +// runReadAction { +// val sourceMarks = SourceMarker.getSourceMarks(artifactQualifiedName) +// if (sourceMarks.isNotEmpty()) { +// val sourceMark = sourceMarks[0] +// ApplicationManager.getApplication().invokeLater { +// PsiNavigateUtil.navigate(sourceMark.getPsiElement()) +// +// val portal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! +// openPortal(portal) +// it.reply(portal) +// } +// } else { +// log.warn("Failed to find portal for artifact: $artifactQualifiedName") +// } +// } + } + vertx.eventBus().consumer(OpenPortal) { openPortal(it.body()); it.reply(it.body()) } + vertx.eventBus().consumer(ClosePortal) { closePortal(it.body()) } + vertx.eventBus().consumer(RefreshOverview) { + runReadAction { + val fileMarker = SourceMarker.getSourceFileMarker(it.body().viewingArtifact)!! + launch(vertx.dispatcher()) { + refreshOverview(fileMarker, it.body()) + } + + //todo: update subscriptions + } + } + vertx.eventBus().consumer(RefreshActivity) { + val portal = it.body() + //pull from skywalking + launch(vertx.dispatcher()) { + pullLatestActivity(portal) + } + + //update subscriptions + if (Instance.liveView != null) { + Instance.liveView!!.clearLiveViewSubscriptions().onComplete { + if (it.succeeded()) { + launch(vertx.dispatcher()) { + val sourceMark = SourceMarker.getSourceMark( + portal.viewingArtifact, SourceMark.Type.GUTTER + ) ?: return@launch + val endpointName = sourceMark.getUserData( + ENDPOINT_DETECTOR + )?.getOrFindEndpointName(sourceMark) ?: return@launch + + Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + listOf(endpointName), + portal.viewingArtifact, + LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix + LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) + ) + ).onComplete { + if (it.failed()) { + log.error("Failed to add live view subscription", it.cause()) + } + } + } + } else { + log.error("Failed to clear live view subscriptions", it.cause()) + } + } + } + } + vertx.eventBus().consumer(RefreshTraces) { + val portal = it.body() + //pull from skywalking + launch(vertx.dispatcher()) { + pullLatestTraces(it.body()) + } + + //update subscriptions + if (Instance.liveView != null) { + Instance.liveView!!.clearLiveViewSubscriptions().onComplete { + if (it.succeeded()) { + launch(vertx.dispatcher()) { + val sourceMark = SourceMarker.getSourceMark( + portal.viewingArtifact, SourceMark.Type.GUTTER + ) ?: return@launch + val endpointName = sourceMark.getUserData( + ENDPOINT_DETECTOR + )?.getOrFindEndpointName(sourceMark) ?: return@launch + + Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + listOf(endpointName), + portal.viewingArtifact, + LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix + LiveViewConfig("TRACES", listOf("endpoint_traces")) + ) + ).onComplete { + if (it.failed()) { + log.error("Failed to add live view subscription", it.cause()) + } + } + } + } else { + log.error("Failed to clear live view subscriptions", it.cause()) + } + } + } + } + vertx.eventBus().consumer(RefreshLogs) { + val portal = it.body() + //pull from skywalking + launch(vertx.dispatcher()) { + pullLatestLogs(portal) + } + + //update subscriptions + if (Instance.liveView != null) { + Instance.liveView!!.clearLiveViewSubscriptions().onComplete { + if (it.succeeded()) { + launch(vertx.dispatcher()) { + val sourceMark = SourceMarker.getSourceMark( + portal.viewingArtifact, SourceMark.Type.GUTTER + ) + + val logPatterns = if (sourceMark is ClassSourceMark) { + sourceMark.sourceFileMarker.getSourceMarks().filterIsInstance() + .flatMap { + it.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! + .getOrFindLoggerStatements(it) + }.map { it.logPattern } + } else if (sourceMark is MethodSourceMark) { + sourceMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! + .getOrFindLoggerStatements(sourceMark).map { it.logPattern } + } else { + throw IllegalStateException("Unsupported source mark type") + } + + Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + logPatterns, + portal.viewingArtifact, + LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix + LiveViewConfig("LOGS", listOf("endpoint_logs")) + ) + ).onComplete { + if (it.failed()) { + log.error("Failed to add live view subscription", it.cause()) + } + } + } + } else { + log.error("Failed to clear live view subscriptions", it.cause()) + } + } + } + } + vertx.eventBus().consumer(QueryTraceStack) { handler -> + val traceId = handler.body() + launch(vertx.dispatcher()) { + handler.reply(EndpointTracesBridge.getTraceStack(traceId, vertx)) + } + } + vertx.eventBus().consumer(ClickedStackTraceElement) { handler -> + val message = handler.body() + val portalUuid = message.getString("portalUuid") + val portal = SourcePortal.getPortal(portalUuid)!! + if (!portal.configuration.external) vertx.eventBus().send(ClosePortal, portal) + + val element = Json.decodeValue( + message.getJsonObject("stackTraceElement").toString(), + LiveStackTraceElement::class.java + ) + log.info("Clicked stack trace element: $element") + + val project = ProjectManager.getInstance().openProjects[0] + ArtifactNavigator.navigateTo(project, element) + } + vertx.eventBus().consumer(CanNavigateToArtifact) { + val artifactQualifiedName = it.body() + val project = ProjectManager.getInstance().openProjects[0] + launch(vertx.dispatcher()) { + it.reply(ArtifactNavigator.canNavigateTo(project, artifactQualifiedName)) + } + } + vertx.eventBus().consumer(NavigateToArtifact) { msg -> + launch(vertx.dispatcher()) { + ArtifactNavigator.navigateTo(vertx, msg.body()) { + if (it.succeeded()) { + log.info("Navigated to artifact $it") + msg.reply(it.result()) + } else { + log.error("Failed to navigate to artifact", it.cause()) + msg.fail(500, it.cause().message) + } + } + } + } + } + + private suspend fun pullLatestTraces(portal: SourcePortal) { + val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) + if (sourceMark != null && sourceMark is MethodSourceMark) { + val endpointId = sourceMark.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(sourceMark) + if (endpointId != null) { + launch(vertx.dispatcher()) { + val traceResult = EndpointTracesBridge.getTraces( + GetEndpointTraces( + artifactQualifiedName = portal.viewingArtifact, + endpointId = endpointId, + zonedDuration = ZonedDuration( + ZonedDateTime.now().minusHours(24), + ZonedDateTime.now(), + SkywalkingClient.DurationStep.MINUTE + ), + orderType = portal.tracesView.orderType, + pageSize = portal.tracesView.viewTraceAmount, + pageNumber = portal.tracesView.pageNumber + ), vertx + ) + + handleTraceResult(traceResult, portal, portal.viewingArtifact) + } + } + } + } + + private fun handleTraceResult( + traceResult: TraceResult, + portal: SourcePortal, + artifactQualifiedName: ArtifactQualifiedName + ) { + //todo: rename {GET} to [GET] in skywalking + if (markerConfig.autoResolveEndpointNames) { + launch(vertx.dispatcher()) { + //todo: only try to auto resolve endpoint names with dynamic ids + //todo: support multiple operationsNames/traceIds + traceResult.traces.forEach { + if (!portal.tracesView.resolvedEndpointNames.containsKey(it.traceIds[0])) { + val traceStack = EndpointTracesBridge.getTraceStack(it.traceIds[0], vertx) + val entrySpan: TraceSpan? = traceStack.traceSpans.firstOrNull { it.type == "Entry" } + if (entrySpan != null) { + val url = entrySpan.tags["url"] + val httpMethod = entrySpan.tags["http.method"] + if (url != null && httpMethod != null) { + val updatedEndpointName = "{$httpMethod}${URI(url).path}" + vertx.eventBus().send( + TraceSpanUpdated, entrySpan.copy( + endpointName = updatedEndpointName, + artifactQualifiedName = artifactQualifiedName + ) + ) + } + } + } + } + } + } + vertx.eventBus().send(ArtifactTracesUpdated, traceResult) + } + + private suspend fun pullLatestLogs(portal: SourcePortal) { + if (log.isTraceEnabled) log.trace("Refreshing logs. Portal: {}", portal.portalUuid) + val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) + launch(vertx.dispatcher()) { + val logsResult = LogsBridge.queryLogs( + GetEndpointLogs( + endpointId = if (sourceMark is MethodSourceMark) { + sourceMark.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(sourceMark) + } else null, + zonedDuration = ZonedDuration( + ZonedDateTime.now().minusMinutes(15), //todo: method filtering in skywalking + ZonedDateTime.now(), + SkywalkingClient.DurationStep.MINUTE + ), + orderType = portal.logsView.orderType, + pageSize = portal.logsView.viewLogAmount * 25, //todo: method filtering in skywalking + pageNumber = portal.logsView.pageNumber + ), vertx + ) + if (logsResult.succeeded()) { + vertx.eventBus().send( + ArtifactLogUpdated, logsResult.result().copy( + artifactQualifiedName = portal.configuration.artifactQualifiedName + ) + ) +// //todo: impl method filtering in skywalking +// for ((content, logs) in logsResult.result().logs.groupBy { it.content }) { +// SourceMarkSearch.findInheritedSourceMarks(content).forEach { +// vertx.eventBus().send( +// ArtifactLogUpdated, logsResult.result().copy( +// artifactQualifiedName = it.artifactQualifiedName, +// total = logs.size, +// logs = logs, +// ) +// ) +// } +// } + } else { + val replyException = logsResult.cause() as ReplyException + if (replyException.failureCode() == 404) { + log.warn("Failed to fetch logs. Service(s) unavailable") + } else { + log.error("Failed to fetch logs", logsResult.cause()) + } + } + } + } + + private suspend fun refreshOverview(fileMarker: SourceFileMarker, portal: SourcePortal) { + val endpointMarks = fileMarker.getSourceMarks().filterIsInstance().filter { + it.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(it) != null + } + + val fetchMetricTypes = listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla") + val requestDuration = ZonedDuration( + ZonedDateTime.now().minusMinutes(portal.overviewView.timeFrame.minutes.toLong()), + ZonedDateTime.now(), + SkywalkingClient.DurationStep.MINUTE + ) + val endpointMetricResults = mutableListOf() + endpointMarks.forEach { + val metricsRequest = GetEndpointMetrics( + fetchMetricTypes, + it.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(it)!!, + requestDuration + ) + val metrics = EndpointMetricsBridge.getMetrics(metricsRequest, vertx) + val endpointName = it.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointName(it)!! + + val summarizedMetrics = mutableListOf() + for (i in metrics.indices) { + val avg = metrics[i].values.average() + val metricType = MetricType.realValueOf(fetchMetricTypes[i]) + summarizedMetrics.add(ArtifactSummarizedMetrics(metricType, avg)) + } + + endpointMetricResults.add( + ArtifactSummarizedResult( + it.artifactQualifiedName.copy(operationName = endpointName), + summarizedMetrics, + EndpointType.HTTP + ) + ) + } + + vertx.eventBus().send( + UpdateEndpoints(portal.portalUuid), + JsonObject( + Json.encode( + EndpointResult( + portal.overviewView.timeFrame, + start = Instant.fromEpochMilliseconds(requestDuration.start.toInstant().toEpochMilli()), + stop = Instant.fromEpochMilliseconds(requestDuration.stop.toInstant().toEpochMilli()), + step = requestDuration.step.name, + endpointMetricResults + ) + ) + ) + ) + } + + private suspend fun pullLatestActivity(portal: SourcePortal) { + val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) + if (sourceMark != null && sourceMark is MethodSourceMark) { + val endpointId = sourceMark.getUserData(ENDPOINT_DETECTOR)!!.getOrFindEndpointId(sourceMark) + if (endpointId != null) { + pullLatestActivity(portal, endpointId) + } + } + } + + private suspend fun pullLatestActivity(portal: SourcePortal, endpointId: String) { + val endTime = ZonedDateTime.now().plusMinutes(1).truncatedTo(ChronoUnit.MINUTES) + val startTime = endTime.minusMinutes(portal.activityView.timeFrame.minutes.toLong()) + val metricsRequest = GetEndpointMetrics( + listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla"), + endpointId, + ZonedDuration(startTime, endTime, SkywalkingClient.DurationStep.MINUTE) + ) + val metrics = EndpointMetricsBridge.getMetrics(metricsRequest, vertx) + val metricResult = toProtocol( + portal.viewingArtifact, + portal.activityView.timeFrame, + portal.activityView.activeChartMetric, + metricsRequest, + metrics + ) + + val finalArtifactMetrics = metricResult.artifactMetrics.toMutableList() + vertx.eventBus().send(ArtifactMetricsUpdated, metricResult.copy(artifactMetrics = finalArtifactMetrics)) + } + + private fun openPortal(portal: SourcePortal) { + val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) + if (sourceMark != null) { + configureDisplayedPortal(portal) + ApplicationManager.getApplication().invokeLater(sourceMark::displayPopup) + } + } + + private fun configureDisplayedPortal(portal: SourcePortal) { + val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) + if (sourceMark != null) { + val jcefComponent = sourceMark.sourceMarkComponent as SourceMarkJcefComponent + if (portal != lastDisplayedInternalPortal) { + portal.configuration.darkMode = UIManager.getLookAndFeel() !is IntelliJLaf + + val externalEndpoint = sourceMark.getUserData(ENDPOINT_DETECTOR)?.isExternalEndpoint(sourceMark) == true + if (externalEndpoint) { + portal.configuration.config["visibleActivity"] = true + portal.configuration.config["visibleTraces"] = true + portal.configuration.config["visibleLogs"] = true //todo: can hide based on if there is logs + } else { + //non-endpoint artifact; hide activity/traces till manually shown + portal.configuration.config["visibleActivity"] = false + portal.configuration.config["visibleTraces"] = portal.tracesView.innerTraceStack + + //default to logs if method + if (sourceMark is MethodSourceMark && !(portal.configuration.config["visibleTraces"] as Boolean)) { + portal.configuration.config["currentPage"] = PageType.LOGS + } + + //hide overview if class and no child endpoints and default to logs + if (sourceMark is ClassSourceMark) { + val hasChildEndpoints = sourceMark.sourceFileMarker.getSourceMarks().firstOrNull { + it.getUserData(ENDPOINT_DETECTOR)?.getEndpointId(it) != null + } != null + portal.configuration.config["visibleOverview"] = hasChildEndpoints + if (!hasChildEndpoints) { + portal.configuration.config["currentPage"] = PageType.LOGS + } + } + } + + val port = vertx.sharedData().getLocalMap("portal")["http.port"]!! + val host = "http://localhost:$port" + val currentUrl = "$host/?portalUuid=${portal.portalUuid}" + + if (lastDisplayedInternalPortal == null) { + jcefComponent.configuration.initialUrl = currentUrl + } else { + jcefComponent.getBrowser().cefBrowser.executeJavaScript( + "window.location.href = '$currentUrl';", currentUrl, 0 + ) + } + lastDisplayedInternalPortal = portal + } + } + } + + private fun closePortal(portal: SourcePortal) { + val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) + if (sourceMark != null) { + ApplicationManager.getApplication().invokeLater(sourceMark::closePopup) + } + } +} From 744683ae9959a0635ae37bc34b8f472afc6e7b21 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 12:57:35 +0100 Subject: [PATCH 083/115] refactor --- .../jetbrains/sourcemarker/SourceMarkerPlugin.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 0d067487a..1f17ee576 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -94,6 +94,7 @@ import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.SourceServices import spp.protocol.SourceServices.Instance import spp.protocol.marshall.KSerializers +import spp.protocol.portal.PortalConfiguration import spp.protocol.service.LiveInstrumentService import spp.protocol.service.LiveService import spp.protocol.service.LiveViewService @@ -114,6 +115,7 @@ object SourceMarkerPlugin { private val deploymentIds = mutableListOf() val vertx: Vertx private var connectionJob: Job? = null + private var discovery: ServiceDiscovery? = null init { SourceMarker.enabled = false @@ -262,16 +264,13 @@ object SourceMarkerPlugin { } if (connectedMonitor) { - discoverAvailableServices(config, project) initPortal(config) initMarker(config, project) - initMapper() } } } private suspend fun discoverAvailableServices(config: SourceMarkerConfig, project: Project) { - val discovery: ServiceDiscovery val originalClassLoader = Thread.currentThread().contextClassLoader try { Thread.currentThread().contextClassLoader = javaClass.classLoader @@ -288,7 +287,7 @@ object SourceMarkerPlugin { } log.info("Discovering available services") - val availableRecords = discovery.getRecords { true }.await() + val availableRecords = discovery!!.getRecords { true }.await() //live service if (availableRecords.any { it.name == SourceServices.Utilize.LIVE_SERVICE }) { @@ -355,6 +354,11 @@ object SourceMarkerPlugin { TCPServiceDiscoveryBackend.socket?.close()?.await() TCPServiceDiscoveryBackend.socket = null + discovery?.close() + discovery = null + + Instance.clearServices() + ControlBarController.clearAvailableCommands() } private suspend fun initServices(project: Project, config: SourceMarkerConfig) { @@ -395,6 +399,8 @@ object SourceMarkerPlugin { if (resp.statusCode() != 202) { config.serviceToken = body } + + discoverAvailableServices(config, project) } else { config.serviceToken = null } @@ -421,6 +427,8 @@ object SourceMarkerPlugin { val projectSettings = PropertiesComponent.getInstance(project) projectSettings.setValue("sourcemarker_plugin_config", Json.encode(config)) + discoverAvailableServices(config, project) + //auto-established notification Notifications.Bus.notify( Notification( From e3bafe799504deaa4f03d69b83ba204a68e99fad Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 12:58:03 +0100 Subject: [PATCH 084/115] refactor --- .../status/LiveMeterStatusPanel.java | 12 +++++++- .../command/ControlBarController.kt | 30 ++++++++++++------- .../sourcemarker/mark/SourceMarkKeys.kt | 4 +-- .../sourcemarker/status/LiveStatusManager.kt | 30 ++++++++++--------- 4 files changed, 49 insertions(+), 27 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java index 42566efc7..33e5ad017 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LiveMeterStatusPanel.java @@ -3,15 +3,19 @@ import com.intellij.util.ui.UIUtil; import com.jgoodies.forms.factories.FormFactory; import com.jgoodies.forms.layout.*; +import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import org.jetbrains.annotations.NotNull; import spp.jetbrains.marker.source.mark.gutter.GutterMark; import spp.jetbrains.sourcemarker.PluginIcons; import spp.jetbrains.sourcemarker.PluginUI; import spp.jetbrains.sourcemarker.service.InstrumentEventListener; +import spp.jetbrains.sourcemarker.service.ViewEventListener; import spp.protocol.instrument.LiveMeter; import spp.protocol.instrument.event.LiveInstrumentEvent; +import spp.protocol.instrument.event.LiveInstrumentEventType; import spp.protocol.instrument.meter.MeterType; +import spp.protocol.view.LiveViewEvent; import javax.swing.*; import javax.swing.border.EtchedBorder; @@ -24,7 +28,7 @@ import static spp.jetbrains.sourcemarker.status.util.ViewUtils.addRecursiveMouseListener; import static spp.protocol.SourceServices.Instance.INSTANCE; -public class LiveMeterStatusPanel extends JPanel implements InstrumentEventListener { +public class LiveMeterStatusPanel extends JPanel implements InstrumentEventListener, ViewEventListener { private final LiveMeter liveMeter; private final GutterMark gutterMark; @@ -59,6 +63,7 @@ public LiveMeterStatusPanel(LiveMeter liveMeter, GutterMark gutterMark) { dayLabel.setVisible(false); dayValueLabel.setVisible(false); } + LiveStatusManager.addViewEventListener(gutterMark, this); } @Override @@ -69,6 +74,11 @@ public void accept(@NotNull LiveInstrumentEvent event) { dayValueLabel.setText(getShortNumber(rawMetrics.getString("last_day"))); } + @Override + public void accept(@NotNull LiveViewEvent event) { + accept(new LiveInstrumentEvent(LiveInstrumentEventType.METER_UPDATED, Json.encode(event))); + } + private String getShortNumber(String number) { long value = Long.parseLong(number); if (value > 1000000) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt index ee9164aa6..7fe1a7221 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt @@ -54,17 +54,27 @@ object ControlBarController { private val log = LoggerFactory.getLogger(ControlBarController::class.java) private var previousControlBar: InlayMark? = null - private val availableCommands by lazy { - runBlocking { - val selfInfo = SourceServices.Instance.liveService!!.getSelf().await() - LiveControlCommand.values().toList().filter { - @Suppress("UselessCallOnCollection") //unknown enums are null - selfInfo.permissions.filterNotNull().map { it.name }.contains(it.name) - } - } + private val availableCommands: MutableList = mutableListOf() + + fun clearAvailableCommands() { + availableCommands.clear() + } + + private suspend fun syncAvailableCommands() { + availableCommands.clear() + + val selfInfo = SourceServices.Instance.liveService!!.getSelf().await() + availableCommands.addAll(LiveControlCommand.values().toList().filter { + @Suppress("UselessCallOnCollection") //unknown enums are null + selfInfo.permissions.filterNotNull().map { it.name }.contains(it.name) + }) } - private fun determineAvailableCommands(inlayMark: ExpressionInlayMark): List { + private fun determineAvailableCommandsAtLocation(inlayMark: ExpressionInlayMark): List { + if (availableCommands.isEmpty()) { + runBlocking { syncAvailableCommands() } + } + val availableCommandsAtLocation = availableCommands.toMutableList() val parentMark = inlayMark.getParentSourceMark() if (parentMark is MethodSourceMark) { @@ -265,7 +275,7 @@ object ControlBarController { val wrapperPanel = JPanel() wrapperPanel.layout = BorderLayout() - val controlBar = ControlBar(editor, inlayMark, determineAvailableCommands(inlayMark)) + val controlBar = ControlBar(editor, inlayMark, determineAvailableCommandsAtLocation(inlayMark)) wrapperPanel.add(controlBar) editor.scrollingModel.addVisibleAreaListener(controlBar) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt index c93c6f75a..7e3cfe9e8 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkKeys.kt @@ -19,7 +19,7 @@ package spp.jetbrains.sourcemarker.mark import spp.jetbrains.marker.jvm.psi.EndpointDetector import spp.jetbrains.marker.jvm.psi.LoggerDetector -import spp.jetbrains.marker.portal.SourcePortal +import spp.protocol.portal.PortalConfiguration import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.key.SourceKey import spp.jetbrains.sourcemarker.service.InstrumentEventListener @@ -33,7 +33,7 @@ import spp.jetbrains.sourcemarker.status.StatusBar * @author [Brandon Fergerson](mailto:bfergerson@apache.org) */ object SourceMarkKeys { - val SOURCE_PORTAL = SourceKey("SOURCE_PORTAL") + val PORTAL_CONFIGURATION = SourceKey("PORTAL_CONFIGURATION") val ENDPOINT_DETECTOR = SourceKey("ENDPOINT_DETECTOR") val LOGGER_DETECTOR = SourceKey("LOGGER_DETECTOR") val INSTRUMENT_ID = SourceKey("INSTRUMENT_ID") diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index 8ad259920..d82e76ff8 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -412,20 +412,6 @@ object LiveStatusManager : SourceMarkEventListener { @JvmStatic fun showMeterStatusIcon(liveMeter: LiveMeter, sourceFileMarker: SourceFileMarker) { - SourceServices.Instance.liveView!!.addLiveViewSubscription( - LiveViewSubscription( - null, - listOf(liveMeter.toMetricId()), - ArtifactQualifiedName(liveMeter.location.source, type = ArtifactType.EXPRESSION), - liveMeter.location, - LiveViewConfig("LIVE_METER", listOf("last_minute", "last_hour", "last_day")) - ) - ).onComplete { - if (it.failed()) { - log.error("Failed to add live view subscription", it.cause()) - } - } - //create gutter popup ApplicationManager.getApplication().runReadAction { val gutterMark = creationService.getOrCreateExpressionGutterMark( @@ -453,6 +439,22 @@ object LiveStatusManager : SourceMarkEventListener { } gutterMark.get().apply(true) addStatusBar(gutterMark.get(), statusBar) + + SourceServices.Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + listOf(liveMeter.toMetricId()), + ArtifactQualifiedName(liveMeter.location.source, type = ArtifactType.EXPRESSION), + liveMeter.location, + LiveViewConfig("LIVE_METER", listOf("last_minute", "last_hour", "last_day")) + ) + ).onComplete { + if (it.succeeded()) { + gutterMark.get().putUserData(VIEW_SUBSCRIPTION_ID, it.result().subscriptionId) + } else { + log.error("Failed to add live view subscription", it.cause()) + } + } } else { log.error("Could not create gutter mark for live meter") } From 9dd788c356d4200528137c0a857d616299499cfd Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 12:59:38 +0100 Subject: [PATCH 085/115] bump --- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index ab42cb026..f9bb320a1 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:e540bbcccb") + compileOnly("com.github.sourceplusplus.protocol:protocol:a2cd759830") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 1691ee6c2..4d285297f 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:e540bbcccb") + compileOnly("com.github.sourceplusplus.protocol:protocol:a2cd759830") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index ec603da2a..faf1e454c 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:e540bbcccb") + compileOnly("com.github.sourceplusplus.protocol:protocol:a2cd759830") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index bc0333dd6..56ceb9162 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:e540bbcccb") + implementation("com.github.sourceplusplus.protocol:protocol:a2cd759830") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 2c521f838..e347885e6 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4cd858772b") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:e540bbcccb") + implementation("com.github.sourceplusplus.protocol:protocol:a2cd759830") } implementation("org.jooq:joor:$joorVersion") From 83b4534d2cea7cd418dde7e4d6114cbd72b8f878 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 13:00:56 +0100 Subject: [PATCH 086/115] refactor --- .../main/kotlin/spp/jetbrains/marker/SourceMarker.kt | 10 ++++++++-- .../config/SourceMarkJcefComponentConfiguration.kt | 2 ++ .../source/mark/api/event/SourceMarkEventCode.kt | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/SourceMarker.kt b/marker/src/main/kotlin/spp/jetbrains/marker/SourceMarker.kt index df0b24906..77de1777f 100755 --- a/marker/src/main/kotlin/spp/jetbrains/marker/SourceMarker.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/SourceMarker.kt @@ -25,7 +25,9 @@ import org.slf4j.LoggerFactory import spp.jetbrains.marker.source.SourceFileMarker import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventListener +import spp.protocol.artifact.ArtifactNameUtils import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType /** * todo: description. @@ -111,11 +113,15 @@ object SourceMarker { } } - fun getSourceFileMarker(classQualifiedName: ArtifactQualifiedName): SourceFileMarker? { + fun getSourceFileMarker(artifactQualifiedName: ArtifactQualifiedName): SourceFileMarker? { check(enabled) { "SourceMarker disabled" } + val classArtifactQualifiedName = artifactQualifiedName.copy( + identifier = ArtifactNameUtils.getQualifiedClassName(artifactQualifiedName.identifier)!!, + type = ArtifactType.CLASS + ) return availableSourceFileMarkers.values.find { - namingService.getClassQualifiedNames(it.psiFile).contains(classQualifiedName) + namingService.getClassQualifiedNames(it.psiFile).contains(classArtifactQualifiedName) } } diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/component/jcef/config/SourceMarkJcefComponentConfiguration.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/component/jcef/config/SourceMarkJcefComponentConfiguration.kt index a1eb4776f..0d5da08f0 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/component/jcef/config/SourceMarkJcefComponentConfiguration.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/component/jcef/config/SourceMarkJcefComponentConfiguration.kt @@ -32,6 +32,7 @@ import java.awt.Dimension class SourceMarkJcefComponentConfiguration : SourceMarkComponentConfiguration() { var preloadJcefBrowser: Boolean = true + var currentUrl: String = "about:blank" var initialUrl: String = "about:blank" var initialHtml: String? = null var componentWidth: Int = 400 @@ -56,6 +57,7 @@ class SourceMarkJcefComponentConfiguration : SourceMarkComponentConfiguration() copy.componentSizeEvaluator = componentSizeEvaluator copy.preloadJcefBrowser = preloadJcefBrowser + copy.currentUrl = currentUrl copy.initialUrl = initialUrl copy.initialHtml = initialHtml copy.componentWidth = componentWidth diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEventCode.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEventCode.kt index 23e46c48c..c76501d46 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEventCode.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEventCode.kt @@ -33,7 +33,8 @@ enum class SourceMarkEventCode(private val code: Int) : IEventCode { NAME_CHANGED(1003), PORTAL_OPENING(1004), PORTAL_OPENED(1005), - PORTAL_CLOSED(1006); + PORTAL_CLOSED(1006), + UPDATE_PORTAL_CONFIG(1007); override fun code(): Int { return this.code From 003c30eb5082bda188879c14079101cb3c447e01 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 16:29:24 +0100 Subject: [PATCH 087/115] reimpl portal --- .../sourcemarker/SourceMarkerPlugin.kt | 2 +- .../listeners/PortalEventListener.kt | 183 ++++++++++++++++-- 2 files changed, 164 insertions(+), 21 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 1f17ee576..35b46ce5c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -463,7 +463,7 @@ object SourceMarkerPlugin { module.addDeserializer(Instant::class.java, KSerializers.KotlinInstantDeserializer()) DatabindCodec.mapper().registerModule(module) - val portalServer = PortalServer() + val portalServer = PortalServer(0) deploymentIds.add(vertx.deployVerticle(portalServer).await()) deploymentIds.add(vertx.deployVerticle(PortalEventListener(config)).await()) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt index b78d3d0ee..812347e00 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt @@ -24,11 +24,15 @@ import com.intellij.openapi.project.ProjectManager import io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND import io.vertx.core.eventbus.ReplyException import io.vertx.core.json.Json +import io.vertx.core.json.JsonArray import io.vertx.core.json.JsonObject +import io.vertx.ext.auth.impl.jose.JWT import io.vertx.kotlin.coroutines.CoroutineVerticle import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.launch import kotlinx.datetime.Instant +import kotlinx.datetime.toJavaInstant +import kotlinx.datetime.toKotlinInstant import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.jvm.ArtifactNavigator @@ -80,16 +84,28 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR import spp.jetbrains.sourcemarker.search.SourceMarkSearch import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.SourceServices.Instance +import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.QueryTimeFrame import spp.protocol.artifact.exception.LiveStackTraceElement +import spp.protocol.artifact.log.Log +import spp.protocol.artifact.log.LogOrderType +import spp.protocol.artifact.log.LogResult +import spp.protocol.artifact.metrics.ArtifactMetricResult +import spp.protocol.artifact.metrics.ArtifactMetrics import spp.protocol.artifact.metrics.MetricType +import spp.protocol.artifact.trace.Trace +import spp.protocol.artifact.trace.TraceOrderType import spp.protocol.artifact.trace.TraceResult import spp.protocol.artifact.trace.TraceSpan import spp.protocol.instrument.LiveSourceLocation import spp.protocol.view.LiveViewConfig +import spp.protocol.view.LiveViewEvent import spp.protocol.view.LiveViewSubscription import java.net.URI +import java.time.ZoneOffset import java.time.ZonedDateTime +import java.time.format.DateTimeFormatterBuilder import java.time.temporal.ChronoUnit import javax.swing.UIManager @@ -109,6 +125,10 @@ class PortalEventListener( private val log = LoggerFactory.getLogger(PortalEventListener::class.java) } + private val formatter = DateTimeFormatterBuilder() + .appendPattern("yyyyMMddHHmm") + .toFormatter() + .withZone(ZoneOffset.UTC) //todo: load from SkywalkingMonitor private var lastDisplayedInternalPortal: SourcePortal? = null override suspend fun start() { @@ -126,6 +146,21 @@ class PortalEventListener( } } + //listen to live view events + var developer = "system" + if (markerConfig.serviceToken != null) { + val json = JWT.parse(markerConfig.serviceToken) + developer = json.getJsonObject("payload").getString("developer_id") + } + vertx.eventBus().consumer(toLiveViewSubscriberAddress(developer)) { + val event = Json.decodeValue(it.body().toString(), LiveViewEvent::class.java) + when (event.viewConfig.viewName) { + "LOGS" -> launch(vertx.dispatcher()) { consumeLogsViewEvent(event) } + "TRACES" -> consumeTracesViewEvent(event) + "ACTIVITY" -> consumeActivityViewEvent(event) + } + } + vertx.eventBus().consumer(RefreshPortal) { val portal = if (it.body() is String) { SourcePortal.getPortal(it.body() as String) @@ -277,7 +312,9 @@ class PortalEventListener( LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) ) ).onComplete { - if (it.failed()) { + if (it.succeeded()) { + portal.configuration.config["subscriptionId"] = it.result().subscriptionId!! + } else { log.error("Failed to add live view subscription", it.cause()) } } @@ -316,7 +353,9 @@ class PortalEventListener( LiveViewConfig("TRACES", listOf("endpoint_traces")) ) ).onComplete { - if (it.failed()) { + if (it.succeeded()) { + portal.configuration.config["subscriptionId"] = it.result().subscriptionId!! + } else { log.error("Failed to add live view subscription", it.cause()) } } @@ -365,7 +404,9 @@ class PortalEventListener( LiveViewConfig("LOGS", listOf("endpoint_logs")) ) ).onComplete { - if (it.failed()) { + if (it.succeeded()) { + portal.configuration.config["subscriptionId"] = it.result().subscriptionId!! + } else { log.error("Failed to add live view subscription", it.cause()) } } @@ -500,23 +541,18 @@ class PortalEventListener( ), vertx ) if (logsResult.succeeded()) { - vertx.eventBus().send( - ArtifactLogUpdated, logsResult.result().copy( - artifactQualifiedName = portal.configuration.artifactQualifiedName - ) - ) -// //todo: impl method filtering in skywalking -// for ((content, logs) in logsResult.result().logs.groupBy { it.content }) { -// SourceMarkSearch.findInheritedSourceMarks(content).forEach { -// vertx.eventBus().send( -// ArtifactLogUpdated, logsResult.result().copy( -// artifactQualifiedName = it.artifactQualifiedName, -// total = logs.size, -// logs = logs, -// ) -// ) -// } -// } + //todo: impl method filtering in skywalking + for ((content, logs) in logsResult.result().logs.groupBy { it.content }) { + SourceMarkSearch.findInheritedSourceMarks(content).forEach { + vertx.eventBus().send( + ArtifactLogUpdated, logsResult.result().copy( + artifactQualifiedName = it.artifactQualifiedName, + total = logs.size, + logs = logs, + ) + ) + } + } } else { val replyException = logsResult.cause() as ReplyException if (replyException.failureCode() == 404) { @@ -670,6 +706,113 @@ class PortalEventListener( } } + private fun consumeTracesViewEvent(event: LiveViewEvent) { + val portal = SourcePortal.getPortals().find { + it.configuration.config["subscriptionId"] == event.subscriptionId + } ?: return + + val rawMetrics = JsonObject(event.metricsData) + val trace = Json.decodeValue(rawMetrics.getJsonObject("trace").toString(), Trace::class.java) + val traceResult = TraceResult( + portal.viewingArtifact, + null, + TraceOrderType.LATEST_TRACES, + trace.start, + trace.start.toJavaInstant().minusMillis(trace.duration.toLong()).toKotlinInstant(), + "minute", + listOf(trace), + Int.MAX_VALUE + ) + vertx.eventBus().send(ArtifactTracesUpdated, traceResult) + + val url = trace.meta["url"] + val httpMethod = trace.meta["http.method"] + if (url != null && httpMethod != null) { + val updatedEndpointName = "$httpMethod:${URI(url).path}" + val entrySpan = Json.decodeValue(trace.meta["entrySpan"], TraceSpan::class.java) + vertx.eventBus().send( + TraceSpanUpdated, entrySpan.copy( + endpointName = updatedEndpointName, + artifactQualifiedName = event.artifactQualifiedName + ) + ) + } + } + + private suspend fun consumeLogsViewEvent(event: LiveViewEvent) { + val rawMetrics = JsonObject(event.metricsData) + val logData = Json.decodeValue(rawMetrics.getJsonObject("log").toString(), Log::class.java) + val logsResult = LogResult( + event.artifactQualifiedName, + LogOrderType.NEWEST_LOGS, + logData.timestamp, + listOf(logData), + Int.MAX_VALUE + ) + for ((content, logs) in logsResult.logs.groupBy { it.content }) { + SourceMarkSearch.findInheritedSourceMarks(content).forEach { + vertx.eventBus().send( + ArtifactLogUpdated, logsResult.copy( + artifactQualifiedName = it.artifactQualifiedName, + total = logs.size, + logs = logs, + ) + ) + } + } + } + + private fun consumeActivityViewEvent(event: LiveViewEvent) { + val portal = SourcePortal.getPortals().find { + it.configuration.config["subscriptionId"] == event.subscriptionId + } ?: return + + val artifactMetrics = toArtifactMetrics(event) + val metricResult = ArtifactMetricResult( + portal.viewingArtifact, + QueryTimeFrame.valueOf(1), + portal.activityView.activeChartMetric, //todo: assumes activity view + formatter.parse(event.timeBucket, java.time.Instant::from).toKotlinInstant(), + formatter.parse(event.timeBucket, java.time.Instant::from).plusSeconds(60).toKotlinInstant(), + "minute", + artifactMetrics, + true + ) + vertx.eventBus().send(ArtifactMetricsUpdated, metricResult) + } + + private fun toArtifactMetrics(event: LiveViewEvent): List { + val rawMetrics = mutableListOf() + if (event.viewConfig.viewMetrics.size > 1) { + val multiMetrics = JsonArray(event.metricsData) + for (i in 0 until multiMetrics.size()) { + val metricsName = multiMetrics.getJsonObject(i).getJsonObject("meta").getString("metricsName") + val value = when (MetricType.realValueOf(metricsName)) { + MetricType.Throughput_Average -> multiMetrics.getJsonObject(i) + .getInteger("value") + MetricType.ResponseTime_Average -> multiMetrics.getJsonObject(i) + .getInteger("value") + MetricType.ServiceLevelAgreement_Average -> multiMetrics.getJsonObject(i) + .getInteger("percentage") + else -> TODO(metricsName) + } + rawMetrics.add(value) + } + } else { + val value = when (val metricType = MetricType.realValueOf(event.viewConfig.viewMetrics.first())) { + MetricType.Throughput_Average -> JsonObject(event.metricsData).getInteger("value") + MetricType.ResponseTime_Average -> JsonObject(event.metricsData).getInteger("value") + MetricType.ServiceLevelAgreement_Average -> JsonObject(event.metricsData).getInteger("percentage") + else -> TODO(metricType.name) + } + rawMetrics.add(value) + } + val artifactMetrics = rawMetrics.mapIndexed { i: Int, it: Int -> + ArtifactMetrics(MetricType.realValueOf(event.viewConfig.viewMetrics[i]), listOf(it.toDouble())) + } + return artifactMetrics + } + private fun closePortal(portal: SourcePortal) { val sourceMark = SourceMarker.getSourceMark(portal.viewingArtifact, SourceMark.Type.GUTTER) if (sourceMark != null) { From d532d32c828ed0b7232ceafc5fc13c6a623b61e3 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 16:42:10 +0100 Subject: [PATCH 088/115] move portal code --- .../sourcemarker/SourceMarkerPlugin.kt | 75 +---------------- .../sourcemarker/portal/PortalController.kt | 83 +++++++++++++++++++ .../PortalEventListener.kt | 2 +- 3 files changed, 88 insertions(+), 72 deletions(-) create mode 100644 plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/{listeners => portal}/PortalEventListener.kt (99%) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 35b46ce5c..2e7eb16e1 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -19,10 +19,8 @@ package spp.jetbrains.sourcemarker import com.apollographql.apollo3.exception.ApolloHttpException import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.dataformat.yaml.YAMLMapper import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer -import com.intellij.ide.ui.laf.IntelliJLaf import com.intellij.ide.util.PropertiesComponent import com.intellij.notification.Notification import com.intellij.notification.NotificationType @@ -41,7 +39,6 @@ import io.vertx.core.http.RequestOptions import io.vertx.core.json.DecodeException import io.vertx.core.json.Json import io.vertx.core.json.JsonObject -import io.vertx.core.json.jackson.DatabindCodec import io.vertx.core.net.TrustOptions import io.vertx.kotlin.coroutines.await import io.vertx.kotlin.coroutines.dispatcher @@ -53,7 +50,6 @@ import kotlinx.coroutines.CancellationException import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.Job import kotlinx.coroutines.launch -import kotlinx.datetime.Instant import org.apache.commons.text.CaseUtils import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker @@ -64,25 +60,17 @@ import spp.jetbrains.marker.py.PythonArtifactScopeService import spp.jetbrains.marker.py.PythonConditionParser import spp.jetbrains.marker.source.mark.api.component.api.config.ComponentSizeEvaluator import spp.jetbrains.marker.source.mark.api.component.api.config.SourceMarkComponentConfiguration -import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkSingleJcefComponentProvider -import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode import spp.jetbrains.marker.source.mark.api.filter.CreateSourceMarkFilter import spp.jetbrains.marker.source.mark.gutter.config.GutterMarkConfiguration import spp.jetbrains.monitor.skywalking.SkywalkingMonitor -import spp.jetbrains.portal.SourcePortal -import spp.jetbrains.portal.backend.PortalServer -import spp.jetbrains.portal.protocol.portal.PageType import spp.jetbrains.sourcemarker.PluginBundle.message import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.INTELLIJ_PRODUCT_CODES import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.PYCHARM_PRODUCT_CODES import spp.jetbrains.sourcemarker.command.ControlBarController -import spp.jetbrains.sourcemarker.command.LiveControlCommand -import spp.jetbrains.sourcemarker.command.LiveControlCommand.* import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.listeners.PluginSourceMarkEventListener -import spp.jetbrains.sourcemarker.listeners.PortalEventListener -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys +import spp.jetbrains.sourcemarker.portal.PortalController import spp.jetbrains.sourcemarker.service.LiveInstrumentManager import spp.jetbrains.sourcemarker.service.LiveViewManager import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService @@ -93,14 +81,11 @@ import spp.jetbrains.sourcemarker.settings.serviceHostNormalized import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.SourceServices import spp.protocol.SourceServices.Instance -import spp.protocol.marshall.KSerializers -import spp.protocol.portal.PortalConfiguration import spp.protocol.service.LiveInstrumentService import spp.protocol.service.LiveService import spp.protocol.service.LiveViewService import java.awt.Dimension import java.io.File -import javax.swing.UIManager /** * Sets up the SourceMarker plugin by configuring and initializing the various plugin modules. @@ -264,7 +249,7 @@ object SourceMarkerPlugin { } if (connectedMonitor) { - initPortal(config) + initUI(config) initMarker(config, project) } } @@ -455,60 +440,8 @@ object SourceMarkerPlugin { ) } - private suspend fun initPortal(config: SourceMarkerConfig) { - log.info("Initializing portal") - - val module = SimpleModule() - module.addSerializer(Instant::class.java, KSerializers.KotlinInstantSerializer()) - module.addDeserializer(Instant::class.java, KSerializers.KotlinInstantDeserializer()) - DatabindCodec.mapper().registerModule(module) - - val portalServer = PortalServer(0) - deploymentIds.add(vertx.deployVerticle(portalServer).await()) - deploymentIds.add(vertx.deployVerticle(PortalEventListener(config)).await()) - - SourceMarker.addGlobalSourceMarkEventListener { - if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED) { - //todo: only register when needed - //register portal for source mark - val portal = SourcePortal.getPortal( - SourcePortal.register(it.sourceMark.artifactQualifiedName, false) - )!! - it.sourceMark.putUserData(SourceMarkKeys.PORTAL_CONFIGURATION, portal.configuration) - portal.configuration.config["visibleOverview"] = it.sourceMark.isClassMark - portal.configuration.config["visibleActivity"] = true - portal.configuration.config["visibleTraces"] = true - portal.configuration.config["visibleLogs"] = true - portal.configuration.config["visibleConfiguration"] = false - - val genUrl = "http://localhost:${portalServer.serverPort}?portalUuid=${portal.portalUuid}" - it.sourceMark.addEventListener { - if (it.eventCode == SourceMarkEventCode.UPDATE_PORTAL_CONFIG) { - when (val command = it.params.first() as LiveControlCommand) { - VIEW_ACTIVITY -> portal.configuration.config["currentPage"] = PageType.ACTIVITY - VIEW_TRACES -> portal.configuration.config["currentPage"] = PageType.TRACES - VIEW_LOGS -> portal.configuration.config["currentPage"] = PageType.LOGS - else -> throw UnsupportedOperationException("Command input: $command") - } - - val jcefComponent = it.sourceMark.sourceMarkComponent as SourceMarkJcefComponent - jcefComponent.configuration.currentUrl = "#" - } else if (it.eventCode == SourceMarkEventCode.PORTAL_OPENING) { - val jcefComponent = it.sourceMark.sourceMarkComponent as SourceMarkJcefComponent - portal.configuration.darkMode = UIManager.getLookAndFeel() !is IntelliJLaf - - if (jcefComponent.configuration.currentUrl != genUrl) { - jcefComponent.configuration.initialUrl = genUrl - jcefComponent.configuration.currentUrl = genUrl - jcefComponent.getBrowser().cefBrowser.executeJavaScript( - "window.location.href = '$genUrl';", genUrl, 0 - ) - } - ApplicationManager.getApplication().invokeLater(it.sourceMark::displayPopup) - } - } - } - } + private suspend fun initUI(config: SourceMarkerConfig) { + vertx.deployVerticle(PortalController(config)).await() } private fun initMarker(config: SourceMarkerConfig, project: Project) { diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt new file mode 100644 index 000000000..afd9c5f01 --- /dev/null +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt @@ -0,0 +1,83 @@ +package spp.jetbrains.sourcemarker.portal + +import com.fasterxml.jackson.databind.module.SimpleModule +import com.intellij.ide.ui.laf.IntelliJLaf +import com.intellij.openapi.application.ApplicationManager +import io.vertx.core.json.jackson.DatabindCodec +import io.vertx.kotlin.coroutines.CoroutineVerticle +import io.vertx.kotlin.coroutines.await +import kotlinx.datetime.Instant +import org.slf4j.LoggerFactory +import spp.jetbrains.marker.SourceMarker +import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent +import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode +import spp.jetbrains.portal.SourcePortal +import spp.jetbrains.portal.backend.PortalServer +import spp.jetbrains.portal.protocol.portal.PageType +import spp.jetbrains.sourcemarker.command.LiveControlCommand +import spp.jetbrains.sourcemarker.command.LiveControlCommand.* +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys +import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig +import spp.protocol.marshall.KSerializers +import javax.swing.UIManager + +class PortalController(private val markerConfig: SourceMarkerConfig) : CoroutineVerticle() { + + private val log = LoggerFactory.getLogger(PortalController::class.java) + + override suspend fun start() { + log.info("Initializing portal") + + val module = SimpleModule() + module.addSerializer(Instant::class.java, KSerializers.KotlinInstantSerializer()) + module.addDeserializer(Instant::class.java, KSerializers.KotlinInstantDeserializer()) + DatabindCodec.mapper().registerModule(module) + + val portalServer = PortalServer(0) + vertx.deployVerticle(portalServer).await() + vertx.deployVerticle(PortalEventListener(markerConfig)).await() + + SourceMarker.addGlobalSourceMarkEventListener { + if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED) { + //todo: only register when needed + //register portal for source mark + val portal = SourcePortal.getPortal( + SourcePortal.register(it.sourceMark.artifactQualifiedName, false) + )!! + it.sourceMark.putUserData(SourceMarkKeys.PORTAL_CONFIGURATION, portal.configuration) + portal.configuration.config["visibleOverview"] = it.sourceMark.isClassMark + portal.configuration.config["visibleActivity"] = true + portal.configuration.config["visibleTraces"] = true + portal.configuration.config["visibleLogs"] = true + portal.configuration.config["visibleConfiguration"] = false + + val genUrl = "http://localhost:${portalServer.serverPort}?portalUuid=${portal.portalUuid}" + it.sourceMark.addEventListener { + if (it.eventCode == SourceMarkEventCode.UPDATE_PORTAL_CONFIG) { + when (val command = it.params.first() as LiveControlCommand) { + VIEW_ACTIVITY -> portal.configuration.config["currentPage"] = PageType.ACTIVITY + VIEW_TRACES -> portal.configuration.config["currentPage"] = PageType.TRACES + VIEW_LOGS -> portal.configuration.config["currentPage"] = PageType.LOGS + else -> throw UnsupportedOperationException("Command input: $command") + } + + val jcefComponent = it.sourceMark.sourceMarkComponent as SourceMarkJcefComponent + jcefComponent.configuration.currentUrl = "#" + } else if (it.eventCode == SourceMarkEventCode.PORTAL_OPENING) { + val jcefComponent = it.sourceMark.sourceMarkComponent as SourceMarkJcefComponent + portal.configuration.darkMode = UIManager.getLookAndFeel() !is IntelliJLaf + + if (jcefComponent.configuration.currentUrl != genUrl) { + jcefComponent.configuration.initialUrl = genUrl + jcefComponent.configuration.currentUrl = genUrl + jcefComponent.getBrowser().cefBrowser.executeJavaScript( + "window.location.href = '$genUrl';", genUrl, 0 + ) + } + ApplicationManager.getApplication().invokeLater(it.sourceMark::displayPopup) + } + } + } + } + } +} diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt similarity index 99% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt index 812347e00..73aadb447 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.listeners +package spp.jetbrains.sourcemarker.portal import com.intellij.ide.ui.laf.IntelliJLaf import com.intellij.openapi.application.ApplicationManager From ac2c2c42c011f37357c3ab399bae821c3b1c2d83 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 16:43:05 +0100 Subject: [PATCH 089/115] license --- .../sourcemarker/portal/PortalController.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt index afd9c5f01..93a0ae463 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt @@ -1,3 +1,20 @@ +/* + * Source++, the open-source live coding platform. + * Copyright (C) 2022 CodeBrig, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ package spp.jetbrains.sourcemarker.portal import com.fasterxml.jackson.databind.module.SimpleModule From b951f893cdd4cb2eb93689d380b882a547d33686 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 16:56:59 +0100 Subject: [PATCH 090/115] sw live service --- .../monitor/skywalking/SkywalkingMonitor.kt | 8 +++ .../skywalking/service/SWLiveService.kt | 58 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/service/SWLiveService.kt diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt index ed7242893..52332b78c 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/SkywalkingMonitor.kt @@ -27,6 +27,8 @@ import monitor.skywalking.protocol.metadata.GetTimeInfoQuery import okhttp3.OkHttpClient import org.slf4j.LoggerFactory import spp.jetbrains.monitor.skywalking.bridge.* +import spp.jetbrains.monitor.skywalking.service.SWLiveService +import spp.protocol.SourceServices import java.security.SecureRandom import java.security.cert.X509Certificate import javax.net.ssl.SSLContext @@ -113,6 +115,12 @@ class SkywalkingMonitor( vertx.deployVerticle(EndpointMetricsBridge(skywalkingClient)).await() vertx.deployVerticle(EndpointTracesBridge(skywalkingClient)).await() vertx.deployVerticle(LogsBridge(skywalkingClient)).await() + + if (SourceServices.Instance.liveService == null) { + val swLiveService = SWLiveService() + vertx.deployVerticle(swLiveService).await() + SourceServices.Instance.liveService = swLiveService + } } } } diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/service/SWLiveService.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/service/SWLiveService.kt new file mode 100644 index 000000000..b743a45c4 --- /dev/null +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/service/SWLiveService.kt @@ -0,0 +1,58 @@ +/* + * Source++, the open-source live coding platform. + * Copyright (C) 2022 CodeBrig, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package spp.jetbrains.monitor.skywalking.service + +import io.vertx.core.Future +import io.vertx.core.Promise +import io.vertx.kotlin.coroutines.CoroutineVerticle +import io.vertx.kotlin.coroutines.dispatcher +import kotlinx.coroutines.launch +import spp.jetbrains.monitor.skywalking.bridge.ServiceBridge +import spp.protocol.platform.auth.RolePermission +import spp.protocol.platform.developer.Developer +import spp.protocol.platform.developer.SelfInfo +import spp.protocol.platform.general.Service +import spp.protocol.platform.status.ActiveInstance +import spp.protocol.service.LiveService + +class SWLiveService : CoroutineVerticle(), LiveService { + + override fun getSelf(): Future { + return Future.succeededFuture( + SelfInfo( + Developer("system"), + emptyList(), + RolePermission.values().filter { it.name.startsWith("VIEW_") }, + emptyList() + ) + ) + } + + override fun getServices(): Future> { + val promise = Promise.promise>() + launch(vertx.dispatcher()) { + val services = ServiceBridge.getActiveServices(vertx) + promise.complete(services.map { Service(it.id, it.name) }) + } + return promise.future() + } + + override fun getActiveProbes(): Future> { + TODO("Not yet implemented") + } +} From f43f48fee330bb4939e19d73d73d0cb2f7a8c360 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 10 Mar 2022 16:57:44 +0100 Subject: [PATCH 091/115] bump --- plugin/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index e347885e6..6ed2d3afa 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -62,7 +62,7 @@ dependencies { implementation(project(":marker:jvm-marker")) implementation(project(":marker:py-marker")) implementation(project(":monitor")) - implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4cd858772b") { isTransitive = false } + implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4d03b0b769") { isTransitive = false } implementation("com.github.sourceplusplus.protocol:protocol:a2cd759830") } From 5e0d3bcaf2063e41ae0ebdf1cda6fe97bbbc0126 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 11 Mar 2022 15:41:23 +0100 Subject: [PATCH 092/115] move packages --- .../sourcemarker/status/BreakpointStatusBar.java | 4 ++-- .../jetbrains/sourcemarker/status/LogStatusBar.java | 4 ++-- .../jetbrains/sourcemarker/status/MeterStatusBar.java | 2 +- .../jetbrains/sourcemarker/status/SpanStatusBar.java | 2 +- .../spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt | 6 +++--- .../PluginSourceMarkEventListener.kt | 2 +- .../sourcemarker/{search => mark}/SourceMarkSearch.kt | 3 +-- .../sourcemarker/portal/PortalEventListener.kt | 2 +- .../sourcemarker/service/LiveInstrumentManager.kt | 9 ++++----- .../jetbrains/sourcemarker/service/LiveViewManager.kt | 4 ++-- .../discover/TCPServiceDiscoveryBackend.kt | 2 +- .../breakpoint/BreakpointEventColumnInfo.kt | 2 +- .../breakpoint/BreakpointHitColumnInfo.kt | 2 +- .../breakpoint/BreakpointHitWindowService.kt | 8 ++++---- .../breakpoint/BreakpointTriggerListener.kt | 2 +- .../breakpoint/DebugStackFrameListener.kt | 2 +- .../breakpoint/ExecutionPointManager.kt | 2 +- .../breakpoint/LiveBreakpointConstants.kt | 2 +- .../{ => instrument}/breakpoint/StackFrameManager.kt | 2 +- .../breakpoint/painter/VariableEditorLinePainter.kt | 4 ++-- .../breakpoint/tree/VariableRootSimpleNode.kt | 4 ++-- .../breakpoint/tree/VariableSimpleTreeStructure.kt | 4 ++-- .../breakpoint/ui/BreakpointHitWindow.kt | 10 +++++----- .../{ => instrument}/breakpoint/ui/EventsTab.kt | 6 +++--- .../{ => instrument}/breakpoint/ui/EventsWindow.kt | 8 ++++---- .../{ => instrument}/breakpoint/ui/FramesTab.kt | 6 +++--- .../{ => instrument}/breakpoint/ui/VariableTab.kt | 8 ++++---- .../service/{ => instrument}/log/LogHitColumnInfo.kt | 2 +- .../service/{ => instrument}/log/VariableParser.kt | 2 +- .../sourcemarker/status/util/AutocompleteField.kt | 2 +- plugin/src/main/resources/META-INF/plugin.xml | 4 ++-- ....vertx.servicediscovery.spi.ServiceDiscoveryBackend | 2 +- .../service/{ => instrument}/log/VariableParserTest.kt | 2 +- 33 files changed, 62 insertions(+), 64 deletions(-) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/{listeners => mark}/PluginSourceMarkEventListener.kt (98%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/{search => mark}/SourceMarkSearch.kt (98%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/{ => service}/discover/TCPServiceDiscoveryBackend.kt (99%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/BreakpointEventColumnInfo.kt (98%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/BreakpointHitColumnInfo.kt (98%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/BreakpointHitWindowService.kt (94%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/BreakpointTriggerListener.kt (94%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/DebugStackFrameListener.kt (93%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/ExecutionPointManager.kt (98%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/LiveBreakpointConstants.kt (94%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/StackFrameManager.kt (94%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/painter/VariableEditorLinePainter.kt (94%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/tree/VariableRootSimpleNode.kt (95%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/tree/VariableSimpleTreeStructure.kt (89%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/ui/BreakpointHitWindow.kt (92%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/ui/EventsTab.kt (93%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/ui/EventsWindow.kt (87%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/ui/FramesTab.kt (93%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/breakpoint/ui/VariableTab.kt (85%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/log/LogHitColumnInfo.kt (98%) rename plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/log/VariableParser.kt (98%) rename plugin/src/test/kotlin/spp/jetbrains/sourcemarker/service/{ => instrument}/log/VariableParserTest.kt (97%) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java index 9aefacb00..a5c7ddf29 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/BreakpointStatusBar.java @@ -21,8 +21,8 @@ import spp.jetbrains.sourcemarker.PluginUI; import spp.jetbrains.sourcemarker.command.AutocompleteFieldRow; import spp.jetbrains.sourcemarker.mark.SourceMarkKeys; -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitColumnInfo; -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService; +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitColumnInfo; +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitWindowService; import spp.jetbrains.sourcemarker.settings.LiveBreakpointConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveBreakpoint; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index cfc7320e7..5b71016b7 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -22,8 +22,8 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkKeys; import spp.jetbrains.sourcemarker.service.InstrumentEventListener; import spp.jetbrains.sourcemarker.service.ViewEventListener; -import spp.jetbrains.sourcemarker.service.log.LogHitColumnInfo; -import spp.jetbrains.sourcemarker.service.log.VariableParser; +import spp.jetbrains.sourcemarker.service.instrument.log.LogHitColumnInfo; +import spp.jetbrains.sourcemarker.service.instrument.log.VariableParser; import spp.jetbrains.sourcemarker.settings.LiveLogConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.artifact.log.Log; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java index fdb974927..4942e5fbb 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/MeterStatusBar.java @@ -18,7 +18,7 @@ import spp.jetbrains.sourcemarker.PluginIcons; import spp.jetbrains.sourcemarker.PluginUI; import spp.jetbrains.sourcemarker.mark.SourceMarkKeys; -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitColumnInfo; +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitColumnInfo; import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveInstrument; diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java index 24c6a16be..a516a104a 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/SpanStatusBar.java @@ -18,7 +18,7 @@ import spp.jetbrains.sourcemarker.PluginIcons; import spp.jetbrains.sourcemarker.PluginUI; import spp.jetbrains.sourcemarker.mark.SourceMarkKeys; -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitColumnInfo; +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitColumnInfo; import spp.jetbrains.sourcemarker.settings.LiveMeterConfigurationPanel; import spp.jetbrains.sourcemarker.status.util.AutocompleteField; import spp.protocol.instrument.LiveInstrument; diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 2e7eb16e1..47bdf7bc4 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -68,12 +68,12 @@ import spp.jetbrains.sourcemarker.PluginBundle.message import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.INTELLIJ_PRODUCT_CODES import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.PYCHARM_PRODUCT_CODES import spp.jetbrains.sourcemarker.command.ControlBarController -import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend -import spp.jetbrains.sourcemarker.listeners.PluginSourceMarkEventListener +import spp.jetbrains.sourcemarker.service.discover.TCPServiceDiscoveryBackend +import spp.jetbrains.sourcemarker.mark.PluginSourceMarkEventListener import spp.jetbrains.sourcemarker.portal.PortalController import spp.jetbrains.sourcemarker.service.LiveInstrumentManager import spp.jetbrains.sourcemarker.service.LiveViewManager -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitWindowService import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.settings.getServicePortNormalized import spp.jetbrains.sourcemarker.settings.isSsl diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/PluginSourceMarkEventListener.kt similarity index 98% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/PluginSourceMarkEventListener.kt index 3cc5833a1..209cfab77 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/listeners/PluginSourceMarkEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/PluginSourceMarkEventListener.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.listeners +package spp.jetbrains.sourcemarker.mark import io.vertx.kotlin.coroutines.dispatcher import kotlinx.coroutines.GlobalScope diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkSearch.kt similarity index 98% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkSearch.kt index 00886ddad..fb274df30 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/search/SourceMarkSearch.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkSearch.kt @@ -15,13 +15,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.search +package spp.jetbrains.sourcemarker.mark import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.source.mark.api.ExpressionSourceMark import spp.jetbrains.marker.source.mark.api.MethodSourceMark import spp.jetbrains.marker.source.mark.api.SourceMark -import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt index 73aadb447..4323ce7c3 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt @@ -81,7 +81,7 @@ import spp.jetbrains.portal.protocol.portal.PageType import spp.jetbrains.sourcemarker.PluginBundle import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.ENDPOINT_DETECTOR -import spp.jetbrains.sourcemarker.search.SourceMarkSearch +import spp.jetbrains.sourcemarker.mark.SourceMarkSearch import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt index 0d44567d9..f07e554bc 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveInstrumentManager.kt @@ -29,11 +29,11 @@ import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper import io.vertx.kotlin.coroutines.CoroutineVerticle import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend +import spp.jetbrains.sourcemarker.service.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.mark.SourceMarkKeys -import spp.jetbrains.sourcemarker.search.SourceMarkSearch -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointTriggerListener +import spp.jetbrains.sourcemarker.mark.SourceMarkSearch +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitWindowService +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointTriggerListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.SourceServices.Instance @@ -42,7 +42,6 @@ import spp.protocol.instrument.LiveBreakpoint import spp.protocol.instrument.LiveLog import spp.protocol.instrument.event.LiveInstrumentEvent import spp.protocol.instrument.event.LiveInstrumentEventType -import spp.protocol.instrument.event.LiveLogHit import spp.protocol.marshall.ProtocolMarshaller import spp.protocol.marshall.ProtocolMarshaller.deserializeLiveInstrumentRemoved diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index 18bd150f3..e36818d5d 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -25,9 +25,9 @@ import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper import io.vertx.kotlin.coroutines.CoroutineVerticle import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.sourcemarker.discover.TCPServiceDiscoveryBackend +import spp.jetbrains.sourcemarker.service.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.mark.SourceMarkKeys -import spp.jetbrains.sourcemarker.search.SourceMarkSearch +import spp.jetbrains.sourcemarker.mark.SourceMarkSearch import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress import spp.protocol.view.LiveViewEvent diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/discover/TCPServiceDiscoveryBackend.kt similarity index 99% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/discover/TCPServiceDiscoveryBackend.kt index f3aaeecbb..4f5de840a 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/discover/TCPServiceDiscoveryBackend.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/discover/TCPServiceDiscoveryBackend.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.discover +package spp.jetbrains.sourcemarker.service.discover import eu.geekplace.javapinning.JavaPinning import eu.geekplace.javapinning.pin.Pin diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointEventColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointEventColumnInfo.kt similarity index 98% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointEventColumnInfo.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointEventColumnInfo.kt index 95f7a8ac4..08f655ea5 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointEventColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointEventColumnInfo.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint +package spp.jetbrains.sourcemarker.service.instrument.breakpoint import com.intellij.util.ui.ColumnInfo import com.intellij.util.ui.table.IconTableCellRenderer diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointHitColumnInfo.kt similarity index 98% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointHitColumnInfo.kt index e8cae30f1..8f5597333 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointHitColumnInfo.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint +package spp.jetbrains.sourcemarker.service.instrument.breakpoint import com.intellij.util.ui.ColumnInfo import io.vertx.core.json.Json diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointHitWindowService.kt similarity index 94% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointHitWindowService.kt index 2bbc6762e..cd67906e0 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointHitWindowService.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointHitWindowService.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint +package spp.jetbrains.sourcemarker.service.instrument.breakpoint import com.intellij.openapi.Disposable import com.intellij.openapi.components.Service @@ -31,9 +31,9 @@ import com.intellij.ui.content.ContentManagerEvent import com.intellij.ui.content.ContentManagerListener import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_BREAKPOINT_DISABLED_ICON -import spp.jetbrains.sourcemarker.service.breakpoint.LiveBreakpointConstants.LIVE_BREAKPOINT_NAME -import spp.jetbrains.sourcemarker.service.breakpoint.ui.BreakpointHitWindow -import spp.jetbrains.sourcemarker.service.breakpoint.ui.EventsWindow +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.LiveBreakpointConstants.LIVE_BREAKPOINT_NAME +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.ui.BreakpointHitWindow +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.ui.EventsWindow import spp.protocol.instrument.event.LiveBreakpointHit /** diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointTriggerListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointTriggerListener.kt similarity index 94% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointTriggerListener.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointTriggerListener.kt index 986874818..3efed3459 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/BreakpointTriggerListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/BreakpointTriggerListener.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint +package spp.jetbrains.sourcemarker.service.instrument.breakpoint import com.intellij.openapi.editor.event.EditorMouseEvent import com.intellij.openapi.editor.event.EditorMouseListener diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/DebugStackFrameListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/DebugStackFrameListener.kt similarity index 93% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/DebugStackFrameListener.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/DebugStackFrameListener.kt index 275949928..e3d0d9f71 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/DebugStackFrameListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/DebugStackFrameListener.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint +package spp.jetbrains.sourcemarker.service.instrument.breakpoint /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ExecutionPointManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ExecutionPointManager.kt similarity index 98% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ExecutionPointManager.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ExecutionPointManager.kt index 8dfb34f2c..3c28f92ee 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ExecutionPointManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ExecutionPointManager.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint +package spp.jetbrains.sourcemarker.service.instrument.breakpoint import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/LiveBreakpointConstants.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/LiveBreakpointConstants.kt similarity index 94% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/LiveBreakpointConstants.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/LiveBreakpointConstants.kt index 24fc8bf75..bc4570ec5 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/LiveBreakpointConstants.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/LiveBreakpointConstants.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint +package spp.jetbrains.sourcemarker.service.instrument.breakpoint /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/StackFrameManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/StackFrameManager.kt similarity index 94% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/StackFrameManager.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/StackFrameManager.kt index 7f40f3a53..c1d90ff7b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/StackFrameManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/StackFrameManager.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint +package spp.jetbrains.sourcemarker.service.instrument.breakpoint import spp.protocol.artifact.exception.LiveStackTrace import spp.protocol.artifact.exception.LiveStackTraceElement diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/painter/VariableEditorLinePainter.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/painter/VariableEditorLinePainter.kt similarity index 94% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/painter/VariableEditorLinePainter.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/painter/VariableEditorLinePainter.kt index 802caca68..0217dfd1f 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/painter/VariableEditorLinePainter.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/painter/VariableEditorLinePainter.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint.painter +package spp.jetbrains.sourcemarker.service.instrument.breakpoint.painter import com.intellij.openapi.editor.EditorLinePainter import com.intellij.openapi.editor.LineExtensionInfo @@ -26,7 +26,7 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.ui.Gray import com.intellij.ui.JBColor import com.intellij.xdebugger.ui.DebuggerColors -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitWindowService import java.awt.Color import java.awt.Font diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableRootSimpleNode.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/tree/VariableRootSimpleNode.kt similarity index 95% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableRootSimpleNode.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/tree/VariableRootSimpleNode.kt index 82f7cf57d..75ffd98cd 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableRootSimpleNode.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/tree/VariableRootSimpleNode.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint.tree +package spp.jetbrains.sourcemarker.service.instrument.breakpoint.tree import com.intellij.openapi.application.ApplicationInfo import com.intellij.ui.treeStructure.SimpleNode @@ -23,7 +23,7 @@ import com.intellij.util.containers.hash.LinkedHashMap import spp.jetbrains.marker.jvm.JVMVariableSimpleNode import spp.jetbrains.marker.py.PythonVariableRootNode import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.PYCHARM_PRODUCT_CODES -import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.StackFrameManager import spp.protocol.instrument.variable.LiveVariableScope /** diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableSimpleTreeStructure.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/tree/VariableSimpleTreeStructure.kt similarity index 89% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableSimpleTreeStructure.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/tree/VariableSimpleTreeStructure.kt index a1df61827..1a8b764fa 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/tree/VariableSimpleTreeStructure.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/tree/VariableSimpleTreeStructure.kt @@ -15,10 +15,10 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint.tree +package spp.jetbrains.sourcemarker.service.instrument.breakpoint.tree import com.intellij.ui.treeStructure.SimpleTreeStructure -import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.StackFrameManager /** * todo: description. diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/BreakpointHitWindow.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/BreakpointHitWindow.kt similarity index 92% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/BreakpointHitWindow.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/BreakpointHitWindow.kt index a8b0c17c0..a0bd1ce08 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/BreakpointHitWindow.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/BreakpointHitWindow.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint.ui +package spp.jetbrains.sourcemarker.service.instrument.breakpoint.ui import com.intellij.execution.ui.RunnerLayoutUi import com.intellij.execution.ui.layout.PlaceInGrid @@ -30,10 +30,10 @@ import com.intellij.ui.content.Content import com.intellij.util.concurrency.AppExecutorUtil import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter import io.vertx.core.json.Json -import spp.jetbrains.sourcemarker.service.breakpoint.DebugStackFrameListener -import spp.jetbrains.sourcemarker.service.breakpoint.ExecutionPointManager -import spp.jetbrains.sourcemarker.service.breakpoint.LiveBreakpointConstants -import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.DebugStackFrameListener +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.ExecutionPointManager +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.LiveBreakpointConstants +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.StackFrameManager import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.artifact.exception.LiveStackTrace import spp.protocol.artifact.exception.LiveStackTraceElement diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsTab.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/EventsTab.kt similarity index 93% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsTab.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/EventsTab.kt index dc5aa5cae..fdbf4008c 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsTab.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/EventsTab.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint.ui +package spp.jetbrains.sourcemarker.service.instrument.breakpoint.ui import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationInfo @@ -27,8 +27,8 @@ import com.intellij.util.ui.ListTableModel import com.intellij.util.ui.table.IconTableCellRenderer import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_BREAKPOINT_ACTIVE_ICON -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointEventColumnInfo -import spp.jetbrains.sourcemarker.service.breakpoint.BreakpointHitWindowService +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointEventColumnInfo +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitWindowService import spp.protocol.instrument.event.LiveBreakpointHit import java.awt.BorderLayout import java.awt.Point diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsWindow.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/EventsWindow.kt similarity index 87% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsWindow.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/EventsWindow.kt index 288bdff35..6d3dfc780 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/EventsWindow.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/EventsWindow.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint.ui +package spp.jetbrains.sourcemarker.service.instrument.breakpoint.ui import com.intellij.execution.ui.RunnerLayoutUi import com.intellij.execution.ui.layout.PlaceInGrid @@ -23,9 +23,9 @@ import com.intellij.icons.AllIcons import com.intellij.openapi.Disposable import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer -import spp.jetbrains.sourcemarker.service.breakpoint.DebugStackFrameListener -import spp.jetbrains.sourcemarker.service.breakpoint.LiveBreakpointConstants -import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.DebugStackFrameListener +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.LiveBreakpointConstants +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.StackFrameManager import java.util.concurrent.CopyOnWriteArrayList import javax.swing.JComponent diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/FramesTab.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/FramesTab.kt similarity index 93% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/FramesTab.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/FramesTab.kt index 9a461f483..2c5a46b4b 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/FramesTab.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/FramesTab.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint.ui +package spp.jetbrains.sourcemarker.service.instrument.breakpoint.ui import com.intellij.icons.AllIcons import com.intellij.openapi.Disposable @@ -24,8 +24,8 @@ import com.intellij.ui.ColoredListCellRenderer import com.intellij.ui.SimpleTextAttributes import com.intellij.ui.components.JBList import com.intellij.ui.components.JBScrollPane -import spp.jetbrains.sourcemarker.service.breakpoint.DebugStackFrameListener -import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.DebugStackFrameListener +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.StackFrameManager import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.artifact.exception.LiveStackTraceElement import spp.protocol.artifact.exception.sourceAsLineNumber diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/VariableTab.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/VariableTab.kt similarity index 85% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/VariableTab.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/VariableTab.kt index 74e5fb5f4..c75980d02 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/breakpoint/ui/VariableTab.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/breakpoint/ui/VariableTab.kt @@ -15,16 +15,16 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.breakpoint.ui +package spp.jetbrains.sourcemarker.service.instrument.breakpoint.ui import com.intellij.openapi.Disposable import com.intellij.ui.components.JBScrollPane import com.intellij.ui.tree.AsyncTreeModel import com.intellij.ui.tree.StructureTreeModel import com.intellij.ui.treeStructure.Tree -import spp.jetbrains.sourcemarker.service.breakpoint.DebugStackFrameListener -import spp.jetbrains.sourcemarker.service.breakpoint.StackFrameManager -import spp.jetbrains.sourcemarker.service.breakpoint.tree.VariableSimpleTreeStructure +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.DebugStackFrameListener +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.StackFrameManager +import spp.jetbrains.sourcemarker.service.instrument.breakpoint.tree.VariableSimpleTreeStructure import java.awt.BorderLayout import javax.swing.JPanel import javax.swing.JTree diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/log/LogHitColumnInfo.kt similarity index 98% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/log/LogHitColumnInfo.kt index c525da58a..b866cfb0e 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/LogHitColumnInfo.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/log/LogHitColumnInfo.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.log +package spp.jetbrains.sourcemarker.service.instrument.log import com.intellij.util.ui.ColumnInfo import io.vertx.core.json.JsonObject diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParser.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/log/VariableParser.kt similarity index 98% rename from plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParser.kt rename to plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/log/VariableParser.kt index 062065ee7..a46926791 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/log/VariableParser.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/instrument/log/VariableParser.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package spp.jetbrains.sourcemarker.service.log +package spp.jetbrains.sourcemarker.service.instrument.log import com.intellij.openapi.util.Pair import java.util.function.Function diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt index 90549da02..ce7067e5f 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/util/AutocompleteField.kt @@ -24,7 +24,7 @@ import com.intellij.util.ui.UIUtil import spp.jetbrains.sourcemarker.PluginIcons import spp.jetbrains.sourcemarker.PluginUI.* import spp.jetbrains.sourcemarker.command.AutocompleteFieldRow -import spp.jetbrains.sourcemarker.service.log.VariableParser +import spp.jetbrains.sourcemarker.service.instrument.log.VariableParser import spp.protocol.artifact.ArtifactQualifiedName import java.awt.* import java.awt.event.* diff --git a/plugin/src/main/resources/META-INF/plugin.xml b/plugin/src/main/resources/META-INF/plugin.xml index b6d2c27c8..1f1d689b9 100644 --- a/plugin/src/main/resources/META-INF/plugin.xml +++ b/plugin/src/main/resources/META-INF/plugin.xml @@ -13,9 +13,9 @@ + serviceImplementation="spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitWindowService"/> + implementation="spp.jetbrains.sourcemarker.service.instrument.breakpoint.painter.VariableEditorLinePainter"/> . */ -package spp.jetbrains.sourcemarker.service.log +package spp.jetbrains.sourcemarker.service.instrument.log import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test From 819b9b8bb5a050e2d000bf4586c26e1933a35e28 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 12 Mar 2022 17:58:51 +0100 Subject: [PATCH 093/115] MARK_USER_DATA_UPDATED event --- .../spp/jetbrains/marker/source/mark/api/MethodSourceMark.kt | 1 + .../jetbrains/marker/source/mark/api/event/SourceMarkEvent.kt | 2 +- .../marker/source/mark/api/event/SourceMarkEventCode.kt | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/MethodSourceMark.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/MethodSourceMark.kt index 2afc6b70f..0c45d39f5 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/MethodSourceMark.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/MethodSourceMark.kt @@ -108,6 +108,7 @@ abstract class MethodSourceMark( } else { userData.remove(key) } + triggerEvent(SourceMarkEvent(this, SourceMarkEventCode.MARK_USER_DATA_UPDATED, key, value)) } override fun hasUserData(): Boolean = userData.isNotEmpty() diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEvent.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEvent.kt index 192fbb5c9..0ba8ed991 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEvent.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEvent.kt @@ -28,7 +28,7 @@ import spp.jetbrains.marker.source.mark.api.SourceMark open class SourceMarkEvent( val sourceMark: SourceMark, val eventCode: IEventCode, - vararg val params: Any + vararg val params: Any? ) { override fun toString(): String { diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEventCode.kt b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEventCode.kt index c76501d46..9c9620d2b 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEventCode.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/source/mark/api/event/SourceMarkEventCode.kt @@ -34,7 +34,8 @@ enum class SourceMarkEventCode(private val code: Int) : IEventCode { PORTAL_OPENING(1004), PORTAL_OPENED(1005), PORTAL_CLOSED(1006), - UPDATE_PORTAL_CONFIG(1007); + UPDATE_PORTAL_CONFIG(1007), + MARK_USER_DATA_UPDATED(1008); override fun code(): Int { return this.code From 701de365e7ce90d7530aaefda09a95d301854d47 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 12 Mar 2022 18:01:05 +0100 Subject: [PATCH 094/115] bump --- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index f9bb320a1..7d79d4ecf 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:a2cd759830") + compileOnly("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 4d285297f..4ef163d2a 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:a2cd759830") + compileOnly("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index faf1e454c..1ba030804 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:a2cd759830") + compileOnly("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index 56ceb9162..b0e03fa10 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:a2cd759830") + implementation("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 6ed2d3afa..ae1b6a7d3 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4d03b0b769") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:a2cd759830") + implementation("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") } implementation("org.jooq:joor:$joorVersion") From 409752d89534590244db53957d5846a3c0a00a6b Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 12 Mar 2022 21:46:42 +0100 Subject: [PATCH 095/115] activity quick stats --- .../sourcemarker/SourceMarkerPlugin.kt | 4 +- .../view/ActivityQuickStatsInlayHints.kt | 177 ++++++++++++++++++ 2 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 plugin/src/main/kotlin/spp/jetbrains/sourcemarker/view/ActivityQuickStatsInlayHints.kt diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt index 47bdf7bc4..ffbd3aeb9 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/SourceMarkerPlugin.kt @@ -68,17 +68,18 @@ import spp.jetbrains.sourcemarker.PluginBundle.message import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.INTELLIJ_PRODUCT_CODES import spp.jetbrains.sourcemarker.activities.PluginSourceMarkerStartupActivity.Companion.PYCHARM_PRODUCT_CODES import spp.jetbrains.sourcemarker.command.ControlBarController -import spp.jetbrains.sourcemarker.service.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.mark.PluginSourceMarkEventListener import spp.jetbrains.sourcemarker.portal.PortalController import spp.jetbrains.sourcemarker.service.LiveInstrumentManager import spp.jetbrains.sourcemarker.service.LiveViewManager +import spp.jetbrains.sourcemarker.service.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.service.instrument.breakpoint.BreakpointHitWindowService import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.settings.getServicePortNormalized import spp.jetbrains.sourcemarker.settings.isSsl import spp.jetbrains.sourcemarker.settings.serviceHostNormalized import spp.jetbrains.sourcemarker.status.LiveStatusManager +import spp.jetbrains.sourcemarker.view.ActivityQuickStatsInlayHints import spp.protocol.SourceServices import spp.protocol.SourceServices.Instance import spp.protocol.service.LiveInstrumentService @@ -447,6 +448,7 @@ object SourceMarkerPlugin { private fun initMarker(config: SourceMarkerConfig, project: Project) { log.info("Initializing marker") SourceMarker.addGlobalSourceMarkEventListener(PluginSourceMarkEventListener()) + SourceMarker.addGlobalSourceMarkEventListener(ActivityQuickStatsInlayHints()) val gutterMarkConfig = GutterMarkConfiguration() gutterMarkConfig.activateOnMouseHover = false diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/view/ActivityQuickStatsInlayHints.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/view/ActivityQuickStatsInlayHints.kt new file mode 100644 index 000000000..ad4f085b9 --- /dev/null +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/view/ActivityQuickStatsInlayHints.kt @@ -0,0 +1,177 @@ +/* + * Source++, the open-source live coding platform. + * Copyright (C) 2022 CodeBrig, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package spp.jetbrains.sourcemarker.view + +import com.intellij.openapi.application.ApplicationManager +import com.intellij.ui.JBColor +import io.vertx.core.json.JsonArray +import io.vertx.kotlin.coroutines.dispatcher +import kotlinx.coroutines.runBlocking +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import spp.jetbrains.marker.SourceMarker +import spp.jetbrains.marker.jvm.psi.EndpointDetector +import spp.jetbrains.marker.source.mark.api.MethodSourceMark +import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent +import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode +import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventListener +import spp.jetbrains.marker.source.mark.inlay.InlayMark +import spp.jetbrains.marker.source.mark.inlay.config.InlayMarkVirtualText +import spp.jetbrains.monitor.skywalking.SkywalkingClient +import spp.jetbrains.monitor.skywalking.bridge.EndpointMetricsBridge +import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics +import spp.jetbrains.monitor.skywalking.model.ZonedDuration +import spp.jetbrains.monitor.skywalking.toProtocol +import spp.jetbrains.sourcemarker.SourceMarkerPlugin +import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.VIEW_SUBSCRIPTION_ID +import spp.jetbrains.sourcemarker.status.LiveStatusManager +import spp.protocol.SourceServices +import spp.protocol.artifact.QueryTimeFrame +import spp.protocol.artifact.metrics.ArtifactMetricResult +import spp.protocol.artifact.metrics.MetricType +import spp.protocol.instrument.LiveSourceLocation +import spp.protocol.utils.fromPerSecondToPrettyFrequency +import spp.protocol.view.LiveViewConfig +import spp.protocol.view.LiveViewEvent +import spp.protocol.view.LiveViewSubscription +import java.awt.Color +import java.time.ZonedDateTime +import java.time.temporal.ChronoUnit + +/** + * Adds activity quick stats as inlay marks above recognized endpoint methods. + * Uses a two-minute delay to ensure metrics have been fully collected. + */ +class ActivityQuickStatsInlayHints : SourceMarkEventListener { + + companion object { + private val log: Logger = LoggerFactory.getLogger(ActivityQuickStatsInlayHints::class.java) + private val inlayForegroundColor = JBColor(Color.decode("#3e464a"), Color.decode("#87939a")) + } + + //todo: wait till have all stats for minute before showing + override fun handleEvent(event: SourceMarkEvent) { + if (event.eventCode == SourceMarkEventCode.MARK_USER_DATA_UPDATED) { + if (event.sourceMark.getUserData(EndpointDetector.ENDPOINT_ID) != null) { + if (event.sourceMark is InlayMark) return + + //found a method endpoint to show quick activity stats + ApplicationManager.getApplication().runReadAction { + val endTime = ZonedDateTime.now().minusMinutes(1).truncatedTo(ChronoUnit.MINUTES) //exclusive + val startTime = endTime.minusMinutes(2) + val metricsRequest = GetEndpointMetrics( + listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla"), + event.sourceMark.getUserData(EndpointDetector.ENDPOINT_ID)!!, + ZonedDuration(startTime, endTime, SkywalkingClient.DurationStep.MINUTE) + ) + + val currentMetrics = runBlocking(SourceMarkerPlugin.vertx.dispatcher()) { + EndpointMetricsBridge.getMetrics(metricsRequest, SourceMarkerPlugin.vertx) + } + val metricResult = toProtocol( + event.sourceMark.artifactQualifiedName, + QueryTimeFrame.LAST_15_MINUTES, //todo: don't need + MetricType.ResponseTime_Average, //todo: dont need + metricsRequest, + currentMetrics + ) + + val inlay = SourceMarker.creationService.createMethodInlayMark( + event.sourceMark.sourceFileMarker, + (event.sourceMark as MethodSourceMark).getPsiElement().nameIdentifier!!, + false + ) + inlay.configuration.virtualText = InlayMarkVirtualText(inlay, formatMetricResult(metricResult)) + inlay.configuration.virtualText!!.textAttributes.foregroundColor = inlayForegroundColor + inlay.configuration.activateOnMouseClick = false + inlay.apply(true) + + val previousMetrics = mutableMapOf() + LiveStatusManager.addViewEventListener(inlay) { + consumeLiveEvent(it, previousMetrics) + + val twoMinAgoValue = previousMetrics[it.timeBucket.toLong() - 2] + if (twoMinAgoValue != null) { + inlay.configuration.virtualText!!.updateVirtualText(twoMinAgoValue) + } + } + + SourceServices.Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + listOf(event.sourceMark.getUserData(EndpointDetector.ENDPOINT_NAME)!!), + event.sourceMark.artifactQualifiedName, + LiveSourceLocation(event.sourceMark.artifactQualifiedName.identifier, 0), //todo: don't need + LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) + ) + ).onComplete { + if (it.succeeded()) { + val subscriptionId = it.result().subscriptionId!! + inlay.putUserData(VIEW_SUBSCRIPTION_ID, subscriptionId) + inlay.addEventListener { + if (it.eventCode == SourceMarkEventCode.MARK_REMOVED) { + SourceServices.Instance.liveView!!.removeLiveViewSubscription(subscriptionId) + } + } + } else { + log.error("Failed to add live view subscription", it.cause()) + } + } + } + } + } + } + + private fun formatMetricResult(result: ArtifactMetricResult): String { + val sb = StringBuilder() + val resp = result.artifactMetrics.find { it.metricType == MetricType.Throughput_Average }!! + val respValue = (resp.values.last() / 60.0).fromPerSecondToPrettyFrequency() + sb.append(resp.metricType.simpleName).append(": ").append(respValue).append(" | ") + val cpm = result.artifactMetrics.find { it.metricType == MetricType.ResponseTime_Average }!! + sb.append(cpm.metricType.simpleName).append(": ").append(cpm.values.last().toInt()).append("ms | ") + val sla = result.artifactMetrics.find { it.metricType == MetricType.ServiceLevelAgreement_Average }!! + sb.append(sla.metricType.simpleName).append(": ").append(sla.values.last().toDouble() / 100.0).append("%") + return "/#/ " + sb.toString() + " \\#\\" + } + + private fun consumeLiveEvent(event: LiveViewEvent, previousMetrics: MutableMap) { + val metrics = JsonArray(event.metricsData) + val sb = StringBuilder() + for (i in 0 until metrics.size()) { + val metric = metrics.getJsonObject(i) + var value: String? = null + if (metric.getNumber("percentage") != null) { + value = (metric.getNumber("percentage").toDouble() / 100.0).toString() + "%" + } + if (value == null) value = metric.getNumber("value").toString() + + val metricType = MetricType.realValueOf(metric.getJsonObject("meta").getString("metricsName")) + if (metricType == MetricType.Throughput_Average) { + value = (metric.getNumber("value").toDouble() / 60.0).fromPerSecondToPrettyFrequency() + } + if (metricType == MetricType.ResponseTime_Average) { + value += "ms" + } + sb.append("${metricType.simpleName}: $value") + if (i < metrics.size() - 1) { + sb.append(" | ") + } + } + previousMetrics[event.timeBucket.toLong()] = "/#/ " + sb.toString() + " \\#\\" + } +} From 692f28472153902543918091346afaae3c4c3288 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 12 Mar 2022 21:46:53 +0100 Subject: [PATCH 096/115] clean --- .../sourcemarker/status/LiveStatusManager.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index d82e76ff8..2fb4d4650 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -201,16 +201,11 @@ object LiveStatusManager : SourceMarkEventListener { ) ).onComplete { if (it.succeeded()) { - inlayMark.putUserData(VIEW_SUBSCRIPTION_ID, it.result().subscriptionId) + val subscriptionId = it.result().subscriptionId!! + inlayMark.putUserData(VIEW_SUBSCRIPTION_ID, subscriptionId) inlayMark.addEventListener { event -> if (event.eventCode == SourceMarkEventCode.MARK_REMOVED) { - SourceServices.Instance.liveView!!.removeLiveViewSubscription( - it.result().subscriptionId!! - ).onComplete { - if (it.failed()) { - log.error("Failed to remove subscription: {}", it.cause()) - } - } + SourceServices.Instance.liveView!!.removeLiveViewSubscription(subscriptionId) } } } else { From ae040b995e5de10d999b154a1d3b5b6f5a3f8143 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 12 Mar 2022 21:48:00 +0100 Subject: [PATCH 097/115] createMethodInlayMark --- .../marker/jvm/JVMArtifactCreationService.kt | 9 ++++++ .../marker/jvm/JVMSourceInlayHintProvider.kt | 4 +-- .../jetbrains/marker/source/JVMMarkerUtils.kt | 32 +++++++++++++++++++ .../py/PythonArtifactCreationService.kt | 9 ++++++ .../marker/ArtifactCreationService.kt | 7 ++++ 5 files changed, 58 insertions(+), 3 deletions(-) diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMArtifactCreationService.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMArtifactCreationService.kt index 0a3947927..7dc6148db 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMArtifactCreationService.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMArtifactCreationService.kt @@ -31,6 +31,7 @@ import spp.jetbrains.marker.source.mark.api.key.SourceKey import spp.jetbrains.marker.source.mark.gutter.ExpressionGutterMark import spp.jetbrains.marker.source.mark.gutter.MethodGutterMark import spp.jetbrains.marker.source.mark.inlay.ExpressionInlayMark +import spp.jetbrains.marker.source.mark.inlay.MethodInlayMark import java.util.* /** @@ -118,6 +119,14 @@ class JVMArtifactCreationService : ArtifactCreationService { } } + override fun createMethodInlayMark( + fileMarker: SourceFileMarker, + element: PsiElement, + autoApply: Boolean + ): MethodInlayMark { + return JVMMarkerUtils.createMethodInlayMark(fileMarker, element, autoApply) + } + override fun createExpressionInlayMark( fileMarker: SourceFileMarker, lineNumber: Int, diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMSourceInlayHintProvider.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMSourceInlayHintProvider.kt index 92bbec284..7c473241d 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMSourceInlayHintProvider.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/JVMSourceInlayHintProvider.kt @@ -72,9 +72,7 @@ class JVMSourceInlayHintProvider : SourceInlayHintProvider() { sink: InlayHintsSink, representation: InlayPresentation ) { - val statement = if (element is PsiStatement) element else { - element.getParentOfType(true) - }!! + val statement = if (element is PsiStatement) element else element if (virtualText.useInlinePresentation) { if (virtualText.showAfterLastChildWhenInline) { sink.addInlineElement( diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/source/JVMMarkerUtils.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/source/JVMMarkerUtils.kt index 54a19c237..c270d2c78 100755 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/source/JVMMarkerUtils.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/source/JVMMarkerUtils.kt @@ -309,6 +309,38 @@ object JVMMarkerUtils { return statementExpression } + /** + * todo: description. + * + * @since 0.4.2 + */ + @JvmStatic + @JvmOverloads + @Synchronized + fun createMethodInlayMark( + fileMarker: SourceFileMarker, + element: PsiElement, + autoApply: Boolean = false + ): MethodInlayMark { + log.trace("createMethodInlayMark: $element") + val inlayMark = fileMarker.createMethodSourceMark( + element.parent as PsiNameIdentifierOwner, + getFullyQualifiedName(element.parent.toUElement() as UMethod), + SourceMark.Type.INLAY + ) as MethodInlayMark + return if (autoApply) { + if (inlayMark.canApply()) { + inlayMark.apply(true) + inlayMark + } else { + throw IllegalStateException("Could not apply inlay mark: $inlayMark") + } + } else { + inlayMark + } + } + + /** * todo: description. * diff --git a/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonArtifactCreationService.kt b/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonArtifactCreationService.kt index 58f9f8792..c3f519a12 100644 --- a/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonArtifactCreationService.kt +++ b/marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/PythonArtifactCreationService.kt @@ -27,6 +27,7 @@ import spp.jetbrains.marker.source.mark.api.key.SourceKey import spp.jetbrains.marker.source.mark.gutter.ExpressionGutterMark import spp.jetbrains.marker.source.mark.gutter.MethodGutterMark import spp.jetbrains.marker.source.mark.inlay.ExpressionInlayMark +import spp.jetbrains.marker.source.mark.inlay.MethodInlayMark import java.util.* /** @@ -114,6 +115,14 @@ class PythonArtifactCreationService : ArtifactCreationService { return Optional.empty() } + override fun createMethodInlayMark( + fileMarker: SourceFileMarker, + element: PsiElement, + autoApply: Boolean + ): MethodInlayMark { + TODO("Not yet implemented") + } + override fun createExpressionInlayMark( fileMarker: SourceFileMarker, lineNumber: Int, diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/ArtifactCreationService.kt b/marker/src/main/kotlin/spp/jetbrains/marker/ArtifactCreationService.kt index d83e79753..c2cad94ce 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/ArtifactCreationService.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/ArtifactCreationService.kt @@ -22,6 +22,7 @@ import spp.jetbrains.marker.source.SourceFileMarker import spp.jetbrains.marker.source.mark.gutter.ExpressionGutterMark import spp.jetbrains.marker.source.mark.gutter.MethodGutterMark import spp.jetbrains.marker.source.mark.inlay.ExpressionInlayMark +import spp.jetbrains.marker.source.mark.inlay.MethodInlayMark import java.util.* /** @@ -50,6 +51,12 @@ interface ArtifactCreationService { autoApply: Boolean = false ): Optional + fun createMethodInlayMark( + fileMarker: SourceFileMarker, + element: PsiElement, + autoApply: Boolean = false + ): MethodInlayMark + fun createExpressionInlayMark( fileMarker: SourceFileMarker, lineNumber: Int, From 6cd2f633b2fc291252360200417c5145b88a09e7 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 12 Mar 2022 21:48:20 +0100 Subject: [PATCH 098/115] increase visibility --- .../kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt index 41bd2b306..a2d0fbaf5 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/psi/EndpointDetector.kt @@ -51,9 +51,9 @@ class EndpointDetector(val vertx: Vertx) { companion object { private val log = LoggerFactory.getLogger(EndpointDetector::class.java) - private val ENDPOINT_ID = SourceKey("ENDPOINT_ID") - private val ENDPOINT_NAME = SourceKey("ENDPOINT_NAME") - private val ENDPOINT_INTERNAL = SourceKey("ENDPOINT_INTERNAL") + val ENDPOINT_ID = SourceKey("ENDPOINT_ID") + val ENDPOINT_NAME = SourceKey("ENDPOINT_NAME") + val ENDPOINT_INTERNAL = SourceKey("ENDPOINT_INTERNAL") } private val detectorSet = setOf( From 12ba1bc0e4ee7c66e8c8851cba48e7866d797700 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sat, 12 Mar 2022 21:48:29 +0100 Subject: [PATCH 099/115] formatting --- .../skywalking/bridge/EndpointMetricsBridge.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointMetricsBridge.kt b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointMetricsBridge.kt index ce2fdab7f..5e8fa397d 100644 --- a/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointMetricsBridge.kt +++ b/monitor/src/main/kotlin/spp/jetbrains/monitor/skywalking/bridge/EndpointMetricsBridge.kt @@ -43,12 +43,11 @@ class EndpointMetricsBridge(private val skywalkingClient: SkywalkingClient) : Co val request = it.body() val response: MutableList = ArrayList() request.metricIds.forEach { - val metric = - skywalkingClient.getEndpointMetrics( - it, - request.endpointId, - request.zonedDuration.toDuration(skywalkingClient) - ) + val metric = skywalkingClient.getEndpointMetrics( + it, + request.endpointId, + request.zonedDuration.toDuration(skywalkingClient) + ) if (metric != null) response.add(metric) } it.reply(response) From 06e1581890b9a5fa2696ea70e149dc8c3e8744a5 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 16:09:26 +0100 Subject: [PATCH 100/115] bump --- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 7d79d4ecf..60a72bf52 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") + compileOnly("com.github.sourceplusplus.protocol:protocol:af337ba247") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index 4ef163d2a..e0a354040 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") + compileOnly("com.github.sourceplusplus.protocol:protocol:af337ba247") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 1ba030804..019338ff3 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") + compileOnly("com.github.sourceplusplus.protocol:protocol:af337ba247") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index b0e03fa10..d88685a36 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") + implementation("com.github.sourceplusplus.protocol:protocol:af337ba247") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index ae1b6a7d3..107fba367 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4d03b0b769") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:5ab12b5c51") + implementation("com.github.sourceplusplus.protocol:protocol:af337ba247") } implementation("org.jooq:joor:$joorVersion") From dbf176c6dbd536c7babea96bf990200556dfaeb7 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 16:11:30 +0100 Subject: [PATCH 101/115] more logging --- plugin/src/main/resources/logback.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/resources/logback.xml b/plugin/src/main/resources/logback.xml index 798f55385..581e2f9d6 100644 --- a/plugin/src/main/resources/logback.xml +++ b/plugin/src/main/resources/logback.xml @@ -11,10 +11,10 @@ - + - + From 7a6e2cfd4d6e5b31f0389e969c7fefb6eac6b70d Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 16:11:47 +0100 Subject: [PATCH 102/115] import organizing --- .../spp/jetbrains/sourcemarker/service/LiveViewManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt index e36818d5d..30b02957e 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/LiveViewManager.kt @@ -25,9 +25,9 @@ import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper import io.vertx.kotlin.coroutines.CoroutineVerticle import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker -import spp.jetbrains.sourcemarker.service.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.mark.SourceMarkSearch +import spp.jetbrains.sourcemarker.service.discover.TCPServiceDiscoveryBackend import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress import spp.protocol.view.LiveViewEvent From 29d534e2f15fc7d28f56dcd69eb3807c1308ba29 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 16:12:35 +0100 Subject: [PATCH 103/115] remove specific subs instead of clearing all --- .../portal/PortalEventListener.kt | 178 ++++++++++-------- 1 file changed, 98 insertions(+), 80 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt index 4323ce7c3..a7f2d088a 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt @@ -41,6 +41,7 @@ import spp.jetbrains.marker.source.mark.api.ClassSourceMark import spp.jetbrains.marker.source.mark.api.MethodSourceMark import spp.jetbrains.marker.source.mark.api.SourceMark import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent +import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode import spp.jetbrains.monitor.skywalking.SkywalkingClient import spp.jetbrains.monitor.skywalking.average import spp.jetbrains.monitor.skywalking.bridge.EndpointMetricsBridge @@ -293,34 +294,40 @@ class PortalEventListener( //update subscriptions if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions().onComplete { - if (it.succeeded()) { - launch(vertx.dispatcher()) { - val sourceMark = SourceMarker.getSourceMark( - portal.viewingArtifact, SourceMark.Type.GUTTER - ) ?: return@launch - val endpointName = sourceMark.getUserData( - ENDPOINT_DETECTOR - )?.getOrFindEndpointName(sourceMark) ?: return@launch - - Instance.liveView!!.addLiveViewSubscription( - LiveViewSubscription( - null, - listOf(endpointName), - portal.viewingArtifact, - LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) + launch(vertx.dispatcher()) { + val sourceMark = SourceMarker.getSourceMark( + portal.viewingArtifact, SourceMark.Type.GUTTER + ) ?: return@launch + val endpointName = sourceMark.getUserData( + ENDPOINT_DETECTOR + )?.getOrFindEndpointName(sourceMark) ?: return@launch + + Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + listOf(endpointName), + portal.viewingArtifact, + LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix + LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) + ) + ).onComplete { + if (it.succeeded()) { + val subscriptionId = it.result().subscriptionId!! + if (portal.configuration.config["subscriptionId"] != null) { + Instance.liveView!!.removeLiveViewSubscription( + portal.configuration.config["subscriptionId"].toString() ) - ).onComplete { - if (it.succeeded()) { - portal.configuration.config["subscriptionId"] = it.result().subscriptionId!! - } else { - log.error("Failed to add live view subscription", it.cause()) + } + portal.configuration.config["subscriptionId"] = subscriptionId + + sourceMark.addEventListener { + if (it.eventCode == SourceMarkEventCode.PORTAL_CLOSED) { + Instance.liveView!!.removeLiveViewSubscription(subscriptionId) } } + } else { + log.error("Failed to add live view subscription", it.cause()) } - } else { - log.error("Failed to clear live view subscriptions", it.cause()) } } } @@ -334,34 +341,40 @@ class PortalEventListener( //update subscriptions if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions().onComplete { - if (it.succeeded()) { - launch(vertx.dispatcher()) { - val sourceMark = SourceMarker.getSourceMark( - portal.viewingArtifact, SourceMark.Type.GUTTER - ) ?: return@launch - val endpointName = sourceMark.getUserData( - ENDPOINT_DETECTOR - )?.getOrFindEndpointName(sourceMark) ?: return@launch - - Instance.liveView!!.addLiveViewSubscription( - LiveViewSubscription( - null, - listOf(endpointName), - portal.viewingArtifact, - LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig("TRACES", listOf("endpoint_traces")) + launch(vertx.dispatcher()) { + val sourceMark = SourceMarker.getSourceMark( + portal.viewingArtifact, SourceMark.Type.GUTTER + ) ?: return@launch + val endpointName = sourceMark.getUserData( + ENDPOINT_DETECTOR + )?.getOrFindEndpointName(sourceMark) ?: return@launch + + Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + listOf(endpointName), + portal.viewingArtifact, + LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix + LiveViewConfig("TRACES", listOf("endpoint_traces")) + ) + ).onComplete { + if (it.succeeded()) { + val subscriptionId = it.result().subscriptionId!! + if (portal.configuration.config["subscriptionId"] != null) { + Instance.liveView!!.removeLiveViewSubscription( + portal.configuration.config["subscriptionId"].toString() ) - ).onComplete { - if (it.succeeded()) { - portal.configuration.config["subscriptionId"] = it.result().subscriptionId!! - } else { - log.error("Failed to add live view subscription", it.cause()) + } + portal.configuration.config["subscriptionId"] = subscriptionId + + sourceMark.addEventListener { + if (it.eventCode == SourceMarkEventCode.PORTAL_CLOSED) { + Instance.liveView!!.removeLiveViewSubscription(subscriptionId) } } + } else { + log.error("Failed to add live view subscription", it.cause()) } - } else { - log.error("Failed to clear live view subscriptions", it.cause()) } } } @@ -375,44 +388,49 @@ class PortalEventListener( //update subscriptions if (Instance.liveView != null) { - Instance.liveView!!.clearLiveViewSubscriptions().onComplete { - if (it.succeeded()) { - launch(vertx.dispatcher()) { - val sourceMark = SourceMarker.getSourceMark( - portal.viewingArtifact, SourceMark.Type.GUTTER - ) + launch(vertx.dispatcher()) { + val sourceMark = SourceMarker.getSourceMark( + portal.viewingArtifact, SourceMark.Type.GUTTER + ) ?: return@launch + val logPatterns = if (sourceMark is ClassSourceMark) { + sourceMark.sourceFileMarker.getSourceMarks().filterIsInstance() + .flatMap { + it.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! + .getOrFindLoggerStatements(it) + }.map { it.logPattern } + } else if (sourceMark is MethodSourceMark) { + sourceMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! + .getOrFindLoggerStatements(sourceMark).map { it.logPattern } + } else { + throw IllegalStateException("Unsupported source mark type") + } - val logPatterns = if (sourceMark is ClassSourceMark) { - sourceMark.sourceFileMarker.getSourceMarks().filterIsInstance() - .flatMap { - it.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! - .getOrFindLoggerStatements(it) - }.map { it.logPattern } - } else if (sourceMark is MethodSourceMark) { - sourceMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR)!! - .getOrFindLoggerStatements(sourceMark).map { it.logPattern } - } else { - throw IllegalStateException("Unsupported source mark type") + Instance.liveView!!.addLiveViewSubscription( + LiveViewSubscription( + null, + logPatterns, + portal.viewingArtifact, + LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix + LiveViewConfig("LOGS", listOf("endpoint_logs")) + ) + ).onComplete { + if (it.succeeded()) { + val subscriptionId = it.result().subscriptionId!! + if (portal.configuration.config["subscriptionId"] != null) { + Instance.liveView!!.removeLiveViewSubscription( + portal.configuration.config["subscriptionId"].toString() + ) } + portal.configuration.config["subscriptionId"] = subscriptionId - Instance.liveView!!.addLiveViewSubscription( - LiveViewSubscription( - null, - logPatterns, - portal.viewingArtifact, - LiveSourceLocation(portal.viewingArtifact.identifier, 0), //todo: fix - LiveViewConfig("LOGS", listOf("endpoint_logs")) - ) - ).onComplete { - if (it.succeeded()) { - portal.configuration.config["subscriptionId"] = it.result().subscriptionId!! - } else { - log.error("Failed to add live view subscription", it.cause()) + sourceMark.addEventListener { + if (it.eventCode == SourceMarkEventCode.PORTAL_CLOSED) { + Instance.liveView!!.removeLiveViewSubscription(subscriptionId) } } + } else { + log.error("Failed to add live view subscription", it.cause()) } - } else { - log.error("Failed to clear live view subscriptions", it.cause()) } } } From e752ec2afcfff76990eb8eee45526f82961ad762 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 16:13:09 +0100 Subject: [PATCH 104/115] fix dupe quick stat inlays --- .../sourcemarker/mark/SourceMarkSearch.kt | 4 ++++ .../view/ActivityQuickStatsInlayHints.kt | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkSearch.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkSearch.kt index fb274df30..0de3b2a37 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkSearch.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/mark/SourceMarkSearch.kt @@ -59,6 +59,10 @@ object SourceMarkSearch { } } + fun findSourceMarks(artifact: ArtifactQualifiedName): List { + return SourceMarker.getSourceMarks().filter { it.artifactQualifiedName == artifact } + } + suspend fun findSourceMark(logPattern: String): MethodSourceMark? { return SourceMarker.getSourceMarks() .filterIsInstance() diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/view/ActivityQuickStatsInlayHints.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/view/ActivityQuickStatsInlayHints.kt index ad4f085b9..9101d1af7 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/view/ActivityQuickStatsInlayHints.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/view/ActivityQuickStatsInlayHints.kt @@ -30,6 +30,7 @@ import spp.jetbrains.marker.source.mark.api.MethodSourceMark import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventListener +import spp.jetbrains.marker.source.mark.api.key.SourceKey import spp.jetbrains.marker.source.mark.inlay.InlayMark import spp.jetbrains.marker.source.mark.inlay.config.InlayMarkVirtualText import spp.jetbrains.monitor.skywalking.SkywalkingClient @@ -37,8 +38,9 @@ import spp.jetbrains.monitor.skywalking.bridge.EndpointMetricsBridge import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics import spp.jetbrains.monitor.skywalking.model.ZonedDuration import spp.jetbrains.monitor.skywalking.toProtocol -import spp.jetbrains.sourcemarker.SourceMarkerPlugin +import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx import spp.jetbrains.sourcemarker.mark.SourceMarkKeys.VIEW_SUBSCRIPTION_ID +import spp.jetbrains.sourcemarker.mark.SourceMarkSearch import spp.jetbrains.sourcemarker.status.LiveStatusManager import spp.protocol.SourceServices import spp.protocol.artifact.QueryTimeFrame @@ -62,6 +64,7 @@ class ActivityQuickStatsInlayHints : SourceMarkEventListener { companion object { private val log: Logger = LoggerFactory.getLogger(ActivityQuickStatsInlayHints::class.java) private val inlayForegroundColor = JBColor(Color.decode("#3e464a"), Color.decode("#87939a")) + val ACTIVITY_QUICK_STATS = SourceKey("ACTIVITY_QUICK_STATS") } //todo: wait till have all stats for minute before showing @@ -69,6 +72,8 @@ class ActivityQuickStatsInlayHints : SourceMarkEventListener { if (event.eventCode == SourceMarkEventCode.MARK_USER_DATA_UPDATED) { if (event.sourceMark.getUserData(EndpointDetector.ENDPOINT_ID) != null) { if (event.sourceMark is InlayMark) return + val existingSourceMarks = SourceMarkSearch.findSourceMarks(event.sourceMark.artifactQualifiedName) + if (existingSourceMarks.find { it.getUserData(ACTIVITY_QUICK_STATS) == true } != null) return //found a method endpoint to show quick activity stats ApplicationManager.getApplication().runReadAction { @@ -80,8 +85,8 @@ class ActivityQuickStatsInlayHints : SourceMarkEventListener { ZonedDuration(startTime, endTime, SkywalkingClient.DurationStep.MINUTE) ) - val currentMetrics = runBlocking(SourceMarkerPlugin.vertx.dispatcher()) { - EndpointMetricsBridge.getMetrics(metricsRequest, SourceMarkerPlugin.vertx) + val currentMetrics = runBlocking(vertx.dispatcher()) { + EndpointMetricsBridge.getMetrics(metricsRequest, vertx) } val metricResult = toProtocol( event.sourceMark.artifactQualifiedName, @@ -96,6 +101,7 @@ class ActivityQuickStatsInlayHints : SourceMarkEventListener { (event.sourceMark as MethodSourceMark).getPsiElement().nameIdentifier!!, false ) + inlay.putUserData(ACTIVITY_QUICK_STATS, true) inlay.configuration.virtualText = InlayMarkVirtualText(inlay, formatMetricResult(metricResult)) inlay.configuration.virtualText!!.textAttributes.foregroundColor = inlayForegroundColor inlay.configuration.activateOnMouseClick = false @@ -117,7 +123,7 @@ class ActivityQuickStatsInlayHints : SourceMarkEventListener { listOf(event.sourceMark.getUserData(EndpointDetector.ENDPOINT_NAME)!!), event.sourceMark.artifactQualifiedName, LiveSourceLocation(event.sourceMark.artifactQualifiedName.identifier, 0), //todo: don't need - LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla")) + LiveViewConfig("ACTIVITY", listOf("endpoint_cpm", "endpoint_avg", "endpoint_sla"), -1) ) ).onComplete { if (it.succeeded()) { From 75ecb6fbed8cb627f9a4d6ecd69e67fc6200f365 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 16:54:48 +0100 Subject: [PATCH 105/115] bump --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2d9a7d82a..c6881d85e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official pluginGroup = spp.jetbrains pluginName = Source++ -projectVersion=0.4.1 +projectVersion=0.4.2 pluginSinceBuild = 202.4357 # Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl # See https://jb.gg/intellij-platform-builds-list for available build versions From 633a4cda7301e12768ba4ef166c72b88464715d0 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 17:10:40 +0100 Subject: [PATCH 106/115] remove mapper --- settings.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 4d85bc88c..c1db5405a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,7 +12,6 @@ pluginManagement { } } -include 'mapper' include 'marker' include 'marker:jvm-marker' include 'marker:py-marker' From dcad520455ec8c436ffb760a334c01b3f23e2f1b Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 18:44:48 +0100 Subject: [PATCH 107/115] reset --- marker/build.gradle.kts | 2 +- marker/jvm-marker/build.gradle.kts | 2 +- marker/py-marker/build.gradle.kts | 2 +- monitor/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/marker/build.gradle.kts b/marker/build.gradle.kts index 60a72bf52..e308f9aa9 100644 --- a/marker/build.gradle.kts +++ b/marker/build.gradle.kts @@ -30,7 +30,7 @@ dependencies { val intellijVersion = "213.6777.52" compileOnly("org.jooq:joor:$joorVersion") - compileOnly("com.github.sourceplusplus.protocol:protocol:af337ba247") + compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compileOnly("com.google.guava:guava:31.0.1-jre") diff --git a/marker/jvm-marker/build.gradle.kts b/marker/jvm-marker/build.gradle.kts index e0a354040..ce6f94c6d 100644 --- a/marker/jvm-marker/build.gradle.kts +++ b/marker/jvm-marker/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { compileOnly(project(":marker")) compileOnly(project(":monitor")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:af337ba247") + compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/marker/py-marker/build.gradle.kts b/marker/py-marker/build.gradle.kts index 019338ff3..a21bfac40 100644 --- a/marker/py-marker/build.gradle.kts +++ b/marker/py-marker/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { } else { compileOnly(project(":marker")) } - compileOnly("com.github.sourceplusplus.protocol:protocol:af337ba247") + compileOnly("com.github.sourceplusplus.protocol:protocol:$projectVersion") val intellijVersion = "213.6777.52" implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") diff --git a/monitor/build.gradle.kts b/monitor/build.gradle.kts index d88685a36..a73c656fb 100644 --- a/monitor/build.gradle.kts +++ b/monitor/build.gradle.kts @@ -10,7 +10,7 @@ val projectVersion: String by project val slf4jVersion: String by project dependencies { - implementation("com.github.sourceplusplus.protocol:protocol:af337ba247") + implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("com.apollographql.apollo3:apollo-runtime:$apolloVersion") api("com.apollographql.apollo3:apollo-api:$apolloVersion") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 107fba367..8baa0af6a 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -63,7 +63,7 @@ dependencies { implementation(project(":marker:py-marker")) implementation(project(":monitor")) implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4d03b0b769") { isTransitive = false } - implementation("com.github.sourceplusplus.protocol:protocol:af337ba247") + implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") } implementation("org.jooq:joor:$joorVersion") From 0e6023f1480fa07ecc49b1dd999eb2c660b15bf3 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 20:22:31 +0100 Subject: [PATCH 108/115] Update ViewEventListener.kt --- .../spp/jetbrains/sourcemarker/service/ViewEventListener.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/ViewEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/ViewEventListener.kt index 829c40635..19f3f04e6 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/ViewEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/service/ViewEventListener.kt @@ -22,7 +22,7 @@ import spp.protocol.view.LiveViewEvent /** * todo: description. * - * @since 0.5.0 + * @since 0.4.2 * @author [Brandon Fergerson](mailto:bfergerson@apache.org) */ fun interface ViewEventListener { From b1a7cc2801224e1e4c29d00807b2b1b8fb976c2e Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 20:47:41 +0100 Subject: [PATCH 109/115] merge refactor --- .../spp/jetbrains/sourcemarker/status/LogStatusBar.java | 1 - .../spp/jetbrains/sourcemarker/status/LiveStatusManager.kt | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java index 2216a9578..35cd57af9 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/status/LogStatusBar.java @@ -60,7 +60,6 @@ import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt index 92ec3d899..76e434856 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/status/LiveStatusManager.kt @@ -37,7 +37,6 @@ import spp.jetbrains.marker.source.mark.api.event.SourceMarkEvent import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventListener import spp.jetbrains.marker.source.mark.inlay.InlayMark -import spp.jetbrains.sourcemarker.SourceMarkerPlugin import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_METER_COUNT_ICON import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_METER_GAUGE_ICON import spp.jetbrains.sourcemarker.icons.SourceMarkerIcons.LIVE_METER_HISTOGRAM_ICON @@ -50,7 +49,6 @@ import spp.jetbrains.sourcemarker.service.InstrumentEventListener import spp.jetbrains.sourcemarker.service.ViewEventListener import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.jetbrains.sourcemarker.status.util.CircularList -import spp.protocol.ProtocolAddress.Portal.DisplayLogs import spp.protocol.SourceServices import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType @@ -62,7 +60,6 @@ import java.awt.BorderLayout import java.awt.Dimension import java.awt.GridBagConstraints import java.awt.GridBagLayout -import java.time.Instant import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.CopyOnWriteArrayList import javax.swing.JComponent @@ -496,12 +493,12 @@ object LiveStatusManager : SourceMarkEventListener { } fun getLogData(inlayMark: InlayMark): List<*> { - val logId = inlayMark.getUserData(LOG_ID) + val logId = inlayMark.getUserData(INSTRUMENT_ID) return logData.getOrPut(logId) { CircularList(1000) } } fun removeLogData(inlayMark: InlayMark) { - val logId = inlayMark.getUserData(LOG_ID) + val logId = inlayMark.getUserData(INSTRUMENT_ID) logData.remove(logId) } } From bb6f79aeaedc3312afc14043e4825beb2c1cabea Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 20:54:56 +0100 Subject: [PATCH 110/115] Update build.gradle.kts --- plugin/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index e4c45b3e4..94e407c81 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -62,7 +62,7 @@ dependencies { implementation(project(":marker:jvm-marker")) implementation(project(":marker:py-marker")) implementation(project(":monitor")) - implementation("com.github.sourceplusplus.interface-portal:portal-jvm:4d03b0b769") { isTransitive = false } + implementation("com.github.sourceplusplus.interface-portal:portal-jvm:$projectVersion") { isTransitive = false } implementation("com.github.sourceplusplus.protocol:protocol:$projectVersion") } From 734095b388f89620af81dc17216909f833d804a9 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 20:57:03 +0100 Subject: [PATCH 111/115] remove mapper --- .../spp/jetbrains/mapper/SourceMapperTest.kt | 83 ----- .../mapper/vcs/git/GitRepositoryMapperTest.kt | 196 ----------- .../mapper/vcs/git/MethodRenameTest.kt | 318 ------------------ 3 files changed, 597 deletions(-) delete mode 100644 plugin/src/test/kotlin/spp/jetbrains/mapper/SourceMapperTest.kt delete mode 100644 plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapperTest.kt delete mode 100644 plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/MethodRenameTest.kt diff --git a/plugin/src/test/kotlin/spp/jetbrains/mapper/SourceMapperTest.kt b/plugin/src/test/kotlin/spp/jetbrains/mapper/SourceMapperTest.kt deleted file mode 100644 index 8c4495795..000000000 --- a/plugin/src/test/kotlin/spp/jetbrains/mapper/SourceMapperTest.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper - -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.fileTypes.FileTypeRegistry -import com.intellij.psi.JavaRecursiveElementVisitor -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFileFactory -import com.intellij.psi.impl.source.tree.LeafPsiElement -import com.intellij.testFramework.TestApplicationManager -import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase -import org.jetbrains.uast.UFile -import org.jetbrains.uast.toUElement -import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.BeforeEach -import spp.jetbrains.mapper.extend.SourceCodeTokenizer -import spp.jetbrains.marker.source.JVMMarkerUtils - -abstract class SourceMapperTest : LightJavaCodeInsightFixtureTestCase() { - - protected lateinit var sourceCodeTokenizer: SourceCodeTokenizer - - @BeforeEach - fun init() { - super.setUp() - - sourceCodeTokenizer = object : SourceCodeTokenizer { - override fun getMethods( - filename: String, - sourceCode: String - ): List { - val result = mutableListOf() - ApplicationManager.getApplication().runReadAction { - val fileType = FileTypeRegistry.getInstance().getFileTypeByFileName(filename) - val psiFile = PsiFileFactory.getInstance(project).createFileFromText(filename, fileType, sourceCode) - val uFile = psiFile.toUElement() as UFile - uFile.classes.forEach { uClass -> - uClass.methods.forEach { - val tokens = mutableListOf() - it.javaPsi.accept(object : JavaRecursiveElementVisitor() { - override fun visitElement(element: PsiElement) { - if (element is LeafPsiElement && element.text.isNotBlank()) { - tokens.add(element.text) - } - super.visitElement(element) - } - }) - - result.add( - SourceCodeTokenizer.TokenizedMethod( - JVMMarkerUtils.getFullyQualifiedName(it), tokens - ) - ) - } - } - } - return result - } - } - } - - @AfterEach - override fun tearDown() { - super.tearDown() - TestApplicationManager.getInstance().setDataProvider(null) - } -} diff --git a/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapperTest.kt b/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapperTest.kt deleted file mode 100644 index 59a0c1cd7..000000000 --- a/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/GitRepositoryMapperTest.kt +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.vcs.git - -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.internal.storage.file.FileRepository -import org.intellij.lang.annotations.Language -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test -import spp.jetbrains.mapper.SourceMapperTest -import java.io.File -import java.nio.file.Files -import java.util.* - -class GitRepositoryMapperTest : SourceMapperTest() { - - @Test - fun `tokenized java getter method`() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Java") val code = """ - public class GetterMethod { - private String str; - public String getStr() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - } - - val fileRepo = FileRepository(File(tmpRepo, ".git")) - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(fileRepo) - - val finerMethodFile = File(gitMapper.targetSourceDirectory, "GetterMethod.getStr().mjava") - assertExists(finerMethodFile) - assertEquals( - """ - public - String - getStr - ( - ) - { - return - str - ; - } - """.trimIndent(), finerMethodFile.readText().trimIndent() - ) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun `tokenized groovy getter method`() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Groovy") val code = """ - class GetterMethod { - private String str - String getStr() { - return str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.groovy").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - } - - val fileRepo = FileRepository(File(tmpRepo, ".git")) - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(fileRepo) - - val finerMethodFile = File(gitMapper.targetSourceDirectory, "GetterMethod.getStr().mgroovy") - assertExists(finerMethodFile) - assertEquals( - """ - String - getStr - ( - ) - { - return - str - } - """.trimIndent(), finerMethodFile.readText().trimIndent() - ) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - -// @Test -// fun `tokenized kotlin getter method`() { -// Git.init().setDirectory(File("/tmp/git-repo")).call().use { git -> -// @Language("Kt") val code = """ -// class GetterMethod(private val str: String) { -// fun getStr(): String { -// return str -// } -// } -// """.trimIndent() -// File(git.repository.directory.parent, "GetterMethod.kt").writeText(code) -// git.add().addFilepattern(".").call() -// git.commit().setMessage("Initial commit").call() -// } -// -// val fileRepo = FileRepository("/tmp/git-repo/.git") -// val gitMapper = GitRepositoryMapper(project) -// gitMapper.initialize(fileRepo) -// -// val finerMethodFile = File(gitMapper.targetSourceDirectory, "GetterMethod.getStr().mkt") -// assertExists(finerMethodFile) -// assertEquals( -// """ -// fun -// getStr -// ( -// ) -// { -// return -// str -// } -// """.trimIndent(), finerMethodFile.readText().trimIndent() -// ) -// gitMapper.sourceRepo.directory.parentFile.deleteRecursively() -// gitMapper.targetGit.close() -// gitMapper.targetSourceDirectory.deleteRecursively() -// } - - @Disabled - @Test - fun `tokenized scala getter method`() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - Git.init().setDirectory(tmpRepo).call().use { git -> - //todo: @Language("Scala") doesn't work - @Language("Scala") val code = """ - class GetterMethod { - private var str: String = _ - - def getStr(): String = { - str - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.scala").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - } - - val fileRepo = FileRepository(File(tmpRepo, ".git")) - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(fileRepo) - - val finerMethodFile = File(gitMapper.targetSourceDirectory, "GetterMethod.getStr().mscala") - assertExists(finerMethodFile) - assertEquals( - """ - def - getStr - ( - ) - : - String - = - { - str - } - """.trimIndent(), finerMethodFile.readText().trimIndent() - ) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } -} diff --git a/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/MethodRenameTest.kt b/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/MethodRenameTest.kt deleted file mode 100644 index 114e2b4d1..000000000 --- a/plugin/src/test/kotlin/spp/jetbrains/mapper/vcs/git/MethodRenameTest.kt +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Source++, the open-source live coding platform. - * Copyright (C) 2022 CodeBrig, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package spp.jetbrains.mapper.vcs.git - -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.internal.storage.file.FileRepository -import org.eclipse.jgit.lib.AnyObjectId -import org.eclipse.jgit.lib.Constants -import org.eclipse.jgit.revwalk.RevCommit -import org.eclipse.jgit.revwalk.RevSort -import org.eclipse.jgit.revwalk.RevWalk -import org.eclipse.jgit.transport.URIish -import org.intellij.lang.annotations.Language -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test -import spp.jetbrains.mapper.SourceMapperTest -import spp.jetbrains.mapper.api.impl.SourceMapperImpl -import spp.jetbrains.mapper.vcs.git.GitRepositoryMapper.Companion.originalCommitIdPattern -import spp.protocol.artifact.ArtifactQualifiedName -import spp.protocol.artifact.ArtifactType -import java.io.File -import java.nio.file.Files -import java.util.* - -@Disabled -class MethodRenameTest : SourceMapperTest() { - - @Test - fun `java get original method name`() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Java") val code = """ - public class GetterMethod { - private String str; - public String getStr() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Java") val renamedCode = """ - public class GetterMethod { - private String str; - public String getStr2() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - val oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - val newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr2()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun `java get updated method name`() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - Git.init().setDirectory(tmpRepo).call().use { git -> - @Language("Java") val code = """ - public class GetterMethod { - private String str; - public String getStr() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(code) - git.add().addFilepattern(".").call() - git.commit().setMessage("Initial commit").call() - - @Language("Java") val renamedCode = """ - public class GetterMethod { - private String str; - public String getStr2() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(renamedCode) - git.add().addFilepattern(".").call() - git.commit().setMessage("Renamed method").call() - } - - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = gitMapper.targetRepo.resolve("$newCommitId^1").name - val newName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr2()", - commitId = newCommitId, - type = ArtifactType.METHOD - ) - val oldName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(newName, oldCommitId) - - assertTrue(oldName.isPresent) - assertEquals("GetterMethod.getStr()", oldName.get().identifier) - assertEquals(oldCommitId, oldName.get().commitId) - assertEquals("GetterMethod.getStr2()", newName.identifier) - assertEquals(newCommitId, newName.commitId) - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun `java get reinitialize original method name`() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - val git = Git.init().setDirectory(tmpRepo).call() - @Language("Java") val code = """ - public class GetterMethod { - private String str; - public String getStr() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(code) - git.add().addFilepattern(".").call() - val initialCommit = git.commit().setMessage("Initial commit").call() - - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - @Language("Java") val renamedCode = """ - public class GetterMethod { - private String str; - public String getStr2() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(renamedCode) - git.add().addFilepattern(".").call() - val lastCommit = git.commit().setMessage("Renamed method").call() - - gitMapper.targetGit.remoteAdd().setName("sourceRepo") - .setUri(URIish(gitMapper.sourceRepo.directory.absolutePath)) - .call() - gitMapper.targetGit.fetch().setRemote("sourceRepo").call() - gitMapper.targetGit.merge() - .include(gitMapper.targetRepo.resolve("refs/remotes/sourceRepo/master")) - .call() - gitMapper.reinitialize() - - val rw = RevWalk(gitMapper.targetRepo) - val headId: AnyObjectId - headId = gitMapper.targetRepo.resolve(Constants.HEAD) - val root: RevCommit = rw.parseCommit(headId) - rw.sort(RevSort.REVERSE) - rw.markStart(root) - val firstCommit = rw.next() - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = firstCommit.name - val oldName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr()", - commitId = oldCommitId, - type = ArtifactType.METHOD - ) - val newName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(oldName, newCommitId) - - assertTrue(newName.isPresent) - assertEquals("GetterMethod.getStr2()", newName.get().identifier) - assertEquals(newCommitId, newName.get().commitId) - assertEquals("GetterMethod.getStr()", oldName.identifier) - assertEquals(oldCommitId, oldName.commitId) - - val sourceCommits = git.log().call().toList() - val targetCommits = gitMapper.targetGit.log().call().toList() - assertNotNull(sourceCommits) - assertNotNull(targetCommits) - assertEquals(2, sourceCommits.size) - assertEquals(sourceCommits.size, targetCommits.size) - - val matcher0 = originalCommitIdPattern.matcher(targetCommits[0].fullMessage) - val matcher1 = originalCommitIdPattern.matcher(targetCommits[1].fullMessage) - assertTrue(matcher0.find()) - assertTrue(matcher1.find()) - assertEquals(lastCommit.id.name, sourceCommits[0].id.name) - assertEquals(initialCommit.id.name, sourceCommits[1].id.name) - assertEquals(sourceCommits[0].id.name, matcher0.group(1)) - assertEquals(sourceCommits[1].id.name, matcher1.group(1)) - - git.close() - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } - - @Test - fun `java get reinitialize updated method name`() { - val tmpRepo = Files.createTempDirectory("test-" + UUID.randomUUID()).toFile() - val gitMapper = GitRepositoryMapper(sourceCodeTokenizer) - val git = Git.init().setDirectory(tmpRepo).call() - @Language("Java") val code = """ - public class GetterMethod { - private String str; - public String getStr() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(code) - git.add().addFilepattern(".").call() - val initialCommit = git.commit().setMessage("Initial commit").call() - - gitMapper.initialize(FileRepository(File(tmpRepo, ".git"))) - - @Language("Java") val renamedCode = """ - public class GetterMethod { - private String str; - public String getStr2() { - return str; - } - } - """.trimIndent() - File(git.repository.directory.parent, "GetterMethod.java").writeText(renamedCode) - git.add().addFilepattern(".").call() - val lastCommit = git.commit().setMessage("Renamed method").call() - - gitMapper.targetGit.remoteAdd().setName("sourceRepo") - .setUri(URIish(gitMapper.sourceRepo.directory.absolutePath)) - .call() - gitMapper.targetGit.fetch().setRemote("sourceRepo").call() - gitMapper.targetGit.merge() - .include(gitMapper.targetRepo.resolve("refs/remotes/sourceRepo/master")) - .call() - gitMapper.reinitialize() - - val rw = RevWalk(gitMapper.targetRepo) - val headId: AnyObjectId - headId = gitMapper.targetRepo.resolve(Constants.HEAD) - val root: RevCommit = rw.parseCommit(headId) - rw.sort(RevSort.REVERSE) - rw.markStart(root) - val firstCommit = rw.next() - - val newCommitId = gitMapper.targetRepo.resolve(Constants.HEAD).name - val oldCommitId = firstCommit.name - val newName = ArtifactQualifiedName( - identifier = "GetterMethod.getStr2()", - commitId = newCommitId, - type = ArtifactType.METHOD - ) - val oldName = SourceMapperImpl(gitMapper) - .getMethodQualifiedName(newName, oldCommitId) - - assertTrue(oldName.isPresent) - assertEquals("GetterMethod.getStr()", oldName.get().identifier) - assertEquals(oldCommitId, oldName.get().commitId) - assertEquals("GetterMethod.getStr2()", newName.identifier) - assertEquals(newCommitId, newName.commitId) - - val sourceCommits = git.log().call().toList() - val targetCommits = gitMapper.targetGit.log().call().toList() - assertNotNull(sourceCommits) - assertNotNull(targetCommits) - assertEquals(2, sourceCommits.size) - assertEquals(sourceCommits.size, targetCommits.size) - - val matcher0 = originalCommitIdPattern.matcher(targetCommits[0].fullMessage) - val matcher1 = originalCommitIdPattern.matcher(targetCommits[1].fullMessage) - assertTrue(matcher0.find()) - assertTrue(matcher1.find()) - assertEquals(lastCommit.id.name, sourceCommits[0].id.name) - assertEquals(initialCommit.id.name, sourceCommits[1].id.name) - assertEquals(sourceCommits[0].id.name, matcher0.group(1)) - assertEquals(sourceCommits[1].id.name, matcher1.group(1)) - - git.close() - gitMapper.sourceRepo.directory.parentFile.deleteRecursively() - gitMapper.targetGit.close() - gitMapper.targetSourceDirectory.deleteRecursively() - } -} From 38bb5bcbf85d0859a0050d8ecbcf40caddfb2afa Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 13 Mar 2022 21:30:45 +0100 Subject: [PATCH 112/115] compatibility --- .../kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt index d7b1ce88f..d06ea663f 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/reporting/error-report.kt @@ -264,7 +264,7 @@ private fun getKeyValuePairs( namesInfo: ApplicationNamesInfo ): MutableMap { PluginManagerCore.getPlugin( - PluginId.findId("com.sourceplusplus.plugin.intellij") + PluginId.findId("com.sourceplusplus.plugin.intellij", "com.sourceplusplus.plugin.intellij") )?.run { if (error.pluginName.isBlank()) error.pluginName = name if (error.pluginVersion.isBlank()) error.pluginVersion = version From 7763fec5b0d90e25d31e7d223090c87be3311476 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 14 Mar 2022 10:20:26 +0100 Subject: [PATCH 113/115] overview wip --- .../jetbrains/sourcemarker/PluginIcons.java | 6 ++++-- .../command/ControlBarController.kt | 4 +++- .../command/LiveControlCommand.kt | 10 +++++++-- .../sourcemarker/portal/PortalController.kt | 10 +++++++-- .../portal/PortalEventListener.kt | 21 ++++++++++++------- .../icons/command/view-overview_selected.svg | 3 +++ .../command/view-overview_selected_dark.svg | 4 ++++ .../command/view-overview_unselected.svg | 4 ++++ .../command/view-overview_unselected_dark.svg | 4 ++++ 9 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 plugin/src/main/resources/icons/command/view-overview_selected.svg create mode 100644 plugin/src/main/resources/icons/command/view-overview_selected_dark.svg create mode 100644 plugin/src/main/resources/icons/command/view-overview_unselected.svg create mode 100644 plugin/src/main/resources/icons/command/view-overview_unselected_dark.svg diff --git a/plugin/src/main/java/spp/jetbrains/sourcemarker/PluginIcons.java b/plugin/src/main/java/spp/jetbrains/sourcemarker/PluginIcons.java index c65fde51f..adf1e15d6 100644 --- a/plugin/src/main/java/spp/jetbrains/sourcemarker/PluginIcons.java +++ b/plugin/src/main/java/spp/jetbrains/sourcemarker/PluginIcons.java @@ -49,8 +49,8 @@ interface Command { Icon liveBreakpointSelected = IconLoader.getIcon("/icons/command/live-breakpoint_selected.svg", PluginIcons.class); Icon liveBreakpointUnSelected = IconLoader.getIcon("/icons/command/live-breakpoint_unselected.svg", PluginIcons.class); - Icon livelogSelected = IconLoader.getIcon("/icons/command/live-log_selected.svg", PluginIcons.class); - Icon livelogUnSelected = IconLoader.getIcon("/icons/command/live-log_unselected.svg", PluginIcons.class); + Icon liveLogSelected = IconLoader.getIcon("/icons/command/live-log_selected.svg", PluginIcons.class); + Icon liveLogUnSelected = IconLoader.getIcon("/icons/command/live-log_unselected.svg", PluginIcons.class); Icon liveMeterSelected = IconLoader.getIcon("/icons/command/live-meter_selected.svg", PluginIcons.class); Icon liveMeterUnSelected = IconLoader.getIcon("/icons/command/live-meter_unselected.svg", PluginIcons.class); @@ -58,6 +58,8 @@ interface Command { Icon liveSpanSelected = IconLoader.getIcon("/icons/command/live-span_selected.svg", PluginIcons.class); Icon liveSpanUnSelected = IconLoader.getIcon("/icons/command/live-span_unselected.svg", PluginIcons.class); + Icon viewOverviewSelected = IconLoader.getIcon("/icons/command/view-overview_selected.svg", PluginIcons.class); + Icon viewOverviewUnSelected = IconLoader.getIcon("/icons/command/view-overview_unselected.svg", PluginIcons.class); Icon viewActivitySelected = IconLoader.getIcon("/icons/command/view-activity_selected.svg", PluginIcons.class); Icon viewActivityUnSelected = IconLoader.getIcon("/icons/command/view-activity_unselected.svg", PluginIcons.class); Icon viewTracesSelected = IconLoader.getIcon("/icons/command/view-traces_selected.svg", PluginIcons.class); diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt index 7fe1a7221..a2f9ad5db 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt @@ -68,6 +68,7 @@ object ControlBarController { @Suppress("UselessCallOnCollection") //unknown enums are null selfInfo.permissions.filterNotNull().map { it.name }.contains(it.name) }) + //availableCommands.add(VIEW_OVERVIEW) //todo: remove after v0.4.2 } private fun determineAvailableCommandsAtLocation(inlayMark: ExpressionInlayMark): List { @@ -79,7 +80,7 @@ object ControlBarController { val parentMark = inlayMark.getParentSourceMark() if (parentMark is MethodSourceMark) { val loggerDetector = parentMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR) - if (loggerDetector != null) { + if (loggerDetector != null && SourceServices.Instance.liveView != null) { runBlocking { val detectedLogs = loggerDetector.getOrFindLoggerStatements(parentMark) val logOnCurrentLine = detectedLogs.find { it.lineLocation == inlayMark.lineNumber } @@ -95,6 +96,7 @@ object ControlBarController { fun handleCommandInput(input: String, editor: Editor) { log.info("Processing command input: {}", input) when (input) { + VIEW_OVERVIEW.command -> handleViewPortalCommand(editor, VIEW_OVERVIEW) VIEW_ACTIVITY.command -> handleViewPortalCommand(editor, VIEW_ACTIVITY) VIEW_TRACES.command -> handleViewPortalCommand(editor, VIEW_TRACES) VIEW_LOGS.command -> handleViewPortalCommand(editor, VIEW_LOGS) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt index 94f34358b..800b9a1dd 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt @@ -34,6 +34,12 @@ enum class LiveControlCommand( val unselectedIcon: Icon? = null ) : AutocompleteFieldRow { + VIEW_OVERVIEW( + "View Overview", + "Live View ➛ Overview ➛ Scope: Class", + PluginIcons.Command.viewOverviewSelected, + PluginIcons.Command.viewOverviewUnSelected + ), VIEW_ACTIVITY( "View Activity", "Live View ➛ Activity ➛ Scope: Method", @@ -75,8 +81,8 @@ enum class LiveControlCommand( ADD_LIVE_LOG( "Add Log", "Live Instrument ➛ Add ➛ Location: On line *lineNumber*", - PluginIcons.Command.livelogSelected, - PluginIcons.Command.livelogUnSelected + PluginIcons.Command.liveLogSelected, + PluginIcons.Command.liveLogUnSelected ), ADD_LIVE_METER( "Add Meter", diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt index 93a0ae463..c500c02fa 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt @@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode +import spp.jetbrains.marker.source.mark.gutter.GutterMark import spp.jetbrains.portal.SourcePortal import spp.jetbrains.portal.backend.PortalServer import spp.jetbrains.portal.protocol.portal.PageType @@ -35,7 +36,9 @@ import spp.jetbrains.sourcemarker.command.LiveControlCommand import spp.jetbrains.sourcemarker.command.LiveControlCommand.* import spp.jetbrains.sourcemarker.mark.SourceMarkKeys import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig +import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.marshall.KSerializers +import spp.protocol.marshall.LocalMessageCodec import javax.swing.UIManager class PortalController(private val markerConfig: SourceMarkerConfig) : CoroutineVerticle() { @@ -54,9 +57,11 @@ class PortalController(private val markerConfig: SourceMarkerConfig) : Coroutine vertx.deployVerticle(portalServer).await() vertx.deployVerticle(PortalEventListener(markerConfig)).await() +// //todo: remove after v0.4.2 +// vertx.eventBus().registerDefaultCodec(ArtifactQualifiedName::class.java, LocalMessageCodec()) + SourceMarker.addGlobalSourceMarkEventListener { - if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED) { - //todo: only register when needed + if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED && it.sourceMark is GutterMark) { //register portal for source mark val portal = SourcePortal.getPortal( SourcePortal.register(it.sourceMark.artifactQualifiedName, false) @@ -72,6 +77,7 @@ class PortalController(private val markerConfig: SourceMarkerConfig) : Coroutine it.sourceMark.addEventListener { if (it.eventCode == SourceMarkEventCode.UPDATE_PORTAL_CONFIG) { when (val command = it.params.first() as LiveControlCommand) { + VIEW_OVERVIEW -> portal.configuration.config["currentPage"] = PageType.OVERVIEW VIEW_ACTIVITY -> portal.configuration.config["currentPage"] = PageType.ACTIVITY VIEW_TRACES -> portal.configuration.config["currentPage"] = PageType.TRACES VIEW_LOGS -> portal.configuration.config["currentPage"] = PageType.LOGS diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt index a7f2d088a..2c6baa43e 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt @@ -21,6 +21,8 @@ import com.intellij.ide.ui.laf.IntelliJLaf import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.runReadAction import com.intellij.openapi.project.ProjectManager +import com.intellij.psi.PsiNameIdentifierOwner +import com.intellij.util.PsiNavigateUtil import io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND import io.vertx.core.eventbus.ReplyException import io.vertx.core.json.Json @@ -35,7 +37,9 @@ import kotlinx.datetime.toJavaInstant import kotlinx.datetime.toKotlinInstant import org.slf4j.LoggerFactory import spp.jetbrains.marker.SourceMarker +import spp.jetbrains.marker.SourceMarker.creationService import spp.jetbrains.marker.jvm.ArtifactNavigator +import spp.jetbrains.marker.jvm.ArtifactSearch.findArtifact import spp.jetbrains.marker.source.SourceFileMarker import spp.jetbrains.marker.source.mark.api.ClassSourceMark import spp.jetbrains.marker.source.mark.api.MethodSourceMark @@ -86,7 +90,9 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkSearch import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress +import spp.protocol.artifact.ArtifactNameUtils import spp.protocol.artifact.ArtifactQualifiedName +import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.QueryTimeFrame import spp.protocol.artifact.exception.LiveStackTraceElement import spp.protocol.artifact.log.Log @@ -232,9 +238,9 @@ class PortalEventListener( } vertx.eventBus().consumer(FindPortal) { // val artifactQualifiedName = it.body() -// val sourceMarks = SourceMarker.getSourceMarks(artifactQualifiedName) -// if (sourceMarks.isNotEmpty()) { -// it.reply(sourceMarks[0].getUserData(SourceMarkKeys.SOURCE_PORTAL)!!) +// val portals = SourcePortal.getPortals(artifactQualifiedName) +// if (portals.isNotEmpty()) { +// it.reply(portals.first()) // } else { // launch(vertx.dispatcher()) { // val classArtifact = findArtifact( @@ -250,7 +256,8 @@ class PortalEventListener( // val gutterMark = creationService.getOrCreateMethodGutterMark( // fileMarker, searchArtifact.nameIdentifier!! // )!! -// it.reply(gutterMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!) +// println(gutterMark) +// //it.reply(gutterMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!) // } // } // } @@ -264,9 +271,9 @@ class PortalEventListener( // ApplicationManager.getApplication().invokeLater { // PsiNavigateUtil.navigate(sourceMark.getPsiElement()) // -// val portal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!! -// openPortal(portal) -// it.reply(portal) +// val portals = SourcePortal.getPortals(artifactQualifiedName) +// openPortal(portals.first()) +// it.reply(portals.first()) // } // } else { // log.warn("Failed to find portal for artifact: $artifactQualifiedName") diff --git a/plugin/src/main/resources/icons/command/view-overview_selected.svg b/plugin/src/main/resources/icons/command/view-overview_selected.svg new file mode 100644 index 000000000..f59ce4c54 --- /dev/null +++ b/plugin/src/main/resources/icons/command/view-overview_selected.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugin/src/main/resources/icons/command/view-overview_selected_dark.svg b/plugin/src/main/resources/icons/command/view-overview_selected_dark.svg new file mode 100644 index 000000000..07980cc68 --- /dev/null +++ b/plugin/src/main/resources/icons/command/view-overview_selected_dark.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/plugin/src/main/resources/icons/command/view-overview_unselected.svg b/plugin/src/main/resources/icons/command/view-overview_unselected.svg new file mode 100644 index 000000000..07980cc68 --- /dev/null +++ b/plugin/src/main/resources/icons/command/view-overview_unselected.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/plugin/src/main/resources/icons/command/view-overview_unselected_dark.svg b/plugin/src/main/resources/icons/command/view-overview_unselected_dark.svg new file mode 100644 index 000000000..21a5d25ff --- /dev/null +++ b/plugin/src/main/resources/icons/command/view-overview_unselected_dark.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file From ee7c19a8b29428522bdffa1f7cbff2509f65825e Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 14 Mar 2022 10:20:43 +0100 Subject: [PATCH 114/115] fix edt warning --- .../kotlin/spp/jetbrains/marker/jvm/ArtifactNavigator.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactNavigator.kt b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactNavigator.kt index 931b2bd08..9265a90dd 100644 --- a/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactNavigator.kt +++ b/marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactNavigator.kt @@ -50,13 +50,17 @@ object ArtifactNavigator { //todo: remove method from method names and support navigating to classes? fun navigateTo(project: Project, element: LiveStackTraceElement) { - ApplicationManager.getApplication().invokeLater { + ApplicationManager.getApplication().runReadAction { val foundFiles = getFilesByName(project, element.sourceAsFilename()!!, allScope(project)) if (foundFiles.isNotEmpty()) { val file = foundFiles[0] val document: Document = PsiDocumentManager.getInstance(file.project).getDocument(file)!! val offset = document.getLineStartOffset(element.sourceAsLineNumber()!! - 1) - PsiNavigationSupport.getInstance().createNavigatable(project, file.virtualFile, offset).navigate(true) + + ApplicationManager.getApplication().invokeLater { + PsiNavigationSupport.getInstance().createNavigatable(project, file.virtualFile, offset) + .navigate(true) + } } } } From 49dbe1f0a4ce2dfacd90f5bdc518e5752e3fb449 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 14 Mar 2022 10:55:34 +0100 Subject: [PATCH 115/115] dupe import --- .../spp/jetbrains/sourcemarker/portal/PortalEventListener.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt index 32f532d8f..222990ea8 100644 --- a/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt +++ b/plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt @@ -86,7 +86,6 @@ import spp.jetbrains.sourcemarker.mark.SourceMarkSearch import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig import spp.protocol.SourceServices.Instance import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress -import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress import spp.protocol.artifact.ArtifactQualifiedName import spp.protocol.artifact.ArtifactType import spp.protocol.artifact.QueryTimeFrame