Package org.apache.sirona.tracking

Examples of org.apache.sirona.tracking.PathTrackingEntry


        for ( PathTrackingEntry entry : entries )
        {
            System.out.println( "entry:" + entry );
        }

        PathTrackingEntry entry = entries.get( 0 );

        Assert.assertEquals( "beer", entry.getMethodName() );

        Assert.assertEquals( "org.apache.test.sirona.javaagent.App", entry.getClassName() );

        Assert.assertEquals( 1, entry.getLevel() );

        entry = entries.get( 1 );

        Assert.assertEquals( "foo", entry.getMethodName() );

        Assert.assertEquals( "org.apache.test.sirona.javaagent.App", entry.getClassName() );

        Assert.assertEquals( 2, entry.getLevel() );

        // there is Thread.sleep( 500 ) so we can be sure a minimum for that

        Assert.assertTrue( entry.getExecutionTime() >= 500 * 1000000 );

        entry = entries.get( 2 );

        Assert.assertEquals( "pub", entry.getMethodName() );

        Assert.assertEquals( "org.apache.test.sirona.javaagent.App", entry.getClassName() );

        Assert.assertEquals( 3, entry.getLevel() );

        Assert.assertTrue( entry.getExecutionTime() >= 100 * 1000000 );

        entry = entries.get( 3 );

        Assert.assertEquals( "bar", entry.getMethodName() );

        Assert.assertEquals( "org.apache.test.sirona.javaagent.App", entry.getClassName() );

        Assert.assertEquals( 4, entry.getLevel() );

        Assert.assertTrue( entry.getExecutionTime() >= 300 * 1000000 );

        // we have only one here
        PathTrackingInvocationListener listener = PathTracker.getPathTrackingInvocationListeners()[0];

        MockPathTrackingInvocationListener mock = MockPathTrackingInvocationListener.class.cast( listener );
View Full Code Here


            if ( pathTrackingEntries.isEmpty() )
            {
                continue;
            }

            PathTrackingEntry first =
                SerializeUtils.deserialize( readBytes( buffers.iterator().next() ), PathTrackingEntry.class );

            if ( first.getStartTime() / 1000000 > startTime.getTime() //
                && first.getStartTime() / 1000000 < endTime.getTime() )
            {
                trackingIds.add(
                    new PathCallInformation( first.getTrackingId(), new Date( startTime.getTime() / 1000000 ) ) );
            }
        }
        return trackingIds;
    }
View Full Code Here

        for ( Pointer pointer : buffers )
        {
            byte[] bytes = readBytes( pointer );

            PathTrackingEntry entry = SerializeUtils.deserialize( bytes, PathTrackingEntry.class );
            if ( entry != null )
            {
                entries.add( entry );
            }
        }
View Full Code Here

    {

        try
        {

            PathTrackingEntry entry = new PathTrackingEntry( UUID.randomUUID().toString(), //
                                                             "nodeId", //
                                                             "org.au.beer.TheBest", //
                                                             "littlecreatures", //
                                                             new Date().getTime(), //
                                                             12, //
View Full Code Here

        try
        {
            String uuid = UUID.randomUUID().toString();
            ids.add( uuid );
            PathTrackingEntry first = new PathTrackingEntry( uuid, //
                                                             "nodeId", //
                                                             "org.au.beer.TheBest", //
                                                             "littlecreatures", //
                                                             new Date().getTime(), //
                                                             12, //
                                                             1 );

            getStore().store( first );

            Calendar twoDaysAgo = Calendar.getInstance();
            twoDaysAgo.add( Calendar.DATE, -2 );

            uuid = UUID.randomUUID().toString();
            ids.add( uuid );
            PathTrackingEntry second = new PathTrackingEntry( uuid, //
                                                              "nodeId", //
                                                              "org.au.beer.TheBest", //
                                                              "littlecreatures", //
                                                              twoDaysAgo.getTime().getTime(), //
                                                              12, //
View Full Code Here

        try
        {
            String firstuuid = UUID.randomUUID().toString();

            PathTrackingEntry first = new PathTrackingEntry( firstuuid, //
                                                             "nodeId", //
                                                             "org.au.beer.TheBest", //
                                                             "littlecreatures", //
                                                             new Date().getTime(), //
                                                             12, //
                                                             1 );

            getStore().store( first );

            Calendar twoDaysAgo = Calendar.getInstance();
            twoDaysAgo.add( Calendar.DATE, -2 );

            String seconduuid = UUID.randomUUID().toString();

            PathTrackingEntry second = new PathTrackingEntry( seconduuid, //
                                                              "nodeId", //
                                                              "org.au.beer.TheBest", //
                                                              "littlecreatures", //
                                                              twoDaysAgo.getTime().getTime(), //
                                                              12, //
                                                              1 );

            getStore().store( second );

            Assert.assertFalse( getStore().retrieveAll().isEmpty() );

            Assert.assertEquals( 2, getStore().retrieveAll().size() );

            PathTrackingEntry third = new PathTrackingEntry( firstuuid, //
                                                             "nodeId", //
                                                             "org.au.beer.TheBest", //
                                                             "littlecreatures", //
                                                             new Date().getTime(), //
                                                             23, //
View Full Code Here

            Set<PathTrackingEntry> pathTrackingEntries = entries.get( trackingId );
            if ( pathTrackingEntries == null )
            {
                pathTrackingEntries = new TreeSet<PathTrackingEntry>();
            }
            pathTrackingEntries.add( new PathTrackingEntry( trackingId, //
                                                            nodeId, //
                                                            className, //
                                                            methodName, //
                                                            startTime, //
                                                            executionTime, //
View Full Code Here

                disruptor = new Disruptor<PathTrackingEntry>( new EventFactory<PathTrackingEntry>()
                {
                    @Override
                    public PathTrackingEntry newInstance()
                    {
                        return new PathTrackingEntry();
                    }
                }, ringBufferSize, exec, ProducerType.SINGLE, new BusySpinWaitStrategy()
                );

                for ( int i = 0; i < numberOfConsumers; i++ )
View Full Code Here

    }

    private void updatePathTracking(final Event event) {
        final Map<String, Object> data = event.getData();

        final PathTrackingEntry pathTrackingEntry =
            new PathTrackingEntryString.class.cast(data.get("trackingId")),//
                                    String.class.cast(data.get("nodeId")), //
                                    String.class.cast(data.get("className")), //
                                    String.class.cast(data.get("methodName")), //
                                    Number.class.cast(data.get("startTime")).longValue(), //
                                    Number.class.cast(data.get("executionTime")).longValue(), //
                                    Number.class.cast(data.get("level") ).intValue() );

        if (this.disableDisruptor) {
            pathTrackingDataStore.store( pathTrackingEntry );
        } else {
            ringBuffer.publishEvent( new EventTranslator<PathTrackingEntry>()
            {
                @Override
                public void translateTo( PathTrackingEntry event, long sequence )
                {
                    event.setClassName( pathTrackingEntry.getClassName() );
                    event.setExecutionTime( pathTrackingEntry.getExecutionTime() );
                    event.setLevel( pathTrackingEntry.getLevel() );
                    event.setMethodName( pathTrackingEntry.getMethodName() );
                    event.setNodeId( pathTrackingEntry.getNodeId() );
                    event.setStartTime( pathTrackingEntry.getStartTime() );
                    event.setTrackingId( pathTrackingEntry.getTrackingId() );
                }
            } );
        }
    }
View Full Code Here

    }


    private void updatePathTracking(final byte[] bytes) {

        final PathTrackingEntry pathTrackingEntry = SerializeUtils.deserialize( bytes, PathTrackingEntry.class );

        if (this.disableDisruptor)
        {
            pathTrackingDataStore.store( pathTrackingEntry );
        } else {
            ringBuffer.publishEvent( new EventTranslator<PathTrackingEntry>()
            {
                @Override
                public void translateTo( PathTrackingEntry event, long sequence )
                {
                    event.setClassName( pathTrackingEntry.getClassName() );
                    event.setExecutionTime( pathTrackingEntry.getExecutionTime() );
                    event.setLevel( pathTrackingEntry.getLevel() );
                    event.setMethodName( pathTrackingEntry.getMethodName() );
                    event.setNodeId( pathTrackingEntry.getNodeId() );
                    event.setStartTime( pathTrackingEntry.getStartTime() );
                    event.setTrackingId( pathTrackingEntry.getTrackingId() );
                }
            } );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.sirona.tracking.PathTrackingEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.