Skip to content

Commit 4fbde91

Browse files
committed
wip
1 parent a050fa4 commit 4fbde91

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kotlin.code.style=official
33
probeGroup = spp.probe
44
probeVersion = 0.2.0-alpha-1
55

6-
protocolVersion=0.2.0-alpha-4
6+
protocolVersion=0.2.0-alpha-5
77

88
#SkyWalking 8.8.1-compatible
99
vertxVersion = 4.0.2

services/src/main/java/spp/probe/services/common/ContextReceiver.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ object ContextReceiver {
165165
val meter = ProbeMemory.computeIfAbsent("spp.base-meter:$meterId") {
166166
when (meterType) {
167167
MeterType.COUNT -> return@computeIfAbsent MeterFactory.counter(
168-
"counter_" + meterId.replace("-", "_")
168+
"count_" + meterId.replace("-", "_")
169169
).mode(CounterMode.RATE)
170170
.build()
171171
MeterType.GAUGE -> return@computeIfAbsent MeterFactory.gauge(

services/src/main/java/spp/probe/services/common/model/ActiveLiveInstrument.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ class ActiveLiveInstrument @JvmOverloads constructor(
88
val instrument: LiveInstrument,
99
val expression: Expression? = null
1010
) {
11-
val throttle: HitThrottle = HitThrottle(instrument.throttle.limit, instrument.throttle.step)
11+
val throttle: HitThrottle? = instrument.throttle.let {
12+
if (it != null) {
13+
HitThrottle(it.limit, it.step)
14+
} else {
15+
null
16+
}
17+
}
1218
var isRemoval = false
1319
var isLive = false
1420

1521
val isFinished: Boolean
1622
get() = if (instrument.expiresAt != null && System.currentTimeMillis() >= instrument.expiresAt!!) {
1723
true
1824
} else {
19-
instrument.hitLimit != -1 && throttle.totalHitCount >= instrument.hitLimit
25+
instrument.hitLimit != -1 && (throttle != null && throttle.totalHitCount >= instrument.hitLimit)
2026
}
2127
}

services/src/main/java/spp/probe/services/instrument/LiveInstrumentService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ object LiveInstrumentService {
278278
@JvmStatic
279279
fun isHit(instrumentId: String): Boolean {
280280
val instrument = instruments[instrumentId] ?: return false
281-
if (instrument.throttle.isRateLimited()) {
281+
if (instrument.throttle?.isRateLimited() == true) {
282282
ContextReceiver.clear(instrumentId)
283283
return false
284284
}

0 commit comments

Comments
 (0)