Skip to content

Commit e779778

Browse files
committed
chore: add probeId to LiveSourceLocation, add isSameLocation(InstanceLocation)
1 parent 933a4b0 commit e779778

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/main/kotlin/spp/protocol/instrument/LiveSourceLocation.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package spp.protocol.instrument
1818

1919
import io.vertx.codegen.annotations.DataObject
2020
import io.vertx.core.json.JsonObject
21+
import spp.protocol.platform.status.InstanceConnection
2122

2223
/**
2324
* todo: description.
@@ -34,6 +35,7 @@ data class LiveSourceLocation @JvmOverloads constructor(
3435
val commitId: String? = null, //todo: impl
3536
val fileChecksum: String? = null, //todo: impl
3637
//val language: ArtifactLanguage? = null, //todo: impl
38+
val probeId: String? = null,
3739
) : Comparable<LiveSourceLocation> {
3840

3941
constructor(json: JsonObject) : this(
@@ -42,7 +44,9 @@ data class LiveSourceLocation @JvmOverloads constructor(
4244
service = json.getString("service"),
4345
serviceInstance = json.getString("serviceInstance"),
4446
commitId = json.getString("commitId"),
45-
fileChecksum = json.getString("fileChecksum")
47+
fileChecksum = json.getString("fileChecksum"),
48+
//language = json.getString("language")?.let { ArtifactLanguage.valueOf(it) }
49+
probeId = json.getString("probeId"),
4650
)
4751

4852
fun toJson(): JsonObject {
@@ -53,6 +57,8 @@ data class LiveSourceLocation @JvmOverloads constructor(
5357
json.put("serviceInstance", serviceInstance)
5458
json.put("commitId", commitId)
5559
json.put("fileChecksum", fileChecksum)
60+
//json.put("language", language?.name)
61+
json.put("probeId", probeId)
5662
return json
5763
}
5864

@@ -69,6 +75,16 @@ data class LiveSourceLocation @JvmOverloads constructor(
6975
if (serviceInstance != other.serviceInstance) return false
7076
if (commitId != other.commitId) return false
7177
if (fileChecksum != other.fileChecksum) return false
78+
//if (language != other.language) return false
79+
if (probeId != other.probeId) return false
80+
return true
81+
}
82+
83+
fun isSameLocation(other: InstanceConnection): Boolean {
84+
if (service != null && service != other.meta["service"]) return false
85+
if (serviceInstance != null && serviceInstance != other.meta["service_instance"]) return false
86+
if (commitId != null && commitId != other.meta["commit_id"]) return false
87+
if (probeId != null && probeId != other.instanceId) return false
7288
return true
7389
}
7490
}

0 commit comments

Comments
 (0)