Skip to content
Snippets Groups Projects
Commit 9f46d8ae authored by Christian Wulf's avatar Christian Wulf
Browse files

added monitoring

parent 1cecd76a
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.aspectj.org/dtd/aspectj_1_5_0.dtd">
<aspectj>
<weaver options="-showWeaveInfo"> <!-- options="-verbose -showWeaveInfo -Xjoinpoints:synchronization" -->
<!--
Use the exclude/include directives to specify which classes are (not) to be considered for weaving.
Some examples are given below. Please refer to the AspectJ documentation to learn more on the
allowed patterns, including wildcards.
-->
<!--
Use * to consider all classes in all packages. In this case, you typically need some additional excludes.
-->
<include within="teetime.stage..*"/>
<!--
Include/exclude examples for specific libraries:
-->
<!--
Important: The logger library that is configured to be used by Kieker must always be excluded!
(Particularly important when using the include-all directive from above.)
-->
<exclude within="org.apache.commons.logging..*" />
<exclude within="org.slf4j..*" />
<exclude within="java.util.logging..*" />
<exclude within="org.apache.log4j..*" />
<!-- Instrument all kieker.tests: -->
<!-- <include within="kieker.tests..*" /> -->
<!-- Example instrumentation for the iBATIS JPetStore -->
<!-- <include within="com.ibatis.jpetstore..*"/> -->
<!-- <include within="org.apache.struts.action.ActionServlet" /> -->
<!-- Include this to enable javac compilation (instead of ajc) of the probes: -->
<!-- <include within="kieker.monitoring.probe.aspectj..*"/> -->
</weaver>
<aspects>
<!--
Aspects are configured in this section of the AspectJ configuration file.
Specific examples for Kieker monitoring aspects are given below.
Usually, only one aspect should be active at a time.
-->
<!-- 1. STATE-BASED MONITORING (OPERATION EXECUTIONS)
The following directives enable aspects for monitoring operation executions. These aspects intercept
an execution of a software operation resulting in a single Kieker monitoring record of type
OperationExecutionRecord.
Depending on the used directives, i. all, ii. only annotated (@OperationExecutionMonitoringProbe),
or ii. only specific methods are monitored. Note that the noGetterAndSetter aspects also exclude
is..() methods for boolean getters. The Servlet aspects additionally extract session information
from Servlet entry point methods (do* with HttpServletRequest and HttpServletResponse parameters.)
-->
<!-- <aspect name="kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectAnnotation"/> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectAnnotationServlet"/> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFull"/> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFullNoGetterAndSetter"/> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFullServlet"/> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFullNoGetterAndSetterServlet"/> -->
<!-- 2. EVENT-BASED MONITORING
The following directives enable aspects for monitoring control flow events, resulting in different
types of monitoring records to be found in the kieker.common.record.flow package.
Depending on the used directives, i. all, ii. only annotated, or iii. only specific methods are
monitored. Again, the noGetterAndSetter aspects also exclude is.. for boolean getters.
-->
<!-- Concurrency (beta stated): -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.concurrency.ThreadingAspect" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.concurrency.SynchronizedAspect" /> -->
<!-- Constructors and constructor calls: -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.construction.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.construction.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorExecution.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorExecution.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorExecutionObject.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorExecutionObject.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorExecutionObjectInterface.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorExecutionObjectInterface.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorCall.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorCall.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorCallObject.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.constructorCallObject.Annotation" /> -->
<!-- Method executions and method calls: -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecution.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecution.FullInstrumentationNoGetterAndSetter" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecution.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecutionObject.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecutionObject.FullInstrumentationNoGetterAndSetter" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecutionObject.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecutionObjectInterface.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecutionObjectInterface.FullInstrumentationNoGetterAndSetter" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationExecutionObjectInterface.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationCall.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationCall.FullInstrumentationNoGetterAndSetter" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationCall.Annotation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationCallObject.FullInstrumentation" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationCallObject.FullInstrumentationNoGetterAndSetter" /> -->
<!-- <aspect name="kieker.monitoring.probe.aspectj.flow.operationCallObject.Annotation" /> -->
<!--
Definition of additional targeted aspects (example for a single additional getter).
Use these directives to create additional aspects without the need to actually implement them. -->
<concrete-aspect name="kieker.monitoring.probe.aspectj.flow.operationExecution.TargetedAspect" extends="kieker.monitoring.probe.aspectj.flow.operationExecution.AbstractAspect">
<!-- <pointcut name="monitoredOperation" expression="execution(* teetime.framework.Stage+.execute())" /> -->
<!-- <pointcut name="monitoredOperation" expression="call(* teetime.framework.OutputPort.send(..))" /> -->
<pointcut name="a" expression="execution(* teetime.stage.string.Tokenizer.execute(..))" />
<pointcut name="b" expression="execution(* teetime.stage.string.ToLowerCase.execute(..))" />
<pointcut name="c" expression="execution(* teetime.stage.MappingCounter.execute(..))" />
<pointcut name="monitoredOperation" expression="a() || b() || c()" />
</concrete-aspect>
</aspects>
</aspectj>
This diff is collapsed.
java ^
-javaagent:kieker-1.11-aspectj.jar ^
-cp .;target\*;target\dependency\*; ^
teetime.examples.wordcounter.WordCounterTest ^
4 1 target\classes\hugetext.txt
\ No newline at end of file
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
*/ */
package teetime.stage.string; package teetime.stage.string;
import java.util.regex.Pattern;
import teetime.framework.AbstractConsumerStage; import teetime.framework.AbstractConsumerStage;
import teetime.framework.OutputPort; import teetime.framework.OutputPort;
...@@ -22,17 +24,26 @@ public final class Tokenizer extends AbstractConsumerStage<String> { ...@@ -22,17 +24,26 @@ public final class Tokenizer extends AbstractConsumerStage<String> {
private final OutputPort<String> outputPort = this.createOutputPort(); private final OutputPort<String> outputPort = this.createOutputPort();
private final String regex; private final String regex;
private final Pattern pattern;
public Tokenizer(final String regex) { public Tokenizer(final String regex) {
this.regex = regex; this.regex = regex;
pattern = Pattern.compile(regex);
} }
@Override @Override
protected void execute(final String element) { protected void execute(final String element) {
// Matcher matcher = pattern.matcher(element);
// while (matcher.find()) {
// String token = element.substring(matcher.start(), matcher.end());
// outputPort.send(token);
// }
String[] tokens = element.split(regex); String[] tokens = element.split(regex);
for (String token : tokens) { for (String token : tokens) {
outputPort.send(token); outputPort.send(token);
} }
// Scanner is much slower
// Pattern is equally fast
} }
public OutputPort<String> getOutputPort() { public OutputPort<String> getOutputPort() {
......
/** /**
* Copyright (C) 2015 TeeTime (http://teetime.sourceforge.net) * Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://christianwulf.github.io/teetime)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/**
* Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://christianwulf.github.io/teetime)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package teetime.examples.wordcounter; package teetime.examples.wordcounter;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
<!-- <logger name="teetime.framework.signal" level="TRACE" /> --> <!-- <logger name="teetime.framework.signal" level="TRACE" /> -->
<!-- <logger name="teetime.stage" level="TRACE" /> --> <!-- <logger name="teetime.stage" level="TRACE" /> -->
<logger name="util" level="INFO" /> <logger name="util" level="INFO" />
<logger name="kieker" level="ERROR" />
<root level="WARN"> <root level="WARN">
<appender-ref ref="CONSOLE" /> <appender-ref ref="CONSOLE" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment