This message was deleted.
# general
s
This message was deleted.
m
Hey @dontu balu I found this documentation. Note that I have not done this myself but this seems logical:
Copy code
Customize the Metric Emitter:

Druid supports customizing the metric emitter. You can implement your custom metric emitter class by extending the appropriate Druid metric emitter class.
Include Cluster Name as Metadata:

Within your custom metric emitter, you can include additional metadata, such as the Druid cluster name, with each emitted metric. This metadata can be added to the emitted metric data.
Register the Custom Emitter:

Register your custom metric emitter in the Druid configuration. This involves specifying the fully qualified class name of your custom emitter in the Druid configuration.
Implement Custom HTTP Service:

On the receiving end (your HTTP endpoint service), modify the service to parse the incoming metrics and extract the additional metadata (e.g., Druid cluster name) for further processing.
Let me know if you figure out how to register your custom metric Java code, I don't know how that's going to get compiled and then called.
Copy code
import org.apache.druid.emitter.core.Emitter;
import org.apache.druid.emitter.http.HttpEmitterConfig;

public class CustomHttpEmitter extends HttpEmitter
{
  private final String clusterName;

  public CustomHttpEmitter(String clusterName, HttpEmitterConfig config)
  {
    super(config);
    this.clusterName = clusterName;
  }

  @Override
  protected String getFeed()
  {
    // Include the cluster name as part of the feed
    return "druid/" + clusterName + "/metrics";
  }
}

// Register the custom emitter in your Druid configuration
s
https://github.com/apache/druid/blob/2118258b547eb6f802f8c0752dcfad15740f2600/serv[…]ava/org/apache/druid/server/emitter/ExtraServiceDimensions.java - You can write a Druid module that reads config passed in to the Druid service and binds it as
ExtraServiceDimensions
. The service emitter will then report these dimensions along all metrics reported by Druid
It could look something like Add the following properties to common.runtime.properties to your cluster
Copy code
druid.emitter.tags.clusterName=<myCluster>
druid.emitter.tags.clusterType=dev|prod
druid.emitter.tags.<tagName>=<tagValue>
The extension would then simply extract the key value pairs from any config that starts with
druid.emitter.tags
and bind it to the
ExtraServiceDimensions
This should work if you wanted to distinguish which clusters the metrics that are being emitted belong to.
m
Hey @Suneet Saldanha when Java code is added to Druid, how does it get compiled and run? Just curious since I'm assuming that this doesn't require rebuilding Druid components... 🤔
s
@Mike Sherman https://druid.apache.org/docs/latest/development/modules should talk about how to build an extension in Druid
🤠 1
m
Gotta love this understatement -
Managing library collisions can be daunting for extensions which draw in commonly used libraries
🤨 1