{"id":26057654,"url":"https://github.com/wavefronthq/wavefront-dropwizard-metrics-sdk-java","last_synced_at":"2025-04-11T05:06:51.201Z","repository":{"id":35220795,"uuid":"39479974","full_name":"wavefrontHQ/wavefront-dropwizard-metrics-sdk-java","owner":"wavefrontHQ","description":"Send Dropwizard Metrics to Wavefront","archived":false,"fork":false,"pushed_at":"2023-03-21T06:59:18.000Z","size":256,"stargazers_count":3,"open_issues_count":5,"forks_count":10,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-04-11T05:06:44.103Z","etag":null,"topics":["dropwizard-metrics","monitoring","time-series","wavefront"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wavefrontHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-22T02:03:00.000Z","updated_at":"2022-04-22T23:38:53.000Z","dependencies_parsed_at":"2023-02-10T20:40:13.118Z","dependency_job_id":null,"html_url":"https://github.com/wavefrontHQ/wavefront-dropwizard-metrics-sdk-java","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavefrontHQ%2Fwavefront-dropwizard-metrics-sdk-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavefrontHQ%2Fwavefront-dropwizard-metrics-sdk-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavefrontHQ%2Fwavefront-dropwizard-metrics-sdk-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavefrontHQ%2Fwavefront-dropwizard-metrics-sdk-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wavefrontHQ","download_url":"https://codeload.github.com/wavefrontHQ/wavefront-dropwizard-metrics-sdk-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345265,"owners_count":21088244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dropwizard-metrics","monitoring","time-series","wavefront"],"created_at":"2025-03-08T11:58:13.693Z","updated_at":"2025-04-11T05:06:51.145Z","avatar_url":"https://github.com/wavefrontHQ.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wavefront Dropwizard Metrics SDK [![build status][ci-img]][ci] [![Released Version][maven-img]][maven]\n\n## Table of Content\n* [Prerequisites](#Prerequisites)\n* [Set Up a DropwizardMetricsReporter](#set-up-a-dropwizardmetricsreporter)\n  * [Step 1: Create a Builder for a DropwizardMetricsReporter](#step-1-create-a-builder-for-a-dropwizardmetricsreporter)\n  * [Step 2: Configure the DropwizardMetricsReporter (Optional)](#step-2-configure-the-dropwizardmetricsreporter-optional)\n  * [Step 3: Set Up a WavefrontSender](#step-3-set-up-a-wavefrontsender)\n  * [Step 4: Create a DropwizardMetricsReporter](#step-4-create-a-dropwizardmetricsreporter)\n* [Start the DropwizardMetricsReporter](#start-the-dropwizardmetricsreporter)\n* [Stop the DropwizardMetricsReporter](#stop-the-dropwizardmetricsreporter)\n* [Types of Data You Can Report to Wavefront](#types-of-data-you-can-report-to-wavefront)\n* [Monitoring the SDK](#monitoring-the-sdk)\n* [License](#License)\n* [How to Contribute](#How-to-Contribute)\n\n# Welcome to the Wavefront Dropwizard Metrics SDK\n\nThe Tanzu Observability by Wavefront Dropwizard Metrics SDK for Java is a library that supports reporting [Dropwizard metrics, delta counters, and histograms](https://metrics.dropwizard.io) to Wavefront.\n\n**Before you start implementing, let us make sure you are using the correct SDK!**\n\n![Wavefront Dropwizard Metrics SDK Decision Tree](docs/java_dropwizard_metrics_sdk.png)\n\n\u003e ***Note***:\n\u003e \u003c/br\u003e\n\u003e   **This is the Tanzu Observability by Wavefront Metrics SDK  for the Java Dropwizard Framework!**\n\u003e   If this SDK is not what you were looking for, see the [table](#wavefront-sdks) given below.\n\n#### Wavefront SDKs\n\u003ctable id=\"SDKlevels\" style=\"width: 100%\"\u003e\n\u003ctr\u003e\n  \u003cth width=\"10%\"\u003eSDK Type\u003c/th\u003e\n  \u003cth width=\"45%\"\u003eSDK Description\u003c/th\u003e\n  \u003cth width=\"45%\"\u003eSupported Languages\u003c/th\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n  \u003ctd\u003e\u003ca href=\"https://docs.wavefront.com/wavefront_sdks.html#sdks-for-collecting-trace-data\"\u003eOpenTracing SDK\u003c/a\u003e\u003c/td\u003e\n  \u003ctd align=\"justify\"\u003eImplements the OpenTracing specification. Lets you define, collect, and report custom trace data from any part of your application code. \u003cbr\u003eAutomatically derives Rate Errors Duration (RED) metrics from the reported spans. \u003c/td\u003e\n  \u003ctd\u003e\n    \u003cul\u003e\n    \u003cli\u003e\n      \u003cb\u003eJava\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-sdk-java\"\u003eOpenTracing SDK\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-bundle-java\"\u003eTracing Agent\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cb\u003ePython\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-sdk-python\"\u003eOpenTracing SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cb\u003eGo\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-sdk-go\"\u003eOpenTracing SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cb\u003e.Net/C#\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-sdk-csharp\"\u003eOpenTracing SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n  \u003ctd\u003e\u003ca href=\"https://docs.wavefront.com/wavefront_sdks.html#sdks-for-collecting-metrics-and-histograms\"\u003eMetrics SDK\u003c/a\u003e\u003c/td\u003e\n  \u003ctd align=\"justify\"\u003eImplements a standard metrics library. Lets you define, collect, and report custom business metrics and histograms from any part of your application code.   \u003c/td\u003e\n  \u003ctd\u003e\n    \u003cul\u003e\n    \u003cli\u003e\n    \u003cb\u003eJava\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-dropwizard-metrics-sdk-java\"\u003eDropwizard\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href =\"https://github.com/wavefrontHQ/wavefront-runtime-sdk-jvm\"\u003eJVM\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003ePython\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-pyformance\"\u003ePyformance SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cb\u003eGo\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/go-metrics-wavefront\"\u003eGo Metrics SDK\u003c/a\u003e\n      \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003e.Net/C#\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-appmetrics-sdk-csharp\"\u003eApp Metrics SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n  \u003ctd\u003eFramework SDK\u003c/td\u003e\n  \u003ctd align=\"justify\"\u003eReports predefined traces, metrics, and histograms from the APIs of a supported app framework. Lets you get started quickly with minimal code changes.\u003c/td\u003e\n  \u003ctd\u003e\n    \u003cul\u003e\n    \u003cli\u003e\u003cb\u003eJava\u003c/b\u003e:\n    \u003ca href=\"https://github.com/wavefrontHQ/wavefront-dropwizard-sdk-java\"\u003eDropwizard\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href=\"https://github.com/wavefrontHQ/wavefront-gRPC-sdk-java\"\u003egRPC\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href=\"https://github.com/wavefrontHQ/wavefront-jaxrs-sdk-java\"\u003eJAX-RS\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href=\"https://github.com/wavefrontHQ/wavefront-jersey-sdk-java\"\u003eJersey\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003e.Net/C#\u003c/b\u003e:\n    \u003ca href=\"https://github.com/wavefrontHQ/wavefront-aspnetcore-sdk-csharp\"\u003eASP.Net core\u003c/a\u003e \u003c/li\u003e\n    \u003c!--- [Python](wavefront_sdks_python.html#python-sdks-that-instrument-frameworks) ---\u003e\n    \u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n  \u003ctd\u003e\u003ca href=\"https://docs.wavefront.com/wavefront_sdks.html#sdks-for-sending-raw-data-to-wavefront\"\u003eSender SDK\u003c/a\u003e\u003c/td\u003e\n  \u003ctd align=\"justify\"\u003eLets you send raw values to Wavefront for storage as metrics, histograms, or traces, e.g., to import CSV data into Wavefront.\n  \u003c/td\u003e\n  \u003ctd\u003e\n    \u003cul\u003e\n    \u003cli\u003e\n    \u003cb\u003eJava\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-java\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003ePython\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-python\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003eGo\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-go\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003e.Net/C#\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-csharp\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003eC++\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-cpp\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n## Prerequisites\nIf you are using Maven, add the following maven dependency to your `pom.xml` file:\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.wavefront\u003c/groupId\u003e\n    \u003cartifactId\u003ewavefront-dropwizard-metrics-sdk-java\u003c/artifactId\u003e\n    \u003cversion\u003e$releaseVersion\u003c/version\u003e\n\u003c/dependency\u003e\n```\nReplace `$releaseVersion` with the latest version available on [maven](http://search.maven.org/#search%7Cga%7C1%7Cwavefront-dropwizard-metrics-sdk-java).\n\n## Set Up a DropwizardMetricsReporter\n\nThis SDK provides a `DropwizardMetricsReporter` to report metrics and histograms to Wavefront.\n\nTo create a `DropwizardMetricsReporter`, follow these steps:\n1. Create a `DropwizardMetricsReporter.Builder` instance.\n2. Optionally, use the builder to configure the `DropwizardMetricsReporter`.\n3. Create a `WavefrontSender` to send data to Wavefront.\n4. Use the builder to create a `DropwizardMetricsReporter` with the `WavefrontSender`.\n\nFor details of each step, see the sections below.\n\n### Step 1: Create a Builder for a DropwizardMetricsReporter\n\nThe `DropwizardMetricsReporter` object reports any metrics, delta counters, and histograms you register in a `MetricRegistry`. This step creates a builder that supports configuring the metrics reporter.\n\n```java\n// Create a registry\nMetricRegistry metricRegistry = new MetricRegistry();\n\n// Create a builder instance for the registry\nDropwizardMetricsReporter.Builder builder = DropwizardMetricsReporter.forRegistry(metricRegistry);\n```\n\n### Step 2: Configure the DropwizardMetricsReporter (Optional)\n\nYou can use the `DropwizardMetricsReporter` builder to specify various optional properties.\n\n#### Basic Properties\n\n```java\n// Optional: Set a nondefault source for your metrics, delta counters, and histograms.\n// Defaults to hostname if omitted\nbuilder.withSource(\"mySource\");\n\n// Add individual reporter-level point tags for your metrics, delta counters, and histograms\n// The point tags are sent with every metric and histogram reported to Wavefront.\nbuilder.withReporterPointTag(\"env\", \"staging\");  // Example - replace values!\nbuilder.withReporterPointTag(\"location\", \"SF\");  // Example - replace values!\n\n// Optional: Add application tags, which are propagated as point tags with the reported metric.\n// See https://github.com/wavefrontHQ/wavefront-sdk-java/blob/master/docs/apptags.md for details.\nbuilder.withApplicationTags(new ApplicationTags.Builder(\"OrderingApp\", \"Inventory\").\n       cluster(\"us-west-1\").\n       shard(\"primary\").build());   // Example - replace values!\n\n// Optional: Report your metrics, delta counters, and histograms with the specified prefix.\nbuilder.prefixedWith(\"myPrefix\");   // Example - replace value!\n\n// Optional: Report JVM metrics for your Java application.\nbuilder.withJvmMetrics();\n\n// Optional: Report minute bin Wavefront histograms.\nbuilder.reportMinuteDistribution();\n\n// Optional: Report hour bin Wavefront histograms.\nbuilder.reportHourDistribution();\n\n// Optional: Report day bin Wavefront histograms.\nbuilder.reportDayDistribution();\n```\n\n#### Advanced Properties\n```java\n// Optional: Explicitly set the clock to override default behavior\nbuilder.withClock(new Clock() {\n  @Override\n  public long getTick() {\n    return System.currentTimeMillis();\n  }\n});\n\n// Optional: Set a filter to report metrics only if they begin with 'my*'\nbuilder.filter(MetricFilter.startsWith(\"my\"));\n\n// Optional: Don't report stddev and m15\nbuilder.disabledMetricAttributes(ImmutableSet.\u003cMetricAttribute\u003ebuilder().\n    add(MetricAttribute.STDDEV).\n    add(MetricAttribute.M15_RATE).\n    build());\n```\n\n### Step 3: Set Up a WavefrontSender\nThe `WavefrontSender` object implements the low-level interface to send data to Wavefront. \n\n* If you have already set up a `WavefrontSender` for another SDK that runs in the same Java Virtual Machine (JVM), use that one. For details about sharing a `WavefrontSender` instance, see [Share a WavefrontSender](https://github.com/wavefrontHQ/wavefront-sdk-doc-sources/blob/master/java/wavefrontsender.md#Share-a-WavefrontSender).\n\n* Otherwise, follow the steps in [Set Up a WavefrontSender](https://github.com/wavefrontHQ/wavefront-sdk-doc-sources/blob/master/java/wavefrontsender.md#wavefrontsender) to send data using either the [Wavefront proxy](https://docs.wavefront.com/proxies.html) or [direct ingestion](https://docs.wavefront.com/direct_ingestion.html).\n\n\n### Step 4: Create a DropwizardMetricsReporter\nUse the configured builder to create the `DropwizardMetricsReporter`. You must first specify the `WavefrontSender` object (see above).\n\n```java\n// Create a DropwizardMetricsReporter instance\nWavefrontSender wavefrontSender = buildWavefrontSender(); // pseudocode\nDropwizardMetricsReporter dropwizardMetricsReporter = builder.build(wavefrontSender);\n```\n## Start the DropwizardMetricsReporter\n\nYou need to explicitly start the `DropwizardMetricsReporter` to start reporting any metrics, delta counters, or histograms you create. Reporting continues until you stop the `DropwizardMetricsReporter` (see below).\n\nThe `DropwizardMetricsReporter` reports metrics/delta counters/histograms at regular intervals. Specify the length of the reporting interval to control how often you send data to the `WavefrontSender`. The reporting interval determines the timestamps on the data sent to Wavefront.\n\n```java\n// Start the reporter to report metrics/delta counters/histograms at regular interval (example: 30s)\ndropwizardMetricsReporter.start(30, TimeUnit.SECONDS);\n```\n\n## Stop the DropwizardMetricsReporter\nYou must explicitly stop the `DropwizardMetricsReporter` before shutting down your application.\n\n```java\n// Get total failure count reported by this reporter\nint totalFailures = dropwizardMetricsReporter.getFailureCount();\n\n// stop the reporter\ndropwizardMetricsReporter.stop();\n```\n\n## Types of Data You Can Report to Wavefront\nThe Dropwizard metrics library supports various [metric types](https://metrics.dropwizard.io/4.0.0/manual/core.html). This Wavefront SDK additionally provides a\n[`DeltaCounter`](https://docs.wavefront.com/delta_counters.html) type and a [`WavefrontHistogram`](https://docs.wavefront.com/proxies_histograms.html) type.\n\nAfter you have created and started the `DropwizardMetricsReporter`, the metrics/delta counters/histograms you create are automatically reported to Wavefront.\n\n```java\n// Assume a DropwizardMetricsReporter that is configured with the filter shown in Advanced Properties, above.\n\n// Raw Counters\n// Counter name begins with 'my*', so it's reported.\nCounter counter = metricRegistry.counter(\"myCounter\");\n// Counter name does not begin with 'my*', so it's ignored.\nCounter notReported = metricRegistry.counter(\"notMyCounter\");\n\n// Wavefront Delta Counter\nDeltaCounter deltaCounter = DeltaCounter.get(metricRegistry, \"myDeltaCounter\");\n\n// Gauge\nAtomicInteger bufferSize = new AtomicInteger();\nGauge gauge = metricRegistry.register(\"myGauge\", () -\u003e bufferSize.get());\n\n// Meter\nMeter meter = metricRegistry.meter(\"myMeter\");\n\n// Timer\nTimer timer = metricRegistry.timer(\"myTimer\");\n\n// Default Dropwizard Histogram\nHistogram dropwizardHistogram = metricRegistry.histogram(\"myDropwizardHistogram\");\n\n// WavefrontHistogram\nWavefrontHistogram wavefrontHistogram = WavefrontHistogram.get(metricRegistry, \"myWavefrontHistogram\");\n```\n\n## Monitoring the SDK\nSee the [diagnostic metrics documentation](https://github.com/wavefrontHQ/wavefront-dropwizard-metrics-sdk-java/tree/master/docs/internal_metrics.md) for details on the internal metrics that this SDK collects and reports to Wavefront.\n\n## License\n[Apache 2.0 License](LICENSE).\n\n## How to Contribute\n\n* Reach out to us on our public [Slack channel](https://www.wavefront.com/join-public-slack).\n* If you run into any issues, let us know by creating a GitHub issue.\n* If you didn't find the information you are looking for in our Wavefront Documentation, create a GitHub issue or PR.\n\n[ci-img]: https://travis-ci.com/wavefrontHQ/wavefront-dropwizard-metrics-sdk-java.svg?branch=master\n[ci]: https://travis-ci.com/wavefrontHQ/wavefront-dropwizard-metrics-sdk-java\n[maven-img]: https://img.shields.io/maven-central/v/com.wavefront/wavefront-dropwizard-metrics-sdk-java.svg?maxAge=604800\n[maven]: http://search.maven.org/#search%7Cga%7C1%7Cwavefront-dropwizard-metrics-sdk-java\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavefronthq%2Fwavefront-dropwizard-metrics-sdk-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwavefronthq%2Fwavefront-dropwizard-metrics-sdk-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavefronthq%2Fwavefront-dropwizard-metrics-sdk-java/lists"}