-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: metrics (prometheus + micrometer)
- Loading branch information
Showing
12 changed files
with
172 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 0 additions & 132 deletions
132
src/main/java/com/softawii/capivara/core/EmbedManager.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/softawii/capivara/metrics/SocialMetrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.softawii.capivara.metrics; | ||
|
||
import io.micrometer.core.instrument.MeterRegistry; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
@Component | ||
public class SocialMetrics { | ||
|
||
// General Count | ||
private final AtomicLong parseCount; | ||
|
||
public SocialMetrics(MeterRegistry registry) { | ||
// Injected | ||
this.parseCount = registry.gauge("social.twitter.parse", new AtomicLong(0L)); | ||
} | ||
|
||
public void newTwitterParse() { | ||
this.parseCount.addAndGet(1L); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/main/java/com/softawii/capivara/metrics/VoiceMetrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.softawii.capivara.metrics; | ||
|
||
import io.micrometer.core.instrument.MeterRegistry; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
@Component | ||
public class VoiceMetrics { | ||
|
||
private final MeterRegistry registry; | ||
|
||
// Agent | ||
private final AtomicLong agentCount; | ||
private final AtomicLong agentAdd; | ||
private final AtomicLong agentRemove; | ||
private final AtomicLong agentUpdate; | ||
|
||
// Master | ||
private final AtomicLong masterCount; | ||
private final AtomicLong masterAdd; | ||
private final AtomicLong masterRemove; | ||
private final AtomicLong masterUpdate; | ||
|
||
public VoiceMetrics(MeterRegistry registry) { | ||
this.registry = registry; | ||
this.agentCount = this.registry.gauge("voice.agents.active", new AtomicLong(0L)); | ||
this.agentAdd = this.registry.gauge("voice.agents.add", new AtomicLong(0L)); | ||
this.agentRemove = this.registry.gauge("voice.agents.remove", new AtomicLong(0L)); | ||
this.agentUpdate = this.registry.gauge("voice.agents.update", new AtomicLong(0L)); | ||
|
||
this.masterCount = this.registry.gauge("voice.master.active", new AtomicLong(0L)); | ||
this.masterAdd = this.registry.gauge("voice.master.add", new AtomicLong(0L)); | ||
this.masterRemove = this.registry.gauge("voice.master.remove", new AtomicLong(0L)); | ||
this.masterUpdate = this.registry.gauge("voice.master.update", new AtomicLong(0L)); | ||
} | ||
|
||
public void agentCount(Long count) { | ||
this.agentCount.set(count); | ||
} | ||
|
||
public void agentCreated() { | ||
this.agentAdd.addAndGet(1L); | ||
} | ||
|
||
public void agentDestroyed() { | ||
this.agentRemove.addAndGet(1L); | ||
} | ||
|
||
public void agentUpdate() { | ||
this.agentUpdate.addAndGet(1L); | ||
} | ||
|
||
public void masterCount(Long count) { | ||
this.masterCount.set(count); | ||
} | ||
|
||
public void masterCreated() { | ||
this.masterAdd.addAndGet(1L); | ||
} | ||
|
||
public void masterDestroyed() { | ||
this.masterRemove.addAndGet(1L); | ||
} | ||
|
||
public void masterUpdate() { | ||
this.masterUpdate.addAndGet(1L); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.