|
1 | 1 | package spp.cli.commands.instrument |
2 | 2 |
|
3 | 3 | import com.apollographql.apollo3.api.CustomScalarAdapters |
4 | | -import com.apollographql.apollo3.api.Optional |
5 | 4 | import com.apollographql.apollo3.api.json.MapJsonWriter |
6 | 5 | import com.github.ajalt.clikt.core.CliktCommand |
7 | 6 | import com.github.ajalt.clikt.parameters.arguments.argument |
8 | | -import com.github.ajalt.clikt.parameters.options.default |
9 | | -import com.github.ajalt.clikt.parameters.options.option |
10 | | -import com.github.ajalt.clikt.parameters.types.enum |
11 | | -import com.github.ajalt.clikt.parameters.types.int |
12 | | -import com.github.ajalt.clikt.parameters.types.long |
13 | 7 | import kotlinx.coroutines.runBlocking |
14 | 8 | import spp.cli.Main |
15 | 9 | import spp.cli.PlatformCLI.apolloClient |
16 | 10 | import spp.cli.PlatformCLI.echoError |
17 | 11 | import spp.cli.protocol.instrument.AddLiveSpanMutation |
18 | 12 | import spp.cli.protocol.instrument.adapter.AddLiveSpanMutation_ResponseAdapter.AddLiveSpan |
19 | | -import spp.cli.protocol.type.InstrumentThrottleInput |
20 | | -import spp.cli.protocol.type.LiveSourceLocationInput |
21 | 13 | import spp.cli.protocol.type.LiveSpanInput |
22 | | -import spp.cli.protocol.type.ThrottleStep |
| 14 | +import spp.cli.protocol.type.LiveSpanLocationInput |
23 | 15 | import spp.cli.util.JsonCleaner |
24 | 16 | import kotlin.system.exitProcess |
25 | 17 |
|
26 | 18 | class AddSpan : CliktCommand() { |
27 | 19 |
|
28 | | - val source by argument(help = "Qualified class name") |
29 | | - val line by argument(help = "Line number").int() |
| 20 | + val source by argument(help = "Qualified function name") |
30 | 21 | val operationName by argument(help = "Operation name") |
31 | | - val condition by option("-condition", "-c", help = "Trigger condition") |
32 | | - val expiresAt by option("-expiresAt", "-e", help = "Expiration time (epoch time [ms])").long() |
33 | | - val hitLimit by option("-hitLimit", "-h", help = "Trigger hit limit").int() |
34 | | - val throttleLimit by option("-throttleLimit", "-t", help = "Trigger throttle limit").int().default(1) |
35 | | - val throttleStep by option("-throttleStep", "-s", help = "Trigger throttle step").enum<ThrottleStep>() |
36 | | - .default(ThrottleStep.SECOND) |
| 22 | +// val condition by option("-condition", "-c", help = "Trigger condition") |
| 23 | +// val expiresAt by option("-expiresAt", "-e", help = "Expiration time (epoch time [ms])").long() |
| 24 | +// val hitLimit by option("-hitLimit", "-h", help = "Trigger hit limit").int() |
| 25 | +// val throttleLimit by option("-throttleLimit", "-t", help = "Trigger throttle limit").int().default(1) |
| 26 | +// val throttleStep by option("-throttleStep", "-s", help = "Trigger throttle step").enum<ThrottleStep>() |
| 27 | +// .default(ThrottleStep.SECOND) |
37 | 28 |
|
38 | 29 | override fun run() = runBlocking { |
39 | 30 | val input = LiveSpanInput( |
40 | 31 | operationName = operationName, |
41 | | - location = LiveSourceLocationInput(source, line), |
42 | | - condition = Optional.Present(condition), |
43 | | - expiresAt = Optional.Present(expiresAt), |
44 | | - hitLimit = Optional.Present(hitLimit), |
45 | | - throttle = Optional.Present(InstrumentThrottleInput(throttleLimit, throttleStep)) |
| 32 | + location = LiveSpanLocationInput(source), |
| 33 | +// condition = Optional.Present(condition), |
| 34 | +// expiresAt = Optional.Present(expiresAt), |
| 35 | +// hitLimit = Optional.Present(hitLimit), |
| 36 | +// throttle = Optional.Present(InstrumentThrottleInput(throttleLimit, throttleStep)) |
46 | 37 | ) |
47 | 38 | val response = try { |
48 | 39 | apolloClient.mutation(AddLiveSpanMutation(input)).execute() |
|
0 commit comments