dropwizard-influxdb-reporter icon indicating copy to clipboard operation
dropwizard-influxdb-reporter copied to clipboard

config.yml parse failed |

Open tosheer opened this issue 7 years ago • 5 comments

I am trying to integrate a dropwizard service metrics with influxdb using your metrics reporter.But i getting the below exception while running the code present at

https://github.com/tosheer/analysis

`` IND00090:dropwizard-metrics-example tosheer.kalra$ java -jar target/metrics-example-1.0-SNAPSHOT.jar server config.yml

config.yml has an error:

  • Failed to parse configuration at: metrics.reporters; Argument #0 of constructor [constructor for com.kickstarter.dropwizard.metrics.influxdb.transformer.TaggedPattern, annotations: {interface com.fasterxml.jackson.annotation.JsonCreator=@com.fasterxml.jackson.annotation.JsonCreator(mode=DEFAULT)}] has no property name annotation; must have name when multiple-parameter constructor annotated as Creator at [Source: N/A; line: -1, column: -1] (through reference chain: com.example.application.ExampleConfiguration["metrics"]->io.dropwizard.metrics.MetricsFactory["reporters"]) ``

Can you please give me some pointer regarding what i am doing wrong.

tosheer avatar Dec 05 '17 19:12 tosheer

hey @tosheer! could you add this compiler arg to your pom.xml and rebuild/re-run?

<!-- force compilation with method parameter names -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  ...
  <configuration>
    ...
    <compilerArgs>
      <compilerArg>-parameters</compilerArg>
    </compilerArgs>
  </configuration>
</plugin>

Ideally this wouldn't be needed to use the library, but just looking to get a sense of the root issue that needs to be fixed. Thanks!

kyeah avatar Dec 05 '17 20:12 kyeah

@kyeah i rebuild/re-run after updating the POM. But i can still see the same message without any other details. Github repo https://github.com/tosheer/analysis is already updated for the same.

Also just to clarify i am getting above mentioned exception when i am running "java -jar target/metrics-example-1.0-SNAPSHOT.jar server config.yml" the jar which i build by running "mvn clean install"

tosheer avatar Dec 06 '17 03:12 tosheer

ah yes! We utilize jackson-module-parameter-names to avoid having to jackson-annotate all of our creator parameters. This is included in the library, but requires your application to enable the feature on startup.

in your ExampleApplication:

import com.fasterxml.jackson.annotation.JsonCreator.Mode;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;

@Override
public void initialize(final Bootstrap<Config> bootstrap) {
  super.initialize(bootstrap);
  bootstrap.getObjectMapper().registerModule(new ParameterNamesModule(Mode.PROPERTIES));
}

Having annotations on our creator methods seems like a small price to pay to avoid this bit of setup.

Let me know if the change above works for you!

kyeah avatar Dec 06 '17 18:12 kyeah

@kyeah thanks, above mentioned problem is solved by your solution. But now i am facing issue as it is always picking up the InfluxDbHttpWriter which needs a database property where as i have specified the type as "tcp" in the config. Github repo https://github.com/tosheer/analysis is already updated for the same. Let me know if you want me to raise a new issue for this. I will close this issue.

tosheer avatar Dec 07 '17 15:12 tosheer

how can I use to spring boot ?

linving avatar Jan 20 '18 15:01 linving