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

NR Dropwizard reporter should start from the project .yml file #112

Open
kanderson250 opened this issue Nov 17, 2023 · 1 comment
Open
Labels
3w Estimate - three weeks or less

Comments

@kanderson250
Copy link
Contributor

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

Steps to reproduce

  • Version 0.8.0 or 1.0.0 of this project
  • Dropwizard v4.0.x
  • A Dropwizard REST app (such as the official dropwizard-example project)
  • Configure a NR reporter from the Dropwizard .yml config file (such as example.yml in the dropwizard-example project above):
metrics:
  reporters:
    - type: newrelic
      apiKey: <NR_API_KEY>
  • 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

@workato-integration
Copy link

@workato-integration workato-integration bot changed the title NR Dropwizard reporter should start from the project .yml file NR Dropwizard reporter should start from the project .yml file Nov 17, 2023
@kford-newrelic kford-newrelic added jan-mar qtr Represents proposed work item for the Jan-Mar quarter estimate Issue needing estimation labels Dec 3, 2023
@kford-newrelic kford-newrelic added 3w Estimate - three weeks or less and removed estimate Issue needing estimation labels Dec 20, 2023
@kford-newrelic kford-newrelic removed the jan-mar qtr Represents proposed work item for the Jan-Mar quarter label Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3w Estimate - three weeks or less
Projects
None yet
Development

No branches or pull requests

2 participants