How and when update the trend graphs?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How and when update the trend graphs?

Ulli Hafner-2
Hi,

In the findbugs and tasks plugins I currently update the trend images only for new successful builds.
There have been some request to change this behavior and always update the graph
(see issue https://hudson.dev.java.net/issues/show_bug.cgi?id=795). What is the desired
way to update these images in Hudson? I copied the code from the Test Report plugin, but
I'm not sure whether this is the right way? The guard I use is

        if (request.checkIfModified(owner.getTimestamp(), response) || healthReportBuilder == null) {
            return; // don't re-create image
        }

Currently this means that the images are not updated if a build fails or an build is deleted. I can remove the guard
and return always an new image but I'm not sure whether this is a performance or memory problem...

Any suggestions?

Ulli
--
Avaloq - essential for banking.

Avaloq Evolution AG
Allmendstrasse 140, 8027 Z├╝rich
T +41 44 488 6790, F +41 44 488 6868, http://www.avaloq.com 
Dr. Ullrich Hafner mailto:[hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How and when update the trend graphs?

Kohsuke Kawaguchi
Administrator
Hafner Ullrich wrote:

> Hi,
>
> In the findbugs and tasks plugins I currently update the trend images only for new successful builds.
> There have been some request to change this behavior and always update the graph
> (see issue https://hudson.dev.java.net/issues/show_bug.cgi?id=795). What is the desired
> way to update these images in Hudson? I copied the code from the Test Report plugin, but
> I'm not sure whether this is the right way? The guard I use is
>
>         if (request.checkIfModified(owner.getTimestamp(), response) || healthReportBuilder == null) {
>             return; // don't re-create image
>         }
The code above is incorrect. The checkIfModified() method has a side
effect. Namely, when it returns true, it also sets the HTTP Status code
telling the browser that the browser can keep using its own cache.

When the method evaluates to false but healtHReportBuilder==null, then
you end up returning an empty response. You'd have to check this
separately, and if helthReportBuilder is null you'd have to return 404
or something.

> Currently this means that the images are not updated if a build fails or an build is deleted.

AIU, the code above is from the FindBugsResultAction class, which is an
action object to be added to a build when the findbugs publisher runs.

If this doesn't update the chart for failed build, that means those
failed builds must be not getting FindBugsResultAction object, so that's
what we'd need to change.

 > I can remove the guard and return always an new image but
 > I'm not sure whether this is a performance or memory problem...

I don't think this helps. When you invoke FindBugsResult.doGraph
multiple times, it will return the exact same image.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: How and when update the trend graphs?

Ulli Hafner-2
> >
> >         if (request.checkIfModified(owner.getTimestamp(),
> response) || healthReportBuilder == null) {
> >             return; // don't re-create image
> >         }
>
> The code above is incorrect. The checkIfModified() method has
> a side effect. Namely, when it returns true, it also sets the
> HTTP Status code telling the browser that the browser can
> keep using its own cache.
>
> When the method evaluates to false but
> healtHReportBuilder==null, then you end up returning an empty
> response. You'd have to check this separately, and if
> helthReportBuilder is null you'd have to return 404 or something.

I see, I'll change that piece of code.

>
> > Currently this means that the images are not updated if a
> build fails or an build is deleted.
>
> AIU, the code above is from the FindBugsResultAction class,
> which is an action object to be added to a build when the
> findbugs publisher runs.
>
> If this doesn't update the chart for failed build, that means
> those failed builds must be not getting FindBugsResultAction
> object, so that's what we'd need to change.

I just checked it, seems to work now if I delete a build. My graphs
get updated now. Maybe I got something wrong in a previous release.

Thanks, Ulli

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]