title: AWS Cloudwatch GetMetricData Discrepancy between CLI and SDKs
body: <p>I am trying to perform a simple CloudWatch query to get some metric data. I want to get the actual metrics. Using the AWS CLI I am getting the expected behavior.  However, using client SDKs (tried both Python's Boto and Java's SDKs), the same (seeming) query is not returning my metrics. </p>
  
  <p>My query criteria is defined in <code>query.json</code>:</p>
  
  <pre><code>[
      {
          "Id": "test",
          "MetricStat": {
              "Metric": {
                  "Namespace": "MyNamespace",
                  "MetricName": "MyMetric",
                  "Dimensions": [
                      {
                          "Name": "SOURCE",
                          "Value": "TEST"
                      }
                  ]
              },
              "Period": 3600,
              "Stat": "SampleCount",
              "Unit":"Seconds"
              },
          "ReturnData": true
      }
  ]
  </code></pre>
  
  <p><strong>CLI</strong> this works. Returns my metric value and timestamp</p>
  
  <pre><code>aws cloudwatch get-metric-data --max-items 10 --start-time "2020-05-01T00:00:00Z" --end-time "2020-06-01T00:00:00Z" --metric-data-queries file://./query.json
  {
      "MetricDataResults": [
          {
              "Id": "test",
              "Label": "MyMetric",
              "Timestamps": [
                  "2020-05-15T13:00:00Z",
  ...
              ],
              "Values": [
                  1.0,
  ...
              ],
              "StatusCode": "Complete"
          }
      ],
      "Messages": []
  }
  </code></pre>
  
  <p><strong>Boto</strong> won't return the metrics, even from the same file</p>
  
  <pre><code>In [77]: cw.get_metric_data(MetricDataQueries=json.load(open("query.json")), StartTime=datetime.datetime(2020,5,1), EndTime=datetime.datetime(2020,6,1), MaxDatapoints=10)
  Out [77]: {'MetricDataResults': [{'Id': 'test',
     'Label': 'MyMetric',
     'Timestamps': [],       &lt;--Why isn't this populated?
     'Values': [],
     'StatusCode': 'PartialData'}],
  </code></pre>
  
  <p><strong>Java</strong> Approximately the same input criteria</p>
  
  <pre><code>MetricDataQuery query = new MetricDataQuery().withReturnData(true);
  query.setMetricStat(new MetricStat()
                      .withStat("SampleCount")
                      .withPeriod(36000)
                      .withMetric(
                              new Metric()
                                      .withMetricName("MyMetric")
                                      .withNamespace("MyNamespace)
                                      .withDimensions(new Dimension()
                                              .withName("SOURCE")
                                              .withValue("TEST"))));
  
  cw.getMetricData(new GetMetricDataRequest()
                      .withStartTime(Date.from(Instant.now().minus(100, ChronoUnit.DAYS)))
                      .withEndTime(Date.from(Instant.now()))
                      .withScanBy(ScanBy.TimestampDescending)
                      .withMaxDatapoints(10)
                      .withMetricDataQueries(query))
  
  
  // Result ==&gt; {Id: TestQuery,Label: MyMetric,Timestamps: [],Values: [],StatusCode: PartialData,Messages: []}
  </code></pre>
  
  <p>I haven't a clue why the cli will return metric values, but both CDKs I've tried don't seem to. Any hints?</p>