add actuator prometheus

This commit is contained in:
many2many 2024-06-03 13:23:47 +08:00
parent 39c27caf76
commit b97c8869af
2 changed files with 15 additions and 1 deletions

View File

@ -44,6 +44,11 @@ dependencies {
implementation "org.mapstruct:mapstruct:1.5.5.Final" implementation "org.mapstruct:mapstruct:1.5.5.Final"
annotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final" annotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final"
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
// If you are using mapstruct in test code // If you are using mapstruct in test code
testAnnotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final" testAnnotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final"

View File

@ -25,7 +25,7 @@ spring:
defer-datasource-initialization: true defer-datasource-initialization: true
database-platform: org.hibernate.dialect.H2Dialect database-platform: org.hibernate.dialect.H2Dialect
hibernate: hibernate:
ddl-auto: create-drop ddl-auto: update
# 可选值create-drop,create,update,none. create-drop每次启动项目都会删除表然后重新创建表适合开发环境create每次启动项目都会创建表适合开发环境update每次启动项目都会更新表适合开发环境none不执行任何操作适合生产环境。 # 可选值create-drop,create,update,none. create-drop每次启动项目都会删除表然后重新创建表适合开发环境create每次启动项目都会创建表适合开发环境update每次启动项目都会更新表适合开发环境none不执行任何操作适合生产环境。
properties: properties:
hibernate: hibernate:
@ -34,6 +34,13 @@ spring:
resources: resources:
static-locations: classpath:/static/,file:/home/whz/tmp/ # 指定静态资源的位置 static-locations: classpath:/static/,file:/home/whz/tmp/ # 指定静态资源的位置
management:
endpoints:
web:
exposure:
include: "*"
# exclude: "health,metrics,prometheus,info,logfile,loggers,env,env-to-props,env-reactive,configprops,configprops-reactive,threaddump,heapdump,beans,scheduledtasks,mappings,httptrace,sessions,caches,cache,sessions-reactive,caches-reactive,cache-reactive,schedules,schedules-reactive,jolokia,jolokia-reactive,logfile-reactive,loggers-reactive,refresh,flyway,liquibase,liquibase-re
app: app:
version: v1 version: v1
default: default:
@ -55,6 +62,8 @@ app:
methods: [ "GET","PUT","POST"] methods: [ "GET","PUT","POST"]
- path: "/upload/**" - path: "/upload/**"
methods: [ "GET" ] methods: [ "GET" ]
- path: "/actuator/**"
methods: [ "GET" ]
allowed-origins: # 允许跨域的域名 allowed-origins: # 允许跨域的域名
- "http://localhost:5173" - "http://localhost:5173"
upload: upload: