Skip to content

Why Use HTTP POST When Querying '/render' API? #173

@barakAtSoluto

Description

@barakAtSoluto

The Chart class is using "POST" method to query the /render API. I was wondering why?
As you can see in the method called - GraphiteWebClient-> request sends a null body (true, it's only the default but - it's not overwritten in the aforementioned call). So - it seems there is no reason to use "POST".

My motivation here is that I'm using a Graphite as a service called hostedgraphite. While using "POST" they return the "No Data" png as if the metric doesn't exists, but, "GET" works as expected.
An example query:

https://www.hostedgraphite.com/<client_id>/<client_token>/graphite/render?from=1530173184&until=1530173784&width=613&height=220&hideLegend=&tz=Europe%2FHelsinki&_salt=1530173784.000&vTitle=Percent&lineMode=connected&drawNullAsZero=false&graphType=line&majorGridLineColor=%230000003F&minorGridLineColor=%2300000000&_ext=whatever.svg&areaAlpha=0.5&areaMode=all&lineWidth=2&min=0&title=Disk%20_mnt&yUnitSystem=binary&target=alias%28color%28icinga2.icinga2master_soluto_local.services.disk.disk.perfdata._mnt.value%2C%20%27%231a7dd7%27%29%2C%20%27Used%20%28bytes%29%27%29&target=alias%28color%28icinga2.icinga2master_soluto_local.services.disk.disk.perfdata._mnt.max%2C%20%27%23cfd7e6%27%29%2C%20%27Size%20%28bytes%29%27%29.

I'll post an update after I hear back from hostedgraphite as to why the "POST" isn't working. Regardless, I believe "POST" shouldn't be used if there's no reason for it.

Expected Behavior

Plugin to work seamlessly without any regard to where Graphite is hosted.

Current Behavior

The "POST" method creates complications.

Possible Solution

Make the HTTP method configurable.

Steps to Reproduce (for bugs)

  1. Create a hostedgraphite account.
  2. Aquire a token.
  3. Set the base url accordingly.
  4. Check the Connect insecurelyCheck box.
  5. Config your GraphiteWriter accordingly.

Context

No graphs were displayed before the method was changed to "GET".

Your Environment

  • Module version (System - About): 1.0.1
  • Icinga Web 2 version and modules (System - About): 2.5.3
  • Icinga 2 version (icinga2 --version): r2.8.4-1
  • Graphite (carbon, web, whisper) version: Graphite version 0.9.15 with some fixes cherry-picked from upstream.
  • Operating System and version: Ubuntu 16.04.4
  • Webserver, PHP versions: Apache/2.4.18, PHP 7.0.30

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions