<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Combine Two Metrics in One V2 Metrics API Call in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/Combine-Two-Metrics-in-One-V2-Metrics-API-Call/m-p/269466#M3594</link>
    <description>&lt;P&gt;Hello Community,&lt;/P&gt;
&lt;P&gt;Is it possible to combine two metrics in an API call. They are not the same family.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;builtin:containers.memory.limitBytes and builtin:kubernetes.workload.requests_memory&lt;/P&gt;
&lt;P&gt;with the search key being the Kubernetes namespace.&lt;/P&gt;
&lt;P&gt;(Otherwise, I can probably make two calls and then merge the results.)&lt;/P&gt;
&lt;P&gt;Any ideas would be appreciated.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Lou&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2025 12:26:35 GMT</pubDate>
    <dc:creator>crabbylou</dc:creator>
    <dc:date>2025-02-10T12:26:35Z</dc:date>
    <item>
      <title>Combine Two Metrics in One V2 Metrics API Call</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Combine-Two-Metrics-in-One-V2-Metrics-API-Call/m-p/269466#M3594</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;
&lt;P&gt;Is it possible to combine two metrics in an API call. They are not the same family.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;builtin:containers.memory.limitBytes and builtin:kubernetes.workload.requests_memory&lt;/P&gt;
&lt;P&gt;with the search key being the Kubernetes namespace.&lt;/P&gt;
&lt;P&gt;(Otherwise, I can probably make two calls and then merge the results.)&lt;/P&gt;
&lt;P&gt;Any ideas would be appreciated.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Lou&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 12:26:35 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Combine-Two-Metrics-in-One-V2-Metrics-API-Call/m-p/269466#M3594</guid>
      <dc:creator>crabbylou</dc:creator>
      <dc:date>2025-02-10T12:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Two Metrics in One V2 Metrics API Call</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Combine-Two-Metrics-in-One-V2-Metrics-API-Call/m-p/269467#M3595</link>
      <description>&lt;P&gt;I think you should be able to get what you want one way or another. In the &lt;A href="https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/metric-v2/get-data-points" target="_blank"&gt;metrics get data points API&lt;/A&gt; call you can set metric selector in which you can specify &lt;A href="https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/metric-v2/metric-selector" target="_blank"&gt;multiple metric selectors&lt;/A&gt; (separated by commas) or you can do &lt;A href="https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/metric-v2/metric-expressions" target="_blank"&gt;metric expressions&lt;/A&gt; (i.e simple arithmetic).&lt;/P&gt;
&lt;P&gt;If you query for multiple selectors you will have the results separate in the response (but with 1 call) and if you use an expression (e.g. metricA + metricB) the data points returned will be the result. You'll want to make sure you are splitting by the same dimensions in each subselector.&lt;/P&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;metricSelector: builtin:host.cpu.idle:splitBy("dt.entity.host") + builtin:host.cpu.system:splitBy("dt.entity.host")&lt;/LI-CODE&gt;
&lt;P&gt;Response:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
  "totalCount": 2,
  "nextPageKey": null,
  "resolution": "Inf",
  "result": [
    {
      "metricId": "builtin:host.cpu.idle:splitBy(\"dt.entity.host\")+builtin:host.cpu.system:splitBy(\"dt.entity.host\")",
      "dataPointCountRatio": 0.0000242,
      "dimensionCountRatio": 0.00004,
      "data": [
        {
          "dimensions": [
            "HOST-5B4495AD33E8513B"
          ],
          "dimensionMap": {
            "dt.entity.host": "HOST-5B4495AD33E8513B"
          },
          "timestamps": [
            1738874700000
          ],
          "values": [
            99.52119439623269
          ]
        },
        {
          "dimensions": [
            "HOST-561B1E07CB771F4B"
          ],
          "dimensionMap": {
            "dt.entity.host": "HOST-561B1E07CB771F4B"
          },
          "timestamps": [
            1738874700000
          ],
          "values": [
            95.33600394990708
          ]
        }
      ]
    }
  ]
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 20:45:56 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Combine-Two-Metrics-in-One-V2-Metrics-API-Call/m-p/269467#M3595</guid>
      <dc:creator>JamesKitson</dc:creator>
      <dc:date>2025-02-06T20:45:56Z</dc:date>
    </item>
  </channel>
</rss>

