Stackdriver REST api - getting multiple Time Series



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to get multiple time series using stackdriver api. Specifically, GCP load balancer data.
Using the stackdriver dashboard I've created a chart with some params and it works well, displaying all different time series answering the filters.
I've copied the same params to the API playground and the json response returning a single time series (probably the first).



This is the query (taken from the playground console):




return gapi.client.monitoring.projects.timeSeries.list(
"name": "projects/my_project",
"aggregation.alignmentPeriod": "60s",
"aggregation.crossSeriesReducer": "REDUCE_SUM",
"aggregation.groupByFields": [
"metric.label.cache_result",
"metric.label.response_code"
],
"aggregation.perSeriesAligner": "ALIGN_RATE",
"filter": "metric.type="loadbalancing.googleapis.com/https/request_count" AND resource.label.forwarding_rule_name="my_rule_name"",
"interval.endTime": "2018-11-16T15:04:05Z",
"interval.startTime": "2006-11-15T11:04:05Z",
"pageSize": 1,
"view": "FULL"
)



REST response:


"timeSeries": [

"metric":
"labels":
"response_code": "0",
"cache_result": "DISABLED"
,
"type": "loadbalancing.googleapis.com/https/request_count"
,
"resource":
"type": "https_lb_rule",
"labels":
"project_id": "my_project_id"

,
"metricKind": "GAUGE",
"valueType": "DOUBLE",
"points": [

"interval":
"startTime": "2018-11-15T13:12:05Z",
"endTime": "2018-11-15T13:12:05Z"
,
"value":
"doubleValue": 0.05


]

],
"nextPageToken": "CPvK9vuH/qibZxJtIh0KEAoGCKXhtd8FEgYIpeG13wUSCRmamZmZmZmpPyoNaHR0cHNfbGJfcnVsZTI9chkKFWfdsfpYzovcmVzcG9uc2VfY29kZRAAciAKFG1ldHJpYzovY2FjaGVfcmVzdWx0GghESVNBQkxFRA=="



The actual chart I'm expecting to get (from SD console - same params):
expected










share|improve this question




























    0















    I'm trying to get multiple time series using stackdriver api. Specifically, GCP load balancer data.
    Using the stackdriver dashboard I've created a chart with some params and it works well, displaying all different time series answering the filters.
    I've copied the same params to the API playground and the json response returning a single time series (probably the first).



    This is the query (taken from the playground console):




    return gapi.client.monitoring.projects.timeSeries.list(
    "name": "projects/my_project",
    "aggregation.alignmentPeriod": "60s",
    "aggregation.crossSeriesReducer": "REDUCE_SUM",
    "aggregation.groupByFields": [
    "metric.label.cache_result",
    "metric.label.response_code"
    ],
    "aggregation.perSeriesAligner": "ALIGN_RATE",
    "filter": "metric.type="loadbalancing.googleapis.com/https/request_count" AND resource.label.forwarding_rule_name="my_rule_name"",
    "interval.endTime": "2018-11-16T15:04:05Z",
    "interval.startTime": "2006-11-15T11:04:05Z",
    "pageSize": 1,
    "view": "FULL"
    )



    REST response:


    "timeSeries": [

    "metric":
    "labels":
    "response_code": "0",
    "cache_result": "DISABLED"
    ,
    "type": "loadbalancing.googleapis.com/https/request_count"
    ,
    "resource":
    "type": "https_lb_rule",
    "labels":
    "project_id": "my_project_id"

    ,
    "metricKind": "GAUGE",
    "valueType": "DOUBLE",
    "points": [

    "interval":
    "startTime": "2018-11-15T13:12:05Z",
    "endTime": "2018-11-15T13:12:05Z"
    ,
    "value":
    "doubleValue": 0.05


    ]

    ],
    "nextPageToken": "CPvK9vuH/qibZxJtIh0KEAoGCKXhtd8FEgYIpeG13wUSCRmamZmZmZmpPyoNaHR0cHNfbGJfcnVsZTI9chkKFWfdsfpYzovcmVzcG9uc2VfY29kZRAAciAKFG1ldHJpYzovY2FjaGVfcmVzdWx0GghESVNBQkxFRA=="



    The actual chart I'm expecting to get (from SD console - same params):
    expected










    share|improve this question
























      0












      0








      0








      I'm trying to get multiple time series using stackdriver api. Specifically, GCP load balancer data.
      Using the stackdriver dashboard I've created a chart with some params and it works well, displaying all different time series answering the filters.
      I've copied the same params to the API playground and the json response returning a single time series (probably the first).



      This is the query (taken from the playground console):




      return gapi.client.monitoring.projects.timeSeries.list(
      "name": "projects/my_project",
      "aggregation.alignmentPeriod": "60s",
      "aggregation.crossSeriesReducer": "REDUCE_SUM",
      "aggregation.groupByFields": [
      "metric.label.cache_result",
      "metric.label.response_code"
      ],
      "aggregation.perSeriesAligner": "ALIGN_RATE",
      "filter": "metric.type="loadbalancing.googleapis.com/https/request_count" AND resource.label.forwarding_rule_name="my_rule_name"",
      "interval.endTime": "2018-11-16T15:04:05Z",
      "interval.startTime": "2006-11-15T11:04:05Z",
      "pageSize": 1,
      "view": "FULL"
      )



      REST response:


      "timeSeries": [

      "metric":
      "labels":
      "response_code": "0",
      "cache_result": "DISABLED"
      ,
      "type": "loadbalancing.googleapis.com/https/request_count"
      ,
      "resource":
      "type": "https_lb_rule",
      "labels":
      "project_id": "my_project_id"

      ,
      "metricKind": "GAUGE",
      "valueType": "DOUBLE",
      "points": [

      "interval":
      "startTime": "2018-11-15T13:12:05Z",
      "endTime": "2018-11-15T13:12:05Z"
      ,
      "value":
      "doubleValue": 0.05


      ]

      ],
      "nextPageToken": "CPvK9vuH/qibZxJtIh0KEAoGCKXhtd8FEgYIpeG13wUSCRmamZmZmZmpPyoNaHR0cHNfbGJfcnVsZTI9chkKFWfdsfpYzovcmVzcG9uc2VfY29kZRAAciAKFG1ldHJpYzovY2FjaGVfcmVzdWx0GghESVNBQkxFRA=="



      The actual chart I'm expecting to get (from SD console - same params):
      expected










      share|improve this question














      I'm trying to get multiple time series using stackdriver api. Specifically, GCP load balancer data.
      Using the stackdriver dashboard I've created a chart with some params and it works well, displaying all different time series answering the filters.
      I've copied the same params to the API playground and the json response returning a single time series (probably the first).



      This is the query (taken from the playground console):




      return gapi.client.monitoring.projects.timeSeries.list(
      "name": "projects/my_project",
      "aggregation.alignmentPeriod": "60s",
      "aggregation.crossSeriesReducer": "REDUCE_SUM",
      "aggregation.groupByFields": [
      "metric.label.cache_result",
      "metric.label.response_code"
      ],
      "aggregation.perSeriesAligner": "ALIGN_RATE",
      "filter": "metric.type="loadbalancing.googleapis.com/https/request_count" AND resource.label.forwarding_rule_name="my_rule_name"",
      "interval.endTime": "2018-11-16T15:04:05Z",
      "interval.startTime": "2006-11-15T11:04:05Z",
      "pageSize": 1,
      "view": "FULL"
      )



      REST response:


      "timeSeries": [

      "metric":
      "labels":
      "response_code": "0",
      "cache_result": "DISABLED"
      ,
      "type": "loadbalancing.googleapis.com/https/request_count"
      ,
      "resource":
      "type": "https_lb_rule",
      "labels":
      "project_id": "my_project_id"

      ,
      "metricKind": "GAUGE",
      "valueType": "DOUBLE",
      "points": [

      "interval":
      "startTime": "2018-11-15T13:12:05Z",
      "endTime": "2018-11-15T13:12:05Z"
      ,
      "value":
      "doubleValue": 0.05


      ]

      ],
      "nextPageToken": "CPvK9vuH/qibZxJtIh0KEAoGCKXhtd8FEgYIpeG13wUSCRmamZmZmZmpPyoNaHR0cHNfbGJfcnVsZTI9chkKFWfdsfpYzovcmVzcG9uc2VfY29kZRAAciAKFG1ldHJpYzovY2FjaGVfcmVzdWx0GghESVNBQkxFRA=="



      The actual chart I'm expecting to get (from SD console - same params):
      expected







      api google-cloud-platform stackdriver






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '18 at 13:45









      IdanIdan

      1,50432451




      1,50432451






















          1 Answer
          1






          active

          oldest

          votes


















          1














          In the request you pass "pageSize": 1 which tells the api to only return 1 result. Removing this parameter would allow it to return up to 100k results in a single response.



          As "view": "FULL" is passed, each result is a single point in the timeseries. If you remove the pageSize parameter or increase it and still don't get all of the points back in a single response because there are too many, you can pass the same request with pageToken set to the nextPageToken of the prior response to get the next set of results.



          More information here: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list#body.QUERY_PARAMETERS.page_size






          share|improve this answer























          • Thank you! I was under the impression the page size is per-series and not an incremental count of all of them. removing this value returned all metrics. Although I need only 1 point from each series so it's a bit overkill.

            – Idan
            Nov 18 '18 at 7:05











          • No problem! If you know the time of the point that you want, you can use the interval to limit just around that time and get back fewer points.

            – Colin Adams
            Nov 18 '18 at 13:42












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53320850%2fstackdriver-rest-api-getting-multiple-time-series%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          In the request you pass "pageSize": 1 which tells the api to only return 1 result. Removing this parameter would allow it to return up to 100k results in a single response.



          As "view": "FULL" is passed, each result is a single point in the timeseries. If you remove the pageSize parameter or increase it and still don't get all of the points back in a single response because there are too many, you can pass the same request with pageToken set to the nextPageToken of the prior response to get the next set of results.



          More information here: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list#body.QUERY_PARAMETERS.page_size






          share|improve this answer























          • Thank you! I was under the impression the page size is per-series and not an incremental count of all of them. removing this value returned all metrics. Although I need only 1 point from each series so it's a bit overkill.

            – Idan
            Nov 18 '18 at 7:05











          • No problem! If you know the time of the point that you want, you can use the interval to limit just around that time and get back fewer points.

            – Colin Adams
            Nov 18 '18 at 13:42
















          1














          In the request you pass "pageSize": 1 which tells the api to only return 1 result. Removing this parameter would allow it to return up to 100k results in a single response.



          As "view": "FULL" is passed, each result is a single point in the timeseries. If you remove the pageSize parameter or increase it and still don't get all of the points back in a single response because there are too many, you can pass the same request with pageToken set to the nextPageToken of the prior response to get the next set of results.



          More information here: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list#body.QUERY_PARAMETERS.page_size






          share|improve this answer























          • Thank you! I was under the impression the page size is per-series and not an incremental count of all of them. removing this value returned all metrics. Although I need only 1 point from each series so it's a bit overkill.

            – Idan
            Nov 18 '18 at 7:05











          • No problem! If you know the time of the point that you want, you can use the interval to limit just around that time and get back fewer points.

            – Colin Adams
            Nov 18 '18 at 13:42














          1












          1








          1







          In the request you pass "pageSize": 1 which tells the api to only return 1 result. Removing this parameter would allow it to return up to 100k results in a single response.



          As "view": "FULL" is passed, each result is a single point in the timeseries. If you remove the pageSize parameter or increase it and still don't get all of the points back in a single response because there are too many, you can pass the same request with pageToken set to the nextPageToken of the prior response to get the next set of results.



          More information here: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list#body.QUERY_PARAMETERS.page_size






          share|improve this answer













          In the request you pass "pageSize": 1 which tells the api to only return 1 result. Removing this parameter would allow it to return up to 100k results in a single response.



          As "view": "FULL" is passed, each result is a single point in the timeseries. If you remove the pageSize parameter or increase it and still don't get all of the points back in a single response because there are too many, you can pass the same request with pageToken set to the nextPageToken of the prior response to get the next set of results.



          More information here: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list#body.QUERY_PARAMETERS.page_size







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 23:16









          Colin AdamsColin Adams

          387




          387












          • Thank you! I was under the impression the page size is per-series and not an incremental count of all of them. removing this value returned all metrics. Although I need only 1 point from each series so it's a bit overkill.

            – Idan
            Nov 18 '18 at 7:05











          • No problem! If you know the time of the point that you want, you can use the interval to limit just around that time and get back fewer points.

            – Colin Adams
            Nov 18 '18 at 13:42


















          • Thank you! I was under the impression the page size is per-series and not an incremental count of all of them. removing this value returned all metrics. Although I need only 1 point from each series so it's a bit overkill.

            – Idan
            Nov 18 '18 at 7:05











          • No problem! If you know the time of the point that you want, you can use the interval to limit just around that time and get back fewer points.

            – Colin Adams
            Nov 18 '18 at 13:42

















          Thank you! I was under the impression the page size is per-series and not an incremental count of all of them. removing this value returned all metrics. Although I need only 1 point from each series so it's a bit overkill.

          – Idan
          Nov 18 '18 at 7:05





          Thank you! I was under the impression the page size is per-series and not an incremental count of all of them. removing this value returned all metrics. Although I need only 1 point from each series so it's a bit overkill.

          – Idan
          Nov 18 '18 at 7:05













          No problem! If you know the time of the point that you want, you can use the interval to limit just around that time and get back fewer points.

          – Colin Adams
          Nov 18 '18 at 13:42






          No problem! If you know the time of the point that you want, you can use the interval to limit just around that time and get back fewer points.

          – Colin Adams
          Nov 18 '18 at 13:42




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53320850%2fstackdriver-rest-api-getting-multiple-time-series%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

          Syphilis

          Darth Vader #20