小编And*_*dre的帖子

启用 GlobalMethodSecurity 时,Spring Actuator JVM 指标不显示

我正在现有的 Spring Boot 应用程序中设置 Spring Actuator。一切正常,除了/metrics端点返回的指标中缺少 JVM 指标(CPU、内存、GC 等)。

我正在使用 Spring Boot 2.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);
    }
}
Run Code Online (Sandbox Code Playgroud)

虽然这些是我正在使用的指标属性:

management:
  security:
    enabled: false
  server:
    address: 0.0.0.0
    port: 8080
  endpoints:
    web:
      exposure.include: metrics,prometheus
      exposure.exclude:
  metrics:
    enable.jvm: true
Run Code Online (Sandbox Code Playgroud)

使用此配置,可用指标为:

{
  "names": [
    "jdbc.connections.active",
    "jdbc.connections.max",
    "jdbc.connections.min",
    "tomcat.global.sent",
    "tomcat.sessions.created", …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security spring-boot spring-boot-actuator

2
推荐指数
1
解决办法
2772
查看次数

如何从C读取火炬张量

我必须使用Torch框架训练卷积神经网络,然后在C中编写相同的网络.为此,我必须以某种方式从我的C程序中读取网络的学习参数,但我找不到办法将Torch Tensors转换或写入文件以使其在C中可读.理想情况下,我想将Tensors转换为C中的double数组.

有谁知道这是怎么做到的吗?提前致谢 :)

c lua luajit neural-network torch

1
推荐指数
1
解决办法
2185
查看次数