Dropwizard-在部署时,由于yml文件格式错误,应用程序无法运行

问题描述 投票:1回答:1

我们正在尝试使用Dropwizard指标将自动化指标添加到我们的Java应用程序中。到目前为止,config.yml文件看起来像这样:

metrics:
  reporters:
  - type: log
    logger: metrics
    frequency: 5 minute
    includes: "io.dropwizard.jetty.MutableServletContextHandler.active-requests","io.dropwizard.jetty.MutableServletContextHandler.active-dispatches","io.dropwizard.jetty.MutableServletContextHandler.active-suspended"

运行此项目时,出现错误,指出yaml文件格式错误:

io.dropwizard.configuration.ConfigurationParsingException: test/config.yml has an error:
  * Malformed YAML at line: 24, column: 82; while parsing a block mapping
 in 'reader', line 20, column 5:
      - type: log
        ^
expected <block end>, but found FlowEntry
 in 'reader', line 23, column 81:
     ... tContextHandler.active-requests","io.dropwizard.jetty.MutableSer ...
                                         ^

yaml在这里的书写方式到底有什么问题?我的理解是,缩进,空格和引号内没有逗号是正确的,并且我们找不到其他问题。

java format dropwizard metrics
1个回答
0
投票

只需将第6行更改为

includes: [io.dropwizard.jetty.MutableServletContextHandler.active-requests,io.dropwizard.jetty.MutableServletContextHandler.active-dispatches,io.dropwizard.jetty.MutableServletContextHandler.active-suspended]

© www.soinside.com 2019 - 2024. All rights reserved.