Skip to content

Commit c1bb36e

Browse files
authored
Tagging (#79)
1 parent efa16ff commit c1bb36e

9 files changed

Lines changed: 59 additions & 48 deletions

File tree

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ From the folder where you decompressed the server, in out case `~/simplexspatial
273273
Node 1:
274274
```ssh
275275
bin/simplexspatial-core \
276-
-J-Xms1G \
277-
-J-Xmx4G \
276+
-J-Xms5G \
277+
-J-Xmx14G \
278278
-Dconfig.file=conf/application.conf \
279279
-Dakka.remote.artery.canonical.port=2550 \
280280
-Dsimplexportal.spatial.entrypoint.grpc-web.port=6080 \
@@ -298,16 +298,24 @@ bin/simplexspatial-core \
298298
Node 2:
299299
```ssh
300300
bin/simplexspatial-core \
301-
-J-Xms1G \
302-
-J-Xmx4G \
301+
-J-Xms5G \
302+
-J-Xmx14G \
303303
-Dconfig.file=conf/application.conf\
304304
-Dakka.remote.artery.canonical.port=2551 \
305305
-Dsimplexportal.spatial.entrypoint.grpc-web.port=6081 \
306306
-Dsimplexportal.spatial.entrypoint.grpc.port=7081 \
307307
-Dsimplexportal.spatial.entrypoint.restful.port=8081 \
308308
-Dcinnamon.prometheus.http-server.port=9002
309309
```
310-
310+
bin/simplexspatial-core \
311+
-J-Xms5G \
312+
-J-Xmx14G \
313+
-Dconfig.file=conf/application.conf\
314+
-Dakka.remote.artery.canonical.port=2551 \
315+
-Dsimplexportal.spatial.entrypoint.grpc-web.port=6081 \
316+
-Dsimplexportal.spatial.entrypoint.grpc.port=7081 \
317+
-Dsimplexportal.spatial.entrypoint.restful.port=8081 \
318+
-Dcinnamon.prometheus.http-server.port=9002
311319
For other nodes, we can set the port as 0, so Akka will use a random free port:
312320
```ssh
313321
bin/simplexspatial-core \

core/src/main/scala/com/simplexportal/spatial/index/grid/sessions/AddWaySession.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package com.simplexportal.spatial.index.grid.sessions
1919

2020
import akka.NotUsed
21-
import akka.actor.typed.Behavior
21+
import akka.actor.typed.{ActorTags, Behavior}
2222
import akka.actor.typed.scaladsl.Behaviors
2323
import akka.cluster.sharding.typed.scaladsl.ClusterSharding
2424
import com.simplexportal.spatial.index.grid.Grid
@@ -47,7 +47,8 @@ object AddWaySession {
4747
GetInternalNodesSession(
4848
GetInternalNodes(addWay.nodeIds, context.self)
4949
),
50-
s"getting_node_${UUID.randomString}"
50+
s"getting_node_${UUID.randomString}",
51+
ActorTags("session", "session-add-way")
5152
)
5253

5354
Behaviors.receiveMessage {

core/src/main/scala/com/simplexportal/spatial/index/grid/sessions/GetNodeSession.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package com.simplexportal.spatial.index.grid.sessions
1919

2020
import akka.actor.typed.scaladsl.{ActorContext, Behaviors}
21-
import akka.actor.typed.{ActorRef, Behavior}
21+
import akka.actor.typed.{ActorRef, ActorTags, Behavior}
2222
import akka.cluster.sharding.typed.scaladsl.ClusterSharding
2323
import com.simplexportal.spatial.index.CommonInternalSerializer
2424
import com.simplexportal.spatial.index.grid.Grid.{NodeLookUpTypeKey, TileTypeKey}
@@ -57,7 +57,8 @@ object GetNodeSession {
5757
): Unit =
5858
context.spawn(
5959
apply(cmd),
60-
s"getting_node_${UUID.randomString}"
60+
s"getting_node_${UUID.randomString}",
61+
ActorTags("session", "session-get-node")
6162
)
6263

6364
def apply(getNode: GridGetNode)(

core/src/main/scala/com/simplexportal/spatial/index/grid/sessions/GetWaySession.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package com.simplexportal.spatial.index.grid.sessions
1919

2020
import akka.actor.typed.scaladsl.{ActorContext, Behaviors}
21-
import akka.actor.typed.{ActorRef, Behavior}
21+
import akka.actor.typed.{ActorRef, ActorTags, Behavior}
2222
import akka.cluster.sharding.typed.scaladsl.ClusterSharding
2323
import com.simplexportal.spatial.index.CommonInternalSerializer
2424
import com.simplexportal.spatial.index.grid.Grid.{TileTypeKey, WayLookUpTypeKey}
@@ -41,7 +41,8 @@ object GetWaySession {
4141
): Unit =
4242
context.spawn(
4343
apply(cmd),
44-
s"getting_way_${UUID.randomString}"
44+
s"getting_way_${UUID.randomString}",
45+
ActorTags("session", "session-get-way")
4546
)
4647

4748
def apply(getWay: GridGetWay)(

core/src/main/scala/com/simplexportal/spatial/index/grid/sessions/addbatch/AddBatchSession.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.simplexportal.spatial.index.grid.sessions.addbatch
1919

20+
import akka.actor.typed.ActorTags
2021
import akka.actor.typed.scaladsl.ActorContext
2122
import akka.cluster.sharding.typed.scaladsl.ClusterSharding
2223
import com.simplexportal.spatial.index.grid.GridProtocol._
@@ -34,7 +35,8 @@ object AddBatchSession extends CollectNodeInfo {
3435
): Unit =
3536
context.spawn(
3637
collectNodeIdx(cmd),
37-
s"adding_batch_${UUID.randomString}"
38+
s"adding_batch_${UUID.randomString}",
39+
ActorTags("session", "session-add-batch")
3840
)
3941

4042
}

core/src/main/scala/com/simplexportal/spatial/index/grid/sessions/addbatch/CollectNodeInfo.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package com.simplexportal.spatial.index.grid.sessions.addbatch
1919

2020
import akka.actor.typed.scaladsl.Behaviors
21-
import akka.actor.typed.{ActorRef, Behavior}
21+
import akka.actor.typed.{ActorRef, ActorTags, Behavior}
2222
import akka.cluster.sharding.typed.scaladsl.ClusterSharding
2323
import com.simplexportal.spatial.index.grid.GridProtocol._
2424
import com.simplexportal.spatial.index.grid.sessions.GetNodeLocationsSession
@@ -53,7 +53,8 @@ protected trait CollectNodeInfo extends Adapter with UpdateIndices with DataDist
5353

5454
context.spawn(
5555
GetNodeLocationsSession(sharding, nodesNotPresentInThisBlock, locsResponseAdapter),
56-
s"node_locations_${UUID.randomString}"
56+
s"node_locations_${UUID.randomString}",
57+
ActorTags("session", "session-collect-node-info")
5758
)
5859

5960
Behaviors.receiveMessagePartial {

core/src/main/scala/com/simplexportal/spatial/index/lookup/node/NodeLookUpActor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object NodeLookUpActor {
3333
emptyState = Map.empty,
3434
commandHandler = (state, command) => onCommand(state, command),
3535
eventHandler = (state, event) => applyEvent(state, event)
36-
)
36+
).withTagger(_ => Set("node-lookup"))
3737
}
3838

3939
private def onCommand(

core/src/test/scala/com/simplexportal/spatial/index/grid/tile/actor/TileIdxSpec.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import org.scalatest.wordspec.AnyWordSpecLike
2424
// scalastyle:off magic.number
2525
class TileIdxSpec extends AnyWordSpecLike with Matchers {
2626
"TileIdx" should {
27+
"generate the right TileIdx" in {
28+
TileIdx(123, 456).entityId should be("123_456")
29+
}
2730
"calculate the BBox from the index" in {
2831
implicit val tileIdxGen = TileIndexEntityIdGen(10, 10)
2932
TileIdx(0,0).bbox() should be (BoundingBox(Location(-90 + (18*0),-180+(36*0)), Location(-90+(18*1),-180+(36*1))))

core/src/universal/conf/application-cinnamon.conf

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,39 @@ cinnamon {
1010

1111
akka {
1212
actors {
13-
// "/*" {
14-
// report-by = instance
15-
// }
16-
//
17-
// "/user/*" {
18-
// report-by = instance
19-
// }
2013

21-
"/user/*" {
22-
report-by = instance
23-
}
24-
25-
"NodeLookUpEntity-grp" {
26-
report-by = group
27-
includes = ["/system/sharding/NodeLookUpEntity", "/system/sharding/NodeLookUpEntity/*"]
28-
}
14+
// https://developer.lightbend.com/docs/telemetry/current/instrumentations/akka/actors-typed.html
2915

30-
"WayLookUpEntity-grp" {
31-
report-by = group
32-
includes = ["/system/sharding/WayLookUpEntity", "/system/sharding/WayLookUpEntity/*"]
16+
"/user/*" {
17+
report-by = tag
3318
}
3419

35-
"TileEntity-grp" {
36-
report-by = group
37-
includes = ["/system/sharding/TileEntity", "/system/sharding/TileEntity/*"]
20+
"com.simplexportal.spatial.index.lookup.node.NodeLookUpActor" {
21+
report-by = class
3822
}
3923

40-
"sharded-group" {
41-
report-by = instance
42-
includes = ["/system/sharding/*"]
43-
excludes = [
44-
"/system/sharding/NodeLookUpEntity",
45-
"/system/sharding/WayLookUpEntity",
46-
"/system/sharding/TileEntity",
47-
"/system/sharding/NodeLookUpEntity/*",
48-
"/system/sharding/WayLookUpEntity/*",
49-
"/system/sharding/TileEntity/*"
50-
]
51-
}
24+
// "WayLookUpEntity-grp" {
25+
// report-by = group
26+
// includes = ["/system/sharding/WayLookUpEntity", "/system/sharding/WayLookUpEntity/*"]
27+
// }
28+
//
29+
// "TileEntity-grp" {
30+
// report-by = group
31+
// includes = ["/system/sharding/TileEntity", "/system/sharding/TileEntity/*"]
32+
// }
33+
//
34+
// "sharded-group" {
35+
// report-by = instance
36+
// includes = ["/system/sharding/*"]
37+
// excludes = [
38+
// "/system/sharding/NodeLookUpEntity",
39+
// "/system/sharding/WayLookUpEntity",
40+
// "/system/sharding/TileEntity",
41+
// "/system/sharding/NodeLookUpEntity/*",
42+
// "/system/sharding/WayLookUpEntity/*",
43+
// "/system/sharding/TileEntity/*"
44+
// ]
45+
// }
5246
}
5347

5448
http.servers {

0 commit comments

Comments
 (0)