2015-11-19 29 views
1

我試圖配置我dropwizard石墨度量記者在我config.yml文件:DropWizard石墨度量記者在config.yml無法解析

metrics: 
    reporters: 
    - type: graphite 
     host: my.graphite.host.com 
     port: 2003 
     prefix: my.prefix 

我都dropwizard度量和度量,如石墨依賴關係在我的pom.xml中。我的應用程序類或配置類中沒有關於記者的內容。我的印象是DropWizard負責MetricRegistry和記者的所有初始化和啓動。然而,當我運行我的應用程序時,我收到以下錯誤:

config.yml has an error: 

    * Failed to parse configuration at: metrics.reporters; 
Could not resolve type id 'graphite' into a subtype of [simple type, 
class io.dropwizard.metrics.ReporterFactory]: 
known type ids = [ReporterFactory, console, csv, log] 
at [Source: N/A; line: -1, column: -1] 
(through reference chain: com.example.MyConfiguration["metrics"]- 
>io.dropwizard.metrics.MetricsFactory["reporters"]) 

爲什麼「石墨」不被接受爲可接受的類型?我錯過了什麼?

回答

4

我相信你有答案 - 但我有同樣的問題,所以想詳細說明。您需要三個在文檔中不清楚的庫。

<dependency> 
     <groupId>io.dropwizard.metrics</groupId> 
     <artifactId>metrics-core</artifactId> 
     <version>${metrics.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>io.dropwizard</groupId> 
     <artifactId>dropwizard-metrics-graphite</artifactId> 
     <version>${dw.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>io.dropwizard.metrics</groupId> 
     <artifactId>metrics-graphite</artifactId> 
     <version>${metrics.version}</version> 
    </dependency>