# How to configure dropwizard module?

**URL:** <https://discuss.elastic.co/t/how-to-configure-dropwizard-module/146978>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [September 2, 2018, 1:58pm UTC](https://discuss.elastic.co/t/how-to-configure-dropwizard-module/146978 "2018-09-02T13:58:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ilia/32/60042_2.png) [@Ilia](https://discuss.elastic.co/u/Ilia)\
**Post date:** [September 2, 2018, 1:58pm UTC](https://discuss.elastic.co/t/how-to-configure-dropwizard-module/146978/1 "2018-09-02T13:58:12Z")

</div>

I have a spring-boot - dropwizard hello world application. The following is a print-screen from jvisualvm of the application ...

 ![Untitled](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7ebfb296ea068ccb01744bcc473cba335618e387.png)

This is also what I can see from [http://localhost:8080/metrics](http://localhost:8080/metrics) in a browser:

```
{
  "mem" : 467911,
  "mem.free" : 306671,
  "processors" : 8,
  "instance.uptime" : 5639045,
  "uptime" : 5643416,
  "systemload.average" : -1.0,
  "heap.committed" : 409088,
  "heap.init" : 262144,
  "heap.used" : 102416,
  "heap" : 3706880,
  "nonheap.committed" : 60184,
  "nonheap.init" : 2496,
  "nonheap.used" : 58823,
  "nonheap" : 0,
  "threads.peak" : 40,
  "threads.daemon" : 28,
  "threads.totalStarted" : 63,
  "threads" : 31,
  "classes" : 7965,
  "classes.loaded" : 7965,
  "classes.unloaded" : 0,
  "gc.ps_scavenge.count" : 14,
  "gc.ps_scavenge.time" : 224,
  "gc.ps_marksweep.count" : 2,
  "gc.ps_marksweep.time" : 75,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.98thPercentile" : 0,
  "com.example.SimpleServiceDelegate.doSomething.exceptions.count" : 0,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.999thPercentile" : 0,
  "com.example.SimpleServiceDelegate.doSomething.exceptions.oneMinuteRate" : 0.0,
  "gauge.response.star-star.favicon.ico" : 26.0,
  "com.example.SimpleServiceDelegate.sayHello.exceptions.oneMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.min" : 0,
  "com.example.SimpleServiceDelegate.sayHello.exceptions.fiveMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.95thPercentile" : 0,
  "com.example.SimpleServiceDelegate.sayHello.oneMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.98thPercentile" : 0,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.median" : 0,
  "gauge.response.metrics.name" : 0.0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.75thPercentile" : 0,
  "counter.status.404.star-star" : 2,
  "gauge.response.metrics" : 1.0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.median" : 0,
  "com.example.SimpleServiceDelegate.sayHello.fifteenMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.sayHello.exceptions.count" : 0,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.mean" : 0,
  "com.example.SimpleServiceDelegate.doSomething.meanRate" : 0.0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.min" : 0,
  "com.example.SimpleServiceDelegate.sayHello.exceptions.meanRate" : 0.0,
  "com.example.SimpleServiceDelegate.sayHello.exceptions.fifteenMinuteRate" : 0.0,
  "counter.status.200.star-star.favicon.ico" : 1,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.max" : 0,
  "com.example.SimpleServiceDelegate.sayHello.count" : 0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.stdDev" : 0,
  "com.example.SimpleServiceDelegate.sayHello.fiveMinuteRate" : 0.0,
  "counter.status.200.metrics" : 2405,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.75thPercentile" : 0,
  "counter.status.404.metrics.name" : 3268,
  "com.example.SimpleServiceDelegate.doSomething.fifteenMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.max" : 0,
  "com.example.SimpleServiceDelegate.doSomething.exceptions.meanRate" : 0.0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.95thPercentile" : 0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.999thPercentile" : 0,
  "com.example.SimpleServiceDelegate.doSomething.count" : 0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.mean" : 0,
  "gauge.response.star-star" : 1.0,
  "com.example.SimpleServiceDelegate.doSomething.oneMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.99thPercentile" : 0,
  "com.example.SimpleServiceDelegate.doSomething.fiveMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.sayHello.snapshot.99thPercentile" : 0,
  "com.example.SimpleServiceDelegate.sayHello.meanRate" : 0.0,
  "com.example.SimpleServiceDelegate.doSomething.exceptions.fiveMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.doSomething.exceptions.fifteenMinuteRate" : 0.0,
  "com.example.SimpleServiceDelegate.doSomething.snapshot.stdDev" : 0,
  "httpsessions.max" : -1,
  "httpsessions.active" : 0
}

```

My metricbeat.yml includes this configuration:

```
#----------------------------- Dropwizard Module -----------------------------
- module: dropwizard
  metricsets: ["collector"]
  period: 2s
  hosts: ["localhost:8080"]
  metrics_path: /metrics/metrics
  namespace: example
  enabled: true

```

With this configuration I can't get any data from the application. Since there is no description for `metrics_path` and `namespace` in [elastic's website](https://www.elastic.co/guide/en/beats/metricbeat/master/metricbeat-module-dropwizard.html), I tested many things for these two parameters but with no success ☹ for example when I use

> metrics\_path: /metrics/com/example/SimpleServiceDelegate/doSomething/Count  
> namespace: example

I get `HTTP error 404 in collector: 404` in `error.message` field with no useful hint from DEBUG level logs.

Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [September 3, 2018, 10:14am UTC](https://discuss.elastic.co/t/how-to-configure-dropwizard-module/146978/2 "2018-09-03T10:14:41Z")

</div>

Hi,

That error seems to reflect a page not found when accessing the given path:

> [@Ilia](#):
>
> metrics\_path: /metrics/metrics

Have you tried with `metrics_path: /metrics`?

---

<div class="post-metadata">

**Author:** ![Ilia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ilia/32/60042_2.png) [@Ilia](https://discuss.elastic.co/u/Ilia)\
**Post date:** [September 3, 2018, 1:44pm UTC](https://discuss.elastic.co/t/how-to-configure-dropwizard-module/146978/3 "2018-09-03T13:44:05Z")

</div>

Hi,

Thank you for reply

> [@exekias](#):
>
> Have you tried with `metrics_path: /metrics` ?

Yes. Actually when I set `metrics_path: /metrics` I don't get any response, even no error, but when I set `metrics_path: /metrics/metrics` I get `HTTP error 404 in collector: 404` error.

After posting this question I got suspected to `namespace` that if this is something related to dropwizard? Searching a bit about it I found [another helloworld](https://github.com/Appdynamics/dropwizard-sample-app) that `namespace` is used [somewhere](https://github.com/Appdynamics/dropwizard-sample-app/blob/master/src/main/java/com/example/helloworld/cli/RenderCommand.java#L33) in its code. When I run it I can get messages with this configuration:

```
- module: dropwizard
  metricsets: ["collector"]
  period: 2s
  hosts: ["localhost:8083"]
  metrics_path: /metrics
  namespace: names
  enabled: true

```

But I don't think `namespace: names` made any effect, because when I change it to any other string like `namespace: zzzzzz` I can yet get message with this pattern: `dropwizard.zzzzzz.*`.  
So, it seems that `namespace` is something related to `metricbeat` (to categorize messages) not `dropwizard`!!  
Another problem is that using the above configuration the `collector` metricset collects all metric stuffs from all tools in the apllcation, even from logback and jvm, for example.

```
{
      "_index": "myapp-metrics-2018.09.03",
      "_type": "doc",
      "_id": "zcCLn2UB1q2w-uLb3qwo",
      "_version": 1,
      "_score": null,
      "_source": {
        "@version": "1",
        "dropwizard": {
          "zzzzzz": {
            "jvm.gc.PS-MarkSweep.count": {
              "value": 2
            },
            "jvm.memory.heap.committed": {
              "value": 330825728
            },
            "jvm.memory.total.committed": {
              "value": 383016960
            },
            "com.codahale.dropwizard.jetty.MutableServletContextHandler.5xx-responses": {
              "count": 0,
              "m1_rate": 0,
              "units": "events/second",
              "m15_rate": 0,
              "m5_rate": 0,
              "mean_rate": 0
            },
            "org.eclipse.jetty.server.HttpConnectionFactory.8082.connections": {
              "p99": 0,
              "count": 0,
              "m1_rate": 0,
              "p95": 0,
              "stddev": 0,
              "m15_rate": 0,
              "m5_rate": 0,
              "p50": 0,
              "mean_rate": 0,
              "p999": 0,
              "p98": 0,
              "max": 0,
              "min": 0,
              "duration_units": "seconds",
              "mean": 0,
              "rate_units": "calls/second",
              "p75": 0
            },
            "com.example.helloworld.resources.HelloWorldResource.get-requests": {
              "p99": 0,
              "m1_rate": 0,
              "count": 0,
              "p95": 0,
              "p999": 0,
              "m15_rate": 0,
              "stddev": 0,
              "p50": 0,
              "mean_rate": 0,
              "m5_rate": 0,
              "p98": 0,
              "max": 0,
              "min": 0,
              "duration_units": "seconds",
              "mean": 0,
              "rate_units": "calls/second",
              "p75": 0
            },
           "ch.qos.logback.core.Appender.all": {
              "count": 25,
              "m1_rate": 4.600222073146615,
              "units": "events/second",
              "m15_rate": 1.4325239843009516,
              "m5_rate": 3.8940039153570245,
              "mean_rate": 0.29945654457636356
            },
           "jvm.memory.non-heap.usage": {
              "value": -51127984
            },
            "org.eclipse.jetty.util.thread.QueuedThreadPool.dw.utilization": {
              "value": 0.96
            },
            "ch.qos.logback.core.Appender.error": {
              "count": 0,
              "m1_rate": 0,
              "units": "events/second",
              "m15_rate": 0,
              "m5_rate": 0,
              "mean_rate": 0
            },
            "jvm.gc.PS-MarkSweep.time": {
              "value": 78
            },
           "jvm.memory.heap.init": {
              "value": 268435456
            },
            "jvm.threads.runnable.count": {
              "value": 40
            },
            "jvm.memory.pools.Code-Cache.usage": {
              "value": 0.03833847045898438
            },
            "jvm.buffers.direct.used": {
              "value": 40491
            },
            "jvm.memory.heap.used": {
              "value": 29903632
            },
            "jvm.threads.terminated.count": {
              "value": 0
            },
            "com.codahale.dropwizard.jetty.MutableServletContextHandler.active-dispatches": {
              "count": 0
            },
            "jvm.memory.total.max": {
              "value": 3795845119
            },
            "jvm.threads.blocked.count": {
              "value": 12
            },
           "jvm.memory.non-heap.init": {
              "value": 2555904
            },
          "jvm.memory.non-heap.used": {
              "value": 51127984
            }
           ............................. and many more!
          }
        },
        "host": {
          "name": "UI"
        },
        "beat": {
          "hostname": "UI",
          "name": "UI",
          "version": "6.4.0"
        },
        "@timestamp": "2018-09-03T13:07:47.271Z",
        "fields": {
          "app": "myapp-core",
          "type": "metrics"
        },
        "metricset": {
          "name": "collector",
          "module": "dropwizard",
          "namespace": "dropwizard.zzzzzz",
          "rtt": 9024,
          "host": "localhost:8083"
        }
      },
      "fields": {
        "@timestamp": [
          "2018-09-03T13:07:47.271Z"
        ]
      },
      "sort": [
        1535980067271
      ]
    }   

```

I know I can filter/delete extra fields in `logstash` but sending a lot of unnecessary messages increases network band usage. Is there any way to get metrics only from some special classes, only from `com.example.helloworld.resources.HelloWorldResource` class or its `sayHello` method in this application, for example?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 1, 2018, 1:44pm UTC](https://discuss.elastic.co/t/how-to-configure-dropwizard-module/146978/4 "2018-10-01T13:44:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
