我正在一个现有的Spring引导应用程序中设置Spring执行器。除了JVM度量(CPU、内存、GC、..)/metrics
endpoint返回的。
我用的是Spring Boot2.1.4。我显式配置了GlobalMethodSecurity
并导出了SecurityAutoConfiguration
。
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration {
private final IAuthService authService;
@Autowired
public MethodSecurityConfig(IAuthService authService) {
this.authService = authService;
}
@Override
protected MethodSecurityExpressionHandler createExpressionHandler() {
return new CustomMethodSecurityExpressionHandler(authService);
}
}
management:
security:
enabled: false
server:
address: 0.0.0.0
port: 8080
endpoints:
web:
exposure.include: metrics,prometheus
exposure.exclude:
metrics:
enable.jvm: true
在此配置下,可用的度量标准为:
{
"names": [
"jdbc.connections.active",
"jdbc.connections.max",
"jdbc.connections.min",
"tomcat.global.sent",
"tomcat.sessions.created",
"tomcat.global.request.max",
"hikaricp.connections.idle",
"hikaricp.connections.pending",
"tomcat.global.request",
"tomcat.sessions.expired",
"hikaricp.connections",
"tomcat.global.received",
"hikaricp.connections.active",
"hikaricp.connections.creation",
"tomcat.sessions.rejected",
"tomcat.threads.config.max",
"hikaricp.connections.max",
"hikaricp.connections.min",
"tomcat.global.error",
"tomcat.sessions.active.current",
"tomcat.sessions.alive.max",
"hikaricp.connections.usage",
"tomcat.threads.current",
"hikaricp.connections.timeout",
"tomcat.sessions.active.max",
"hikaricp.connections.acquire",
"tomcat.threads.busy"
]
}
如果临时删除@EnableGlobalMethodSecurity
,可用的度量将变为:
{
"names": [
"jvm.threads.states",
"jdbc.connections.active",
"process.files.max",
"jvm.memory.used",
"jvm.gc.memory.promoted",
"jvm.memory.max",
"system.load.average.1m",
"jvm.gc.max.data.size",
"jdbc.connections.max",
"jdbc.connections.min",
"jvm.memory.committed",
"system.cpu.count",
"tomcat.global.sent",
"jvm.buffer.memory.used",
"tomcat.sessions.created",
"jvm.threads.daemon",
"system.cpu.usage",
"jvm.gc.memory.allocated",
"tomcat.global.request.max",
"hikaricp.connections.idle",
"hikaricp.connections.pending",
"tomcat.global.request",
"tomcat.sessions.expired",
"hikaricp.connections",
"jvm.threads.live",
"jvm.threads.peak",
"tomcat.global.received",
"hikaricp.connections.active",
"hikaricp.connections.creation",
"process.uptime",
"tomcat.sessions.rejected",
"process.cpu.usage",
"tomcat.threads.config.max",
"jvm.classes.loaded",
"hikaricp.connections.max",
"hikaricp.connections.min",
"jvm.classes.unloaded",
"tomcat.global.error",
"tomcat.sessions.active.current",
"tomcat.sessions.alive.max",
"jvm.gc.live.data.size",
"log4j2.events",
"hikaricp.connections.usage",
"tomcat.threads.current",
"jvm.gc.pause",
"hikaricp.connections.timeout",
"process.files.open",
"jvm.buffer.count",
"jvm.buffer.total.capacity",
"tomcat.sessions.active.max",
"hikaricp.connections.acquire",
"tomcat.threads.busy",
"process.start.time"
]
}
我希望方法的安全性不会影响JVM度量的发布。我应该如何配置执行器/安全性以获得所有度量?
我通过添加以下配置使其正常工作:
@Configuration
public class ActuatorMetricsConfig {
@Bean
InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor, PrometheusMeterRegistry registry) {
return () -> meterRegistryPostProcessor.postProcessAfterInitialization(registry, "");
}
}
我是micrometer和prometheus的新手,我正在尝试构建我的第一个应用程序,使用micrometer和prometheus作为监控后端进行监控。但我看不到prometheusendpoint上显示的应用程序(和)的度量。 我正在学习普罗米修斯的教程。我也跟着这个视频开始千分尺。 我从这个链接下载了prometheus,提取了它,然后使用命令:运行prometheus来报废。我正在此配置
我面临一些关于woocommerce可变产品的问题。每种产品我都有许多不同的变体(每种产品大约4-5个)。尽管我已经在变体设置中设置了它们,但在前端,当用户选择它时,它仍然会显示此消息:“对不起,没有与您选择的产品匹配的产品。请选择其他组合。” 是否是由于大量的组合导致变化相互冲突?或者是由于库存/重量限制设置,有人在他们的项目中经历过这种情况吗?
我直接从书上抄了这些例子。代码应该在JFrame上绘制一些东西,但没有显示任何东西(除了JFrame),这里是带有main方法的类 下面是JPanel的一个子类
我试图在应用程序启动时显示项目的listview。但在应用程序启动时,没有显示listview,只有一个空白屏幕。下面是代码: MainActivity.java 但是现在我在logcat中得到了以下内容: 并且应用程序停止..请帮助!
我把拐角半径设为10。但图像视图不显示角半径。 我也尝试过使用,但也不起作用。 当我在图像视图上使用背景色时,如下所示,它完美地显示了带有圆角的视图。 我还尝试更改图像的图像、宽度和高度,以检查图像对于视图是否太大。但它也不起作用。 我就是这样调用ImageView的。