Skip to content

Commit 5d6cc3e

Browse files
committed
refactor: optional meter description
1 parent e776220 commit 5d6cc3e

File tree

9 files changed

+56
-48
lines changed

9 files changed

+56
-48
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ data class LiveMeter(
8080
return json
8181
}
8282

83-
fun toMetricIdWithoutPrefix(): String = meterType.name.lowercase() + "_" + id!!.replace("-", "_")
83+
fun toMetricIdWithoutPrefix(): String = meterType.name.lowercase() + "_" +
84+
id!!.replace("-", "_").replace(" ", "_")
85+
8486
fun toMetricId(): String = "spp_" + toMetricIdWithoutPrefix()
8587

8688
/**

src/main/resources/graphql/.graphqlconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"extensions": {
55
"endpoints": {
66
"Default GraphQL Endpoint": {
7-
"url": "http://localhost:12800/graphql",
7+
"url": "https://localhost:12800/graphql/spp",
88
"headers": {
99
"user-agent": "JS GraphQL"
1010
},

src/main/resources/graphql/instrument/add-live-meter.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
mutation addLiveMeter($input: LiveMeterInput!) {
22
addLiveMeter(input: $input) {
33
id
4-
meterName
54
meterType
65
metricValue {
76
valueType
87
value
98
}
9+
meterDescription
1010
location {
1111
source
1212
line

src/main/resources/graphql/instrument/get-live-instruments.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ query getLiveInstruments{
1919
logArguments
2020
}
2121
... on LiveMeter {
22-
meterName
2322
meterType
2423
metricValue {
2524
valueType
2625
value
2726
}
27+
meterDescription
2828
}
2929
... on LiveSpan {
3030
operationName

src/main/resources/graphql/instrument/get-live-meters.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
query getLiveMeters{
22
getLiveMeters {
33
id
4-
meterName
54
meterType
65
metricValue {
76
valueType
87
value
98
}
9+
meterDescription
1010
location {
1111
source
1212
line

src/main/resources/graphql/instrument/remove-live-instrument.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ mutation removeLiveInstrument($id: String!) {
1919
logArguments
2020
}
2121
... on LiveMeter {
22-
meterName
2322
meterType
2423
metricValue {
2524
valueType
2625
value
2726
}
27+
meterDescription
2828
}
2929
... on LiveSpan {
3030
operationName

src/main/resources/graphql/instrument/remove-live-instruments.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ mutation removeLiveInstruments($source: String!, $line: Int!) {
1919
logArguments
2020
}
2121
... on LiveMeter {
22-
meterName
2322
meterType
2423
metricValue {
2524
valueType
2625
value
2726
}
27+
meterDescription
2828
}
2929
... on LiveSpan {
3030
operationName

src/main/resources/graphql/schema.json

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,49 +1335,45 @@
13351335
"description": null,
13361336
"fields": [
13371337
{
1338-
"name": "meterName",
1338+
"name": "meterType",
13391339
"description": null,
13401340
"args": [],
13411341
"type": {
13421342
"kind": "NON_NULL",
13431343
"name": null,
13441344
"ofType": {
1345-
"kind": "SCALAR",
1346-
"name": "String",
1345+
"kind": "ENUM",
1346+
"name": "MeterType",
13471347
"ofType": null
13481348
}
13491349
},
13501350
"isDeprecated": false,
13511351
"deprecationReason": null
13521352
},
13531353
{
1354-
"name": "meterType",
1354+
"name": "metricValue",
13551355
"description": null,
13561356
"args": [],
13571357
"type": {
13581358
"kind": "NON_NULL",
13591359
"name": null,
13601360
"ofType": {
1361-
"kind": "ENUM",
1362-
"name": "MeterType",
1361+
"kind": "OBJECT",
1362+
"name": "MetricValue",
13631363
"ofType": null
13641364
}
13651365
},
13661366
"isDeprecated": false,
13671367
"deprecationReason": null
13681368
},
13691369
{
1370-
"name": "metricValue",
1370+
"name": "meterDescription",
13711371
"description": null,
13721372
"args": [],
13731373
"type": {
1374-
"kind": "NON_NULL",
1375-
"name": null,
1376-
"ofType": {
1377-
"kind": "OBJECT",
1378-
"name": "MetricValue",
1379-
"ofType": null
1380-
}
1374+
"kind": "SCALAR",
1375+
"name": "String",
1376+
"ofType": null
13811377
},
13821378
"isDeprecated": false,
13831379
"deprecationReason": null
@@ -1544,20 +1540,6 @@
15441540
"description": null,
15451541
"fields": null,
15461542
"inputFields": [
1547-
{
1548-
"name": "meterName",
1549-
"description": null,
1550-
"type": {
1551-
"kind": "NON_NULL",
1552-
"name": null,
1553-
"ofType": {
1554-
"kind": "SCALAR",
1555-
"name": "String",
1556-
"ofType": null
1557-
}
1558-
},
1559-
"defaultValue": null
1560-
},
15611543
{
15621544
"name": "meterType",
15631545
"description": null,
@@ -1586,6 +1568,16 @@
15861568
},
15871569
"defaultValue": null
15881570
},
1571+
{
1572+
"name": "meterDescription",
1573+
"description": null,
1574+
"type": {
1575+
"kind": "SCALAR",
1576+
"name": "String",
1577+
"ofType": null
1578+
},
1579+
"defaultValue": null
1580+
},
15891581
{
15901582
"name": "location",
15911583
"description": null,
@@ -2138,15 +2130,19 @@
21382130
"name": "viewMetrics",
21392131
"description": null,
21402132
"type": {
2141-
"kind": "LIST",
2133+
"kind": "NON_NULL",
21422134
"name": null,
21432135
"ofType": {
2144-
"kind": "NON_NULL",
2136+
"kind": "LIST",
21452137
"name": null,
21462138
"ofType": {
2147-
"kind": "SCALAR",
2148-
"name": "String",
2149-
"ofType": null
2139+
"kind": "NON_NULL",
2140+
"name": null,
2141+
"ofType": {
2142+
"kind": "SCALAR",
2143+
"name": "String",
2144+
"ofType": null
2145+
}
21502146
}
21512147
}
21522148
},
@@ -2156,13 +2152,9 @@
21562152
"name": "refreshRateLimit",
21572153
"description": null,
21582154
"type": {
2159-
"kind": "NON_NULL",
2160-
"name": null,
2161-
"ofType": {
2162-
"kind": "SCALAR",
2163-
"name": "Int",
2164-
"ofType": null
2165-
}
2155+
"kind": "SCALAR",
2156+
"name": "Int",
2157+
"ofType": null
21662158
},
21672159
"defaultValue": null
21682160
}
@@ -2277,6 +2269,20 @@
22772269
}
22782270
},
22792271
"defaultValue": null
2272+
},
2273+
{
2274+
"name": "liveViewConfig",
2275+
"description": "artifactQualifiedName: ArtifactQualifiedNameInput!",
2276+
"type": {
2277+
"kind": "NON_NULL",
2278+
"name": null,
2279+
"ofType": {
2280+
"kind": "INPUT_OBJECT",
2281+
"name": "LiveViewConfigInput",
2282+
"ofType": null
2283+
}
2284+
},
2285+
"defaultValue": null
22802286
}
22812287
],
22822288
"interfaces": null,

src/test/kotlin/spp/protocol/marshall/ProtocolMarshallerTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class ProtocolMarshallerTest {
4242
@Test
4343
fun testLiveInstrument() {
4444
val liveInstrument = LiveMeter(
45-
"meterName",
4645
MeterType.COUNT,
4746
MetricValue(MetricValueType.NUMBER, "1"),
47+
"meterDescription",
4848
LiveSourceLocation("source", 1),
4949
"condition",
5050
System.currentTimeMillis(),

0 commit comments

Comments
 (0)