Skip to content

Commit

Permalink
feat: comprehensive opentelemtry metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
luan committed Dec 3, 2023
1 parent cda6813 commit 8f5725e
Show file tree
Hide file tree
Showing 70 changed files with 2,025 additions and 46 deletions.
2 changes: 2 additions & 0 deletions cmake/modules/BaseConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ find_package(asio CONFIG REQUIRED)
find_package(eventpp CONFIG REQUIRED)
find_package(jsoncpp CONFIG REQUIRED)
find_package(magic_enum CONFIG REQUIRED)
find_package(opentelemetry-cpp CONFIG REQUIRED)
find_package(prometheus-cpp CONFIG REQUIRED)
find_package(mio REQUIRED)
find_package(pugixml CONFIG REQUIRED)
find_package(spdlog REQUIRED)
Expand Down
8 changes: 8 additions & 0 deletions cmake/modules/CanaryLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ target_link_libraries(${PROJECT_NAME}_lib
unofficial::argon2::libargon2
unofficial::libmariadb
unofficial::mariadbclient
opentelemetry-cpp::common
opentelemetry-cpp::metrics
opentelemetry-cpp::api
opentelemetry-cpp::ext
opentelemetry-cpp::sdk
opentelemetry-cpp::logs
opentelemetry-cpp::ostream_metrics_exporter
opentelemetry-cpp::prometheus_exporter
)

if(CMAKE_BUILD_TYPE MATCHES Debug)
Expand Down
9 changes: 9 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -486,3 +486,12 @@ vipKeepHouse = false
-- NOTE set rewardChestMaxCollectItems max items per collect action
rewardChestCollectEnabled = true
rewardChestMaxCollectItems = 200

-- Metrics
--- Prometheus
metricsEnablePrometheus = false
metricsPrometheusAddress = "0.0.0.0:9464"

--- OStream
metricsEnableOstream = false
metricsOstreamInterval = 1000
50 changes: 50 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/catacombs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
-- <zone name="spawn.catacombs.demons" zoneid="13" />
-- <zone name="spawn.catacombs.golems" zoneid="11" />
-- <zone name="spawn.catacombs.minos" zoneid="12" />

local minos = SpawnZone("spawn.catacombs.minos")

minos:setMonstersPerCluster(2, 3)
minos:setClusterRadius(4, 7)
minos:setClusterSpacing(12, 14)
minos:setOutlierChance(0.5)
minos:setPeriod("180s")

minos:addMonster("Minotaur Amazon", 10)
minos:addMonster("Execowtioner", 30)
minos:addMonster("Moohtant", 30)

minos:register()

local golems = SpawnZone("spawn.catacombs.golems")

golems:setMonstersPerCluster(2, 3)
golems:setClusterRadius(4, 7)
golems:setClusterSpacing(12, 14)
golems:setOutlierChance(0.5)
golems:setPeriod("180s")

golems:addMonster("Glooth Golem", 15)
golems:addMonster("Rustheap Golem", 25)
golems:addMonster("Worker Golem", 35)
golems:addMonster("War Golem", 20)

golems:register()

local demons = SpawnZone("spawn.catacombs.demons")

demons:setMonstersPerCluster(2, 3)
demons:setClusterRadius(4, 7)
demons:setClusterSpacing(12, 14)
demons:setOutlierChance(0.5)
demons:setPeriod("180s")

demons:addMonster("Destroyer", 21)
demons:addMonster("Hellspawn", 22)
demons:addMonster("Grim Reaper", 18)
demons:addMonster("Dark Torturer", 28)
demons:addMonster("Demon", 12)
demons:addMonster("Hellhound", 2)
demons:addMonster("Juggernaut", 2)

demons:register()
27 changes: 27 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/coryms.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local coryms1 = SpawnZone("spawn.venore.coryms-1")

coryms1:setMonstersPerCluster(3, 4)
coryms1:setClusterRadius(2, 4)
coryms1:setClusterSpacing(8, 10)
coryms1:setOutlierChance(0.5)
coryms1:setPeriod("180s")

coryms1:addMonster("Corym Charlatan", 45)
coryms1:addMonster("Corym Skirmisher", 30)
coryms1:addMonster("Corym Vanguard", 10)

coryms1:register()

local coryms2 = SpawnZone("spawn.venore.coryms-2")

coryms2:setMonstersPerCluster(3, 4)
coryms2:setClusterRadius(2, 4)
coryms2:setClusterSpacing(7, 10)
coryms2:setOutlierChance(1.5)
coryms2:setPeriod("180s")

coryms2:addMonster("Corym Charlatan", 30)
coryms2:addMonster("Corym Skirmisher", 32)
coryms2:addMonster("Corym Vanguard", 20)

coryms2:register()
12 changes: 12 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/falcon.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local falcon = SpawnZone("spawn.falcon")

falcon:setMonstersPerCluster(3, 4)
falcon:setClusterRadius(2, 4)
falcon:setClusterSpacing(10, 12)
falcon:setOutlierChance(0.5)
falcon:setPeriod("180s")

falcon:addMonster("Falcon Knight", 2)
falcon:addMonster("Falcon Paladin", 2)

falcon:register()
33 changes: 33 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/ingol.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local surface = SpawnZone("spawn.ingol.surface")

surface:setMonstersPerCluster(2, 3)
surface:setClusterRadius(2, 4)
surface:setClusterSpacing(12, 14)
surface:setOutlierChance(0.5)
surface:setPeriod("180s")

surface:addMonster("Carnivostrich", 4)
surface:addMonster("Harpy", 13)
surface:addMonster("Liodile", 4)
surface:addMonster("Rhindeer", 11)
surface:addMonster("Crape Man", 12)
surface:addMonster("Boar Man", 9)

surface:register()

local deep = SpawnZone("spawn.ingol.deep")

deep:setMonstersPerCluster(3, 4)
deep:setClusterRadius(2, 4)
deep:setClusterSpacing(10, 12)
deep:setOutlierChance(0.5)
deep:setPeriod("180s")

deep:addMonster("Carnivostrich", 9)
deep:addMonster("Harpy", 9)
deep:addMonster("Liodile", 11)
deep:addMonster("Rhindeer", 8)
deep:addMonster("Crape Man", 7)
deep:addMonster("Boar Man", 12)

deep:register()
34 changes: 34 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/issavi.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
local goannas = SpawnZone("spawn.issavi-south")

goannas:setMonstersPerCluster(3, 4)
goannas:setClusterRadius(2, 4)
goannas:setClusterSpacing(9, 12)
goannas:setOutlierChance(0.7)
goannas:setPeriod("180s")

goannas:addMonster("Adult Goanna", 28)
goannas:addMonster("Young Goanna", 30)
goannas:addMonster("Feral Sphinx", 26)
goannas:addMonster("Manticore", 11)
goannas:addMonster("Scorpion", 2)
goannas:addMonster("Hyaena", 1)
goannas:addMonster("Cobra", 2)

goannas:register()

local sphinx = SpawnZone("spawn.issavi-sphinx")

sphinx:setMonstersPerCluster(3, 4)
sphinx:setClusterRadius(2, 4)
sphinx:setClusterSpacing(9, 12)
sphinx:setOutlierChance(0.7)
sphinx:setPeriod("180s")

sphinx:addMonster("Sphinx", 28)
sphinx:addMonster("Lamassu", 30)
sphinx:addMonster("Feral Sphinx", 2)
sphinx:addMonster("Manticore", 0.5)
sphinx:addMonster("Young Goanna", 0.5)
sphinx:addMonster("Cobra", 2)

sphinx:register()
40 changes: 40 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/jakundaf-souls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
local soulsMinus1 = SpawnZone("spawn.jakundaf.souls-1")

soulsMinus1:setMonstersPerCluster(3, 4)
soulsMinus1:setClusterRadius(2, 4)
soulsMinus1:setClusterSpacing(9, 11)
soulsMinus1:setOutlierChance(0.5)
soulsMinus1:setPeriod("180s")

soulsMinus1:addMonster("Flimsy Lost Soul", 87)
soulsMinus1:addMonster("Grim Reaper", 13)

soulsMinus1:register()

local soundsMinus2 = SpawnZone("spawn.jakundaf.souls-2")

soundsMinus2:setMonstersPerCluster(3, 4)
soundsMinus2:setClusterRadius(2, 4)
soundsMinus2:setClusterSpacing(10, 13)
soundsMinus2:setOutlierChance(0.5)
soundsMinus2:setPeriod("180s")

soundsMinus2:addMonster("Flimsy Lost Soul", 50)
soundsMinus2:addMonster("Mean Lost Soul", 37)
soundsMinus2:addMonster("Grim Reaper", 13)

soundsMinus2:register()

local soulsMinus3 = SpawnZone("spawn.jakundaf.souls-3")

soulsMinus3:setMonstersPerCluster(3, 5)
soulsMinus3:setClusterRadius(2, 4)
soulsMinus3:setClusterSpacing(10, 13)
soulsMinus3:setOutlierChance(0.5)
soulsMinus3:setPeriod("180s")

soulsMinus3:addMonster("Flimsy Lost Soul", 40)
soulsMinus3:addMonster("Mean Lost Soul", 37)
soulsMinus3:addMonster("Freakish Lost Soul", 23)

soulsMinus3:register()
47 changes: 47 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/laguna.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
local surface = SpawnZone("spawn.laguna.surface")

surface:setMonstersPerCluster(2, 4)
surface:setClusterRadius(2, 4)
surface:setClusterSpacing(8, 10)
surface:setOutlierChance(0.5)
surface:setPeriod("180s")

surface:addMonster("Tortoise", 28)
surface:addMonster("Toad", 20)
surface:addMonster("Crab", 12)
surface:addMonster("Crimson Frog", 12)
surface:addMonster("Azure Frog", 11)
surface:addMonster("Coral Frog", 11)
surface:addMonster("Green Frog", 1)
surface:addMonster("Seagull", 1)

surface:register()

local turtles = SpawnZone("spawn.laguna.turtles")

turtles:setMonstersPerCluster(3, 4)
turtles:setClusterRadius(3, 4)
turtles:setClusterSpacing(9, 11)
turtles:setOutlierChance(0.5)
turtles:setPeriod("180s")

turtles:addMonster("Mutant Turtle", 25)
turtles:addMonster("Ninja Turtle", 15)
turtles:addMonster("Shelled Spiker", 25)
turtles:addMonster("Shelled Crusher", 15)

turtles:register()

local crabs = SpawnZone("spawn.laguna.crabs")

crabs:setMonstersPerCluster(3, 4)
crabs:setClusterRadius(3, 4)
crabs:setClusterSpacing(9, 11)
crabs:setOutlierChance(0.5)
crabs:setPeriod("180s")

crabs:addMonster("Crimson Crab", 35)
crabs:addMonster("Laguna Lobster", 15)
crabs:addMonster("Slime Hopper", 20)

crabs:register()
27 changes: 27 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/naga.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local minus1 = SpawnZone("spawn.naga-1")

minus1:setMonstersPerCluster(2, 3)
minus1:setClusterRadius(2, 3)
minus1:setClusterSpacing(10, 12)
minus1:setOutlierChance(0.5)
minus1:setPeriod("180s")

minus1:addMonster("Naga Warrior", 2)
minus1:addMonster("Naga Archer", 2)
minus1:addMonster("Makara", 1)

minus1:register()

local minus2 = SpawnZone("spawn.naga-2")

minus2:setMonstersPerCluster(3, 4)
minus2:setClusterRadius(2, 3)
minus2:setClusterSpacing(9, 11)
minus2:setOutlierChance(0.5)
minus2:setPeriod("180s")

minus2:addMonster("Naga Warrior", 2)
minus2:addMonster("Naga Archer", 2)
minus2:addMonster("Makara", 1)

minus2:register()
29 changes: 29 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/nargor.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
local pirates = SpawnZone("spawn.nargor.pirates")

pirates:setMonstersPerCluster(3, 4)
pirates:setClusterRadius(4, 6)
pirates:setClusterSpacing(7, 9)
pirates:setOutlierChance(0.5)
pirates:setPeriod("180s")

pirates:addMonster("Bootleg Marauder", 28)
pirates:addMonster("Bootleg Buccaneer", 10)
pirates:addMonster("Bootleg Cutthroat", 26)
pirates:addMonster("Bootleg Corsair", 11)
pirates:addMonster("Bootleg Smuggler", 7)

pirates:register()

local undead = SpawnZone("spawn.nargor.undeads")

undead:setMonstersPerCluster(3, 4)
undead:setClusterRadius(4, 6)
undead:setClusterSpacing(7, 9)
undead:setOutlierChance(0.5)
undead:setPeriod("180s")

undead:addMonster("Bootleg Ghost", 13)
undead:addMonster("Bootleg Skeleton", 11)
undead:addMonster("Fetid Ghoul", 9)

undead:register()
12 changes: 12 additions & 0 deletions data-otservbr-global/scripts/spawn_zones/nightmares.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local nightmares = SpawnZone("spawn.yalahar.nightmare-dungeon")

nightmares:setMonstersPerCluster(2, 4)
nightmares:setClusterRadius(3, 4)
nightmares:setClusterSpacing(9, 11)
nightmares:setOutlierChance(0.6)
nightmares:setPeriod("180s")

nightmares:addMonster("Nightmare", 50)
nightmares:addMonster("Nightmare Scion", 10)

nightmares:register()
Loading

0 comments on commit 8f5725e

Please sign in to comment.