[英]Reading metrics configuration from YAML file within a dropwizard REST application
我的Metrics配置在我的dropwizard rest應用程序(hello-world.yml)中是這樣的
metrics:
reporters:
- type: log
logger: metrics
markerName: <marker name>
這是一位SLF4J記者,我將其放在YAML配置文件中。 現在,當我想獲取此值並在我的應用程序文件中使用它時。 我看到的唯一選擇是將其讀取為Map<String, List<Map<String, String>> metrics;
讀取此配置並在dropwizard Application類中使用它的正確方法是什么。 請幫幫我。
此問題與用於石墨服務器配置的Dropwizard Yaml相同。 但是對於這個問題再次沒有答案,因此通過創建一個新問題來嘗試我的運氣。
我在dropwizard用戶中發布了這個問題,並得到了答案。 https://groups.google.com/forum/#!topic/dropwizard-user/yxceCS1CEns
final ImmutableList<ReporterFactory> reporters = configuration.getMetricsFactory().getReporters();
final Slf4jReporterFactory slf4jReporterFactory = (Slf4jReporterFactory) reporters.get(0);
slf4jReporterFactory.getMarkerName();
slf4jReporterFactory.getLoggerName();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.