kenhub / giraffe

Giraffe - a graphite dashboard with a long neck

Home Page:http://giraffe.kenhub.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different line style for one of targets

zdenekpizl opened this issue · comments

Let's have a definition:

"metrics":
[
{
"alias": "Files used",
"target": ["alias(avg(servers.stagingsrv0[123].system.open_files.used),'Average of stagingsrv0[123]')",
"aliasByNode(servers.stagingsrv0[123].system.open_files.used,1)"],
"description": "Open files used",
"renderer": "line",
"interpolation": "linear",
"colspan": 3,
},
]

How to draw the line of AVERAGE in different style (e.g. dashed) than others?

Thank you, .zp.

You can assign a different color to each target, e.g. see https://github.com/kenhub/giraffe/blob/master/dashboards.js#L113-L117

Currently I can't think of an easy way to change the line style though.

Sadly - suggested approach how to define colour explicitly does not work apparently. My config snippet:

"metrics":
[
  {
    "alias": "System Load",
    "targets": ['aliasByNode(servers.server06.system.load.load,1)',
                {target: 'alias(movingAverage(servers.server06.system.load.load,5),"Moving Average of 5 segment",
                 color: '#F00',
                 alias: 'Moving average'} ],
    "events": "*",  // instead of annotator, if you use the graphite events feature
                    // you can retrieve events matching specific tag(s) -- space separated
                    // or use * for all tags. Note you cannot use both annotator and events.
    "description": "",
    "renderer": "line",
    "interpolation": "linear",
    "colspan": 3,
  },
]

Did not change anything. Any other hint, how to achieve at least explicit colour? Tank you, .zp.

Thanks for reporting it. Looks like a documentation issue. The keys should be strings, e.g.

{'target': '...', 'color': '#F00', 'alias': 'moving average'}

Can you try and let me know if it works this way?

UPDATE: it seems to work for me even without strings in the keys... possibly it doesn't work if you include ( or " characters in the target string. Looks like a bug. I'll try to take a look and hope to fix it some time. If you use 'plain' targets it seems to work...

Hallo,
thank you for quick response. Still no luck, this is my current configuration:

{ "name": "SERVER06 characteristics",
"refresh": 30000,
"scheme": "classic9", // this is a dashboard-specific color palette
"description": "",
"metrics":
[
{
"alias": "System Load",
"targets": ['aliasByNode(servers.server06.system.load.load,1)',
{'target': 'alias(movingAverage(servers.server06.system.load.load,5),"Moving Average of 5 segments")','color': '#F00','alias': 'Moving average'} ],
"description": "",
"renderer": "line",
"interpolation": "linear",
"colspan": 3,
},
]
},

Image of result is attached (hopefully). Version of the beast is giraffe-master from Jan 31 2014, with regards .zp.

server06-load

ok, I figured out the problem. I'm not sure if it's documented, but if not then I'll update the documentation.

The short solution: always make sure your alias in the graphite target matches exactly the alias in the dictionary, e.g.

{target: 'alias(...,"this must match")', color: '#F00', alias: 'this must match'}.

This is due to the way graphite returns the target information back from the query. The code needs to match the returned value with the alias, in order to apply the color. Perhaps there's a more elegant way to achieve this, but for now that's the only available way.

In your dashboards.js the aliases don't match, and that's why the color doesn't apply. ("Moving Average of 5 segments" != 'Moving average'). If you update the alias to match it should apply the color correctly.

Wow, it works!

Thank you very much, best regards .zp.

Glad to have helped. Sorry about the confusion. I'll try to update the documentation to explain this.

Well,
at the end of today I can say it was not so tricky to mix different renderers ;-) I have to use newer Rickshaw supporting renderer: multi, and hack few lines of code into giraffe.js, it is not coffeescripted yet, but I will continue for sure.

Adding different renderers (dashed lines or areas) should not be so hard now.

Regards, .zp.

multirenderer

Looks great! If you want to submit a pull request with the changes to make things like this easier, I'd be happy to include those (see https://github.com/kenhub/giraffe#development). If you're not familiar with coffeescript, you can share the javascript changes, and I can try to adapt the code.

Hallo,

as I am little bit confused about what should be part of pull request I'd
like to be sure. What I have done basically:

  • update of rickshaw.min.js to latest
  • update d3 to d3.v3.min.js
  • code few additional lines to giraffe.js

I assume that changes to girraffe.js directly are not allowed, such changes
should be generated from giraffe.coffee, right? So it has to be just and
only change in girraffe.coffee. How to generated up-to-date girraffe.js

I will do some cleanup of my proposal and then will create a pull request
to kenhub/girraffe from my fork. OK?

Best regards, .zp.

On Fri, Feb 7, 2014 at 8:56 AM, gingerlime notifications@github.com wrote:

Looks great! If you want to submit a pull request with the changes to make
things like this easier, I'd be happy to include those (see
https://github.com/kenhub/giraffe#development). If you're not familiar
with coffeescript, you can share the javascript changes, and I can try to
adapt the code.


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-34412534
.

Zdeněk Pižl | Platform team
zdenek.pizl@gooddata.com

GoodData | gooddata.com
Karolinská 650/1
186 00 Prague 8

Hi zp.

Yes, you've got the process worked out correctly. The changes should first go into the coffeescript file and then compiled into the js file. To compile it, you'll need to have coffeescript installed and then run (from the root folder of the repo)

coffee -b -c -o js/ js/src/giraffe.coffee

If all goes well, it should create a compiled giraffe.js file inside the js folder. Then you can commit all files into your branch and make a pull request.

If you're not sure, I can try to help you. You can submit only changes to js and I can try to place them into the coffeescript, but perhaps it's a chance for you to try something new?

Cheers
Yoav

Hallo,

I've just created a pull request: #58

I hope it will fulfil expectations. With regards, .zp.

On Fri, Feb 7, 2014 at 2:03 PM, gingerlime notifications@github.com wrote:

Hi zp.

Yes, you've got the process worked out correctly. The changes should first
go into the coffeescript file and then compiled into the js file. To
compile it, you'll need to have coffeescript installed and then run (from
the root folder of the repo)

coffee -b -c -o js/ js/src/giraffe.coffee

If all goes well, it should create a compiled giraffe.js file inside the
js folder. Then you can commit all files into your branch and make a pull
request.

If you're not sure, I can try to help you. You can submit only changes to
js and I can try to place them into the coffeescript, but perhaps it's a
chance for you to try something new?

Cheers
Yoav


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-34434579
.

Zdeněk Pižl | Platform team
zdenek.pizl@gooddata.com

GoodData | gooddata.com
Karolinská 650/1
186 00 Prague 8