Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.yml parse failed | #6

Open
tosheer opened this issue Dec 5, 2017 · 5 comments
Open

config.yml parse failed | #6

tosheer opened this issue Dec 5, 2017 · 5 comments

Comments

@tosheer
Copy link

tosheer commented Dec 5, 2017

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.

@kyeah
Copy link
Contributor

kyeah commented Dec 5, 2017

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
Copy link
Author

tosheer commented Dec 6, 2017

@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
Copy link
Contributor

kyeah commented Dec 6, 2017

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
Copy link
Author

tosheer commented Dec 7, 2017

@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
Copy link

linving commented Jan 20, 2018

how can I use to spring boot ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants