kickstarter / dropwizard-influxdb-reporter

Dropwizard Integrations for InfluxDB.
Apache License 2.0
17 stars 8 forks source link

config.yml parse failed | #6

Open tosheer opened 6 years ago

tosheer commented 6 years ago

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:

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

kyeah commented 6 years ago

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!

tosheer commented 6 years ago

@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"

kyeah commented 6 years ago

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!

tosheer commented 6 years ago

@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.

linving commented 6 years ago

how can I use to spring boot ?