You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/05/11 16:21:00 UTC

[GitHub] [druid] jp707049 opened a new issue #11235: Building Custom Emitter

jp707049 opened a new issue #11235:
URL: https://github.com/apache/druid/issues/11235


   Hi all,
   
   I'm creating a custom emitter for Druid 0.21.0
   
   I've been referencing other emitters in `extensions-contrib` (example - `influxDbEmitter`) to get started. But I'm facing following errors. Btw, I've created this as a new project not under the druid `extensions-contrib` folder.
   
   Here are the logs
   ```
   2021-05-11T11:17:00,869 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-custom-emitter], jars: druid-custom-emitter-0.1.jar
   
   ....
   
   2021-05-11T11:17:05,330 INFO [main] org.apache.druid.guice.JsonConfigurator - Skipping druid.emitter.myEmitter.url property: one of it's prefixes is also used as a property key. Prefix: druid
   ....
   ....
   2021-05-11T11:17:10,746 INFO [main] org.apache.druid.metadata.storage.derby.DerbyConnector - Derby connector instantiated with metadata storage [org.apache.druid.metadata.storage.derby.DerbyMetadataStorage].
   
   Exception in thread "main" java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors:
   
   1) Error injecting method, org.apache.druid.java.util.common.ISE: Unknown emitter type[druid.emitter]=[custom], known types[[noop, logging, http, parametrized, composing]]
   
     at org.apache.druid.server.emitter.EmitterModule$EmitterProvider.inject(EmitterModule.java:132)
   
     at org.apache.druid.server.emitter.EmitterModule.configure(EmitterModule.java:82) (via modules: com.google.inject.util.Modules$OverrideModule -> com.google.inject.util.Modules$OverrideModule -> org.apache.druid.server.emitter.EmitterModule)
   ...
   ...
   2) Error in custom provider, org.apache.druid.java.util.common.ISE: Emitter was null, that's bad!
     at org.apache.druid.server.emitter.EmitterModule.configure(EmitterModule.java:82) (via modules: com.google.inject.util.Modules$OverrideModule -> com.google.inject.util.Modules$OverrideModule -> org.apache.druid.server.emitter.EmitterModule)
   ```
   
   
   Here are my properties.
   ```
   druid.extensions.loadList=["druid-hdfs-storage", "druid-kafka-indexing-service", "druid-datasketches", "druid-custom-emitter"]
   druid.monitoring.monitors=["org.apache.druid.java.util.metrics.JvmMonitor"]
   druid.emitter=custom
   druid.emitter.custom.url=http://localhost/url/to
   druid.emitter.custom.application=amp-test
   druid.emitter.custom.datacenter=QA
   ```
   
   Currently, I'm just trying to just log using emitter, but getting above errors. Is there any change on how we configure EmitterModule?
   
   Below is my `CustomEmitterModule.class`
   ```
   public class CustomEmitterModule implements DruidModule
   {
     private static final String EMITTER_TYPE = "custom";
     private static final Logger log = new Logger(CustomEmitterModule.class);
   
     @Override
     public List<? extends Module> getJacksonModules()
     {
       return Collections.emptyList();
     }
   
     @Override
     public void configure(Binder binder)
     {
       JsonConfigProvider.bind(binder, "druid.emitter." + EMITTER_TYPE, CustomEmitterConfig.class);
     }
   
     @Provides
     @ManageLifecycle
     @Named(EMITTER_TYPE)
     public Emitter getEmitter(CustomEmitterConfig customEmitterConfig, ObjectMapper mapper)
     {
       return new CustomEmitter(customEmitterConfig, mapper);
     }
   }
   ```
   
   Here is `CustomEmitter.class`
   ```
   public class CustomEmitter implements Emitter
   {
     private static final Logger log = new Logger(CustomEmitter.class);
     private final CustomEmitterrConfig customEmitterConfig;
     private final ObjectMapper mapper;
   
     public HubbleEmitter(CustomEmitterConfig customEmitterConfig, ObjectMapper mapper)
     {
       this.mapper = mapper;
       this.customEmitterConfig = customEmitterConfig;
       log.info("Constructed CustomEmitter");
     }
   
     @Override
     @LifecycleStart
     public void start()
     {
       log.info("Starting")
     }
   
     @Override
     public void emit(Event event)
     {
       log.info("Emitting");
     }
   
     @Override
     public void flush() throws IOException
     {
       log.info("Flushing");
     }
   
     @Override
     public void close() throws IOException
     {
       log.info("Closing");
     }
   }
   ```
   
   Any help is appreciated.
   
   Thank you,
   Jeet


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jp707049 commented on issue #11235: [Help] Building Custom Emitter

Posted by GitBox <gi...@apache.org>.
jp707049 commented on issue #11235:
URL: https://github.com/apache/druid/issues/11235#issuecomment-839460722


   Hello Frank,
   
   My bad. instead of creating directory `META-INF/services` I created `META-INF.services` 😄 
   
   Closing this issue.
   
   Thank you :) 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jp707049 commented on issue #11235: [Help] Building Custom Emitter

Posted by GitBox <gi...@apache.org>.
jp707049 commented on issue #11235:
URL: https://github.com/apache/druid/issues/11235#issuecomment-839423804


   Hello Frank,
   
   I added `log.info` inside `CustomEmitterModule` but it does not log anything.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] FrankChen021 commented on issue #11235: [Help] Building Custom Emitter

Posted by GitBox <gi...@apache.org>.
FrankChen021 commented on issue #11235:
URL: https://github.com/apache/druid/issues/11235#issuecomment-839405644


   I think this problem is related to loading of your new module. You could set a breakpoint or add some log inside `CustomEmitterModule` to make sure has been loaded first.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jp707049 closed issue #11235: [Help] Building Custom Emitter

Posted by GitBox <gi...@apache.org>.
jp707049 closed issue #11235:
URL: https://github.com/apache/druid/issues/11235


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org