<?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 Re: Migrate a custom 1.0 Python extension to the new 2.0 framework. in Extensions</title>
    <link>https://community.dynatrace.com/t5/Extensions/Migrate-a-custom-1-0-Python-extension-to-the-new-2-0-framework/m-p/262917#M5557</link>
    <description>&lt;P&gt;You're not doing the metric ingestion correctly. For correct gauge usage, please chek out the documentation and examples here:&lt;BR /&gt;&lt;A href="https://docs.dynatrace.com/docs/ingest-from/extend-dynatrace/extend-metrics/reference/metric-ingestion-protocol" target="_blank"&gt;https://docs.dynatrace.com/docs/ingest-from/extend-dynatrace/extend-metrics/reference/metric-ingestion-protocol&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2024 15:28:37 GMT</pubDate>
    <dc:creator>AntonioSousa</dc:creator>
    <dc:date>2024-11-19T15:28:37Z</dc:date>
    <item>
      <title>Migrate a custom 1.0 Python extension to the new 2.0 framework.</title>
      <link>https://community.dynatrace.com/t5/Extensions/Migrate-a-custom-1-0-Python-extension-to-the-new-2-0-framework/m-p/262913#M5555</link>
      <description>&lt;P&gt;&lt;SPAN&gt;We have a custom extension V2 in python that performs some healthcheck. It should report back the metrics to Dynatrace with the status and the url used to perform the healthcheck. Our call looks this:&lt;BR /&gt;&lt;BR /&gt;self.report_metric(&lt;BR /&gt;key="healthcheck_state",&lt;BR /&gt;value="success",&lt;BR /&gt;dimensions={"url": "google.be"}&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;When checking the logs on the Active Gate we get the following error back:&lt;BR /&gt;&lt;BR /&gt;Error HTTP 400 from &lt;A href="http://127.0.0.1:14599/mint/8460131254161511808" target="_blank" rel="noopener"&gt;http://127.0.0.1:14599/mint/8460131254161511808&lt;/A&gt;: b'{\n "error": {\n "invalidLines": [\n {\n "line": 1,\n "error": "invalid metric field in message \'healthcheck_state,url=\\"google.com\\" gauge,success 1732025455011\'; error at \' \' (index 48)"\n },\n {\n "line": 2,\n "error": "invalid metric field in message \'healthcheck_state,url=\\"google.com\\" gauge,success 1732025455011\'; error at \' \' (index 48)"\n }\n ],\n "code": 400,\n "message": "2 invalid lines"\n },\n "linesOk": 0,\n "linesInvalid": 2\n}'&lt;BR /&gt;&lt;BR /&gt;I guess this means that the validation of the metric fails. After reading about the MINT protocol I still wonder why it fails? I don't see a&amp;nbsp;\&amp;nbsp;somewhere. Seems to me like the&amp;nbsp;dict&amp;nbsp;is not correctly serialized and the quotes are escaped? Can this be avoided?&lt;BR /&gt;&lt;BR /&gt;Could it be related to this&amp;nbsp;&lt;A href="https://github.com/dynatrace-extensions/dt-extensions-python-sdk/blob/88e01af748b7e8a0357b000fd2a6320e6040f105/dynatrace_extension/sdk/metric.py#L87" target="_blank" rel="noopener"&gt;line&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;def _key_and_dimensions(self):&lt;BR /&gt;if not self.dimensions:&lt;BR /&gt;return f"{self.key}"&lt;/P&gt;
&lt;P&gt;# Double quotes are added around {v} but later escaped.&lt;BR /&gt;dimensions_string = ",".join([f'{k}="{v}"' for k, v in self.dimensions.items()])&lt;BR /&gt;return f"{self.key},{dimensions_string}"&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 07:31:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Migrate-a-custom-1-0-Python-extension-to-the-new-2-0-framework/m-p/262913#M5555</guid>
      <dc:creator>jannickdeturck</dc:creator>
      <dc:date>2024-11-20T07:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Migrate a custom 1.0 Python extension to the new 2.0 framework.</title>
      <link>https://community.dynatrace.com/t5/Extensions/Migrate-a-custom-1-0-Python-extension-to-the-new-2-0-framework/m-p/262916#M5556</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jannickdeturck_0-1732029856138.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24682iF72F60D6C7394D32/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jannickdeturck_0-1732029856138.png" alt="jannickdeturck_0-1732029856138.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 15:24:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Migrate-a-custom-1-0-Python-extension-to-the-new-2-0-framework/m-p/262916#M5556</guid>
      <dc:creator>jannickdeturck</dc:creator>
      <dc:date>2024-11-19T15:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Migrate a custom 1.0 Python extension to the new 2.0 framework.</title>
      <link>https://community.dynatrace.com/t5/Extensions/Migrate-a-custom-1-0-Python-extension-to-the-new-2-0-framework/m-p/262917#M5557</link>
      <description>&lt;P&gt;You're not doing the metric ingestion correctly. For correct gauge usage, please chek out the documentation and examples here:&lt;BR /&gt;&lt;A href="https://docs.dynatrace.com/docs/ingest-from/extend-dynatrace/extend-metrics/reference/metric-ingestion-protocol" target="_blank"&gt;https://docs.dynatrace.com/docs/ingest-from/extend-dynatrace/extend-metrics/reference/metric-ingestion-protocol&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 15:28:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Migrate-a-custom-1-0-Python-extension-to-the-new-2-0-framework/m-p/262917#M5557</guid>
      <dc:creator>AntonioSousa</dc:creator>
      <dc:date>2024-11-19T15:28:37Z</dc:date>
    </item>
  </channel>
</rss>

