A user noticed that they were unable to start the NewRelicReporter from the project .yml config file after upgrading to Dropwizard v4.0.1. They are using the Dropwizard REST framework and running the .yml file on server startup (see below for reproduction steps.) They saw the error with versions 0.8.0 and 1.0.0 of the dropwizard-metrics-newrelic project.
Reproduced error message:
io.dropwizard.configuration.ConfigurationParsingException: example.yml has an error:
* Failed to parse configuration at: metrics.reporters.[0]; Could not resolve type id 'newrelic' as a subtype of `io.dropwizard.metrics.common.ReporterFactory`: known type ids = [console, csv, graphite, log] (for POJO property 'reporters')
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.example.helloworld.HelloWorldConfiguration["metrics"]->io.dropwizard.metrics.common.MetricsFactory["reporters"]->java.util.ArrayList[0])
at io.dropwizard.configuration.ConfigurationParsingException$Builder.build(ConfigurationParsingException.java:277)
at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:177)
at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:94)
at io.dropwizard.core.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:139)
at io.dropwizard.core.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
at io.dropwizard.core.cli.Cli.run(Cli.java:78)
at io.dropwizard.core.Application.run(Application.java:94)
at com.example.helloworld.HelloWorldApplication.main(HelloWorldApplication.java:73)
Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'newrelic' as a subtype of `io.dropwizard.metrics.common.ReporterFactory`: known type ids = [console, csv, graphite, log] (for POJO property 'reporters')
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.example.helloworld.HelloWorldConfiguration["metrics"]->io.dropwizard.metrics.common.MetricsFactory["reporters"]->java.util.ArrayList[0])
at com.fasterxml.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43)
at com.fasterxml.jackson.databind.DeserializationContext.invalidTypeIdException(DeserializationContext.java:2084)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownTypeId(DeserializationContext.java:1575)
at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._handleUnknownTypeId(TypeDeserializerBase.java:298)
at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:165)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:151)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:136)
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:263)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:361)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
at com.fasterxml.jackson.module.blackbird.deser.SettableObjectProperty.deserializeAndSet(SettableObjectProperty.java:44)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:278)
at com.fasterxml.jackson.module.blackbird.deser.SuperSonicBeanDeserializer.deserialize(SuperSonicBeanDeserializer.java:155)
at com.fasterxml.jackson.module.blackbird.deser.SettableObjectProperty.deserializeAndSet(SettableObjectProperty.java:44)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:278)
at com.fasterxml.jackson.module.blackbird.deser.SuperSonicBeanDeserializer.deserialize(SuperSonicBeanDeserializer.java:155)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4801)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2974)
at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:148)
... 6 more
Run the config file with the app startup commands, such as java -jar path/to/dropwizard-app.jar server example.yml for the project mentioned above.
Acceptance Criteria
The New Relic reporter should be able to start from the Dropwizard config file without error.
Temporary Workaround
Until this issue is resolved, users can start and configure the NewRelicReporter in-code as described in the documentation of this project: starting the New Relic reporter
Description
A user noticed that they were unable to start the
NewRelicReporter
from the project.yml
config file after upgrading to Dropwizard v4.0.1. They are using the Dropwizard REST framework and running the.yml
file on server startup (see below for reproduction steps.) They saw the error with versions0.8.0
and1.0.0
of thedropwizard-metrics-newrelic
project.Reproduced error message:
Steps to reproduce
.yml
config file (such asexample.yml
in thedropwizard-example
project above):java -jar path/to/dropwizard-app.jar server example.yml
for the project mentioned above.Acceptance Criteria
The New Relic reporter should be able to start from the Dropwizard config file without error.
Temporary Workaround
Until this issue is resolved, users can start and configure the
NewRelicReporter
in-code as described in the documentation of this project: starting the New Relic reporter