graphite-dev team mailing list archive
-
graphite-dev team
-
Mailing list archive
-
Message #00689
Re: [Question #147349]: Support for rendering in different formats
Question #147349 on Graphite changed:
https://answers.launchpad.net/graphite/+question/147349
Chris Boulton gave more information on the question:
Oh - I did forget to mention, adding support for a new renderer means
just dropping a file in to webapp/graphite/render/renderers/, like so:
---
from graphite.render.renderers.base import BaseRenderer
from django.http import HttpResponse
from graphite.util import json
import pprint
class Renderer(BaseRenderer):
def render(self, data):
seriesInfo = [series.getInfo() for series in data]
jsonData = json.dumps(seriesInfo)
if self.requestOptions['jsonCallback']:
jsonData = ''.join([self.requestOptions['jsonCallback'], '(', jsonData, ');'])
response = HttpResponse(jsonData, mimetype='application/json')
return response
The renderer is then accessible at /render?renderer=json&.....
--
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.