You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Gerhard Petracek (JIRA)" <ji...@apache.org> on 2014/04/20 12:32:14 UTC

[jira] [Commented] (DELTASPIKE-580) @InvocationMonitored

    [ https://issues.apache.org/jira/browse/DELTASPIKE-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13975101#comment-13975101 ] 

Gerhard Petracek commented on DELTASPIKE-580:
---------------------------------------------

the first draft also includes an integration with jsf.

sample usage:

{code}
...
    public void onMonitoredMethodInvocations(@Observes MonitoredMethodInvocationsEvent methodInvocationsEvent)
    {
        String userId = this.userHolder.getCurrentUserId();
        String viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();

        for (MethodInvocationDescriptor methodInvocation : methodInvocationsEvent.getMethodInvocationDescriptors())
        {
            if (methodInvocation.getException() != null)
            {
                warn(userId + "@[" + viewId + "] at [" + new Date(methodInvocation.getTimestamp()) + "]: " +
                    methodInvocation.getMethodDetails() + ":L" + methodInvocation.getException().getStackTrace()[0].getLineNumber() +
                    " failed with " + methodInvocation.getException().toString());
            }
            else
            {
                info(userId + "@[" + viewId + "] at [" + new Date(methodInvocation.getTimestamp()) + "]: " +
                        methodInvocation.getMethodDetails());
            }

            if (methodInvocation.getExecutionTime() > this.maxThreshold)
            {
                warn("slow method-invocation detected: " + methodInvocation.getMethodDetails());
            }
        }
    }
...
{code}

> @InvocationMonitored
> --------------------
>
>                 Key: DELTASPIKE-580
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-580
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: Core
>            Reporter: Gerhard Petracek
>            Assignee: Gerhard Petracek
>             Fix For: 0.7
>
>         Attachments: DELTASPIKE-580_first_draft.patch
>
>
> use-cases to support:
>  - exception monitoring
>  - performance monitoring (via execution time)
>  - auditing (with or without parameter values)



--
This message was sent by Atlassian JIRA
(v6.2#6252)