# Building a Robust Micrometer Integration

**URL:** <https://community.dynatrace.com/t/building-a-robust-micrometer-integration/41187>\
**Category:** Dynatrace Tips\
**Tags:** integrations, tips-and-tricks\
**Created:** [August 13, 2023, 4:19am UTC](https://community.dynatrace.com/t/building-a-robust-micrometer-integration/41187 "2023-08-13T04:19:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick-Montana](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/nick-montana/32/2051_2.png) [@Nick-Montana](https://community.dynatrace.com/u/Nick-Montana)\
**Post date:** [August 13, 2023, 4:19am UTC](https://community.dynatrace.com/t/building-a-robust-micrometer-integration/41187/1 "2023-08-13T04:19:54Z")

</div>

Hi,

As Dynatrace developers its important to understand how metrics are sent to Dynatrace. Of course utilizing Dynatrace’s OneAgent built-in detection is the first step to reaching observability. We also have access to intelligent extensions like Micrometer for building our own defined custom metrics through the Meter interface.

[Micrometer Docs](https://micrometer.io/docs/concepts)

[Dynatace Micrometer Docs](https://www.dynatrace.com/support/help/extend-dynatrace/extend-metrics/ingestion-methods/micrometer)

If you are familiar with the separate APIs, there are actually multiple methods of metric ingestions between version 1 and version 2 of the API. Correct me if I’m wrong but I believe version 2 came out when the OneAgent was implemented?

I recommend checking out the Dynatrace Meter Registry source code. It provides a lot of interesting insight on how Micrometer sends metrics to the API. For example there are two exporters that correlate to the two API versions.

[Dynatrace Meter Registry code](https://github.com/micrometer-metrics/micrometer/blob/main/implementations/micrometer-registry-dynatrace/src/main/java/io/micrometer/dynatrace/DynatraceMeterRegistry.java)

 ![NickMontana_0-1691899844584.png](https://global.discourse-cdn.com/dynatrace/original/2X/d/de67d281bba5d54593931442e6c7f052a6de42f7.png)

Taking a look at the Dynatrace Meter Registry Builder object you can see the [HttpUrlConnectionSender() method.](https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-core/src/main/java/io/micrometer/core/ipc/http/HttpUrlConnectionSender.java) This is used to configure your organization’s proxy server on the registry. This method uses a unique Micrometer interface called [HttpSender which enables build REST](https://www.javadoc.io/doc/io.micrometer/micrometer-core/1.1.0/io/micrometer/core/ipc/http/HttpSender.Request.html)&nbsp;communication for Micrometer metrics.

Let’s take a look…

 ![NickMontana_0-1692031263741.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/8/a87e6f9210f4d24e42b2719847b5b412c0d6b6b8.png)

Here you can see that we a&nbsp;[Proxy parameter.](https://docs.oracle.com/javase/8/docs/api/java/net/Proxy.html)

So you’ll want to create a Bean method that builds a proxy-based Meter Registry. Furthermore, you’ll want to obtain those proxy parameters via property files using the “@Value” parameter annotation.

@Bean

public DynatraceMeterRegistry myfunction(DynatraceConfig config, @Value(“{com.foo.barr.dynatrace.proxy}”)){

your logic…

return registry

}

 ![Reaching Observability Other Graphics_2023-08-13_03-52-55.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/c/fc98168fbbdabfe716c03259b81db64ff405cf8b.png)

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [September 7, 2023, 12:39pm UTC](https://community.dynatrace.com/t/building-a-robust-micrometer-integration/41187/2 "2023-09-07T12:39:20Z")

</div>

Thanks for sharing this&nbsp;[@Nick-Montana](https://community.dynatrace.com/user/48870)
