Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
ace0e6cb
Commit
ace0e6cb
authored
Dec 11, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加prometheus指标测算
parent
dfa4df3b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
base-manager/src/main/java/com/mortals/xhx/ManagerBaseApplication.java
...src/main/java/com/mortals/xhx/ManagerBaseApplication.java
+1
-0
base-manager/src/main/java/com/mortals/xhx/metrics/Counter.java
...anager/src/main/java/com/mortals/xhx/metrics/Counter.java
+29
-0
No files found.
base-manager/src/main/java/com/mortals/xhx/ManagerBaseApplication.java
View file @
ace0e6cb
...
@@ -34,6 +34,7 @@ public class ManagerBaseApplication extends BaseWebApplication {
...
@@ -34,6 +34,7 @@ public class ManagerBaseApplication extends BaseWebApplication {
@PostConstruct
@PostConstruct
public
void
init
()
{
public
void
init
()
{
DefaultExports
.
initialize
();
DefaultExports
.
initialize
();
}
}
...
...
base-manager/src/main/java/com/mortals/xhx/metrics/Counter.java
0 → 100644
View file @
ace0e6cb
package
com.mortals.xhx.metrics
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
@Component
public
class
Counter
{
//注册数据
static
final
io
.
prometheus
.
client
.
Counter
REQUESTS
=
io
.
prometheus
.
client
.
Counter
.
build
().
name
(
"requests_total"
)
.
help
(
"Total requests."
).
labelNames
(
"label"
).
register
();
//初始化数据方法一
{
REQUESTS
.
labels
(
"trace"
).
inc
(
0
D
);
}
//初始化数据方法二
@PostConstruct
public
void
processRequest
()
{
REQUESTS
.
labels
(
"error"
).
inc
();
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment