All Projects → husthuke → Trace4j

husthuke / Trace4j

基于注解的轻量级java流程跟踪工具

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Trace4j

Tracer
A powerful and customizable logging library for node.js
Stars: ✭ 1,081 (+257.95%)
Mutual labels:  logger, trace
logger
☠ 😈 👀 Simple,Secure & Undetected (6.11.2017) keylogger for Windows :)
Stars: ✭ 37 (-87.75%)
Mutual labels:  lightweight, logger
Easylogger
An ultra-lightweight(ROM<1.6K, RAM<0.3k), high-performance C/C++ log library. | 一款超轻量级(ROM<1.6K, RAM<0.3k)、高性能的 C/C++ 日志库
Stars: ✭ 1,968 (+551.66%)
Mutual labels:  lightweight, logger
ctrace-go
Canonical OpenTracing for GoLang
Stars: ✭ 12 (-96.03%)
Mutual labels:  logger, trace
QuickTraceiOSLogger
A real time iOS log trace tool, view iOS log with pc web browser under local area network, which will automatically scroll like xcode. 一个实时的iOS日志跟踪工具,在局域网中使用 PC Web 浏览器查看 iOS 日志,它将像xcode一样自动滚动。
Stars: ✭ 16 (-94.7%)
Mutual labels:  logger, trace
printer
A fancy logger yet lightweight, and configurable. 🖨
Stars: ✭ 65 (-78.48%)
Mutual labels:  logger, trace
Lightweight Segmentation
Lightweight models for real-time semantic segmentation(include mobilenetv1-v3, shufflenetv1-v2, igcv3, efficientnet).
Stars: ✭ 261 (-13.58%)
Mutual labels:  lightweight
Gopa
[WIP] GOPA, a spider written in Golang, for Elasticsearch. DEMO: http://index.elasticsearch.cn
Stars: ✭ 277 (-8.28%)
Mutual labels:  lightweight
Jupiter
Jupiter是斗鱼开源的面向服务治理的Golang微服务框架
Stars: ✭ 3,455 (+1044.04%)
Mutual labels:  trace
Metrics
Lightweight alternative to github.com/prometheus/client_golang
Stars: ✭ 254 (-15.89%)
Mutual labels:  lightweight
Stagesepx
detect stages in video automatically
Stars: ✭ 293 (-2.98%)
Mutual labels:  lightweight
Apilogger
Small laravel package for viewing api logs which can be used in debugging.
Stars: ✭ 285 (-5.63%)
Mutual labels:  logger
Infini Gateway
INFINI-GATEWAY(极限网关), a high performance and lightweight gateway written in golang, for elasticsearch and his friends.
Stars: ✭ 272 (-9.93%)
Mutual labels:  lightweight
Go Logger
Simple logger for Go programs. Allows custom formats for messages.
Stars: ✭ 261 (-13.58%)
Mutual labels:  logger
Tty Logger
A readable, structured and beautiful logging for the terminal
Stars: ✭ 280 (-7.28%)
Mutual labels:  logger
Tx
Tx (LINQ to Events)
Stars: ✭ 261 (-13.58%)
Mutual labels:  trace
Nestjs Pino
Platform agnostic logger for NestJS based on Pino with REQUEST CONTEXT IN EVERY LOG
Stars: ✭ 283 (-6.29%)
Mutual labels:  logger
Framework
Swoole, PSR-15, PSR-7, PSR-11 lightweight modular anti-framework for REST micro-services.
Stars: ✭ 259 (-14.24%)
Mutual labels:  lightweight
Hyperhtml
A Fast & Light Virtual DOM Alternative
Stars: ✭ 2,872 (+850.99%)
Mutual labels:  lightweight
Libwebsockets
canonical libwebsockets.org networking library
Stars: ✭ 3,314 (+997.35%)
Mutual labels:  lightweight

框架项目介绍

本框架项目为了解决中小型企业级java项目调用流程的性能追踪问题,提供便捷快速的调用流程追踪日志记录,同时可以记录每个调用函数的耗时。 对于采用executorServic开发的多线程程序同样可以进行追踪,能够加快排查线上多线程问题。 固然目前有比如Zipkin,Drapper这些分布式追踪系统,能够全面的追踪分布式系统的调用链路,但是对于中小型的企业项目搭建及维护成本过高。 地址:https://github.com/husthuke/trace4j

Qucik Start

在使需要开启追踪日志的项目中引用trace4j-core工程。

    <dependency>
        <groupId>com.hooke</groupId>
        <artifactId>trace4j-core</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

为需要进行日志追踪的方法增加如下注解

    @Trace(processName = "test",startStep = true)
    public void doSomeThing1(){
        System.out.println("doSomeThing1");
    }

结合spring aspect机制定义业务aop

     <!--Aspect的方式实现trace监测-->
     <bean id="traceAspect" class="com.hooke.trace.aop.spring.TraceAspect">
     </bean>

     <aop:config>
         <aop:pointcut id="tracePointcutAspect"
                       expression="execution(* com.hooke.biz..*(..))"/>
         <aop:aspect id="traceSpringAspect" ref="traceAspect">
             <aop:around
                     pointcut-ref="tracePointcutAspect"
                     method="trace"/>
         </aop:aspect>
     </aop:config>

追踪日志格式

    "threadId:" + 调用线程ID +
    " triceId:" + 追踪ID +
    " sessionId:" + 会话ID +
    " ProcessName:" + 追踪流程名称 +
    " ProcessStep:" + 追踪路程步骤 +
    " Joinpoint:" + aop连接点信息 +
    " argsJson:" + 方法入参信息 +
    " returnJson:" + 方法返回信息 +
    " cost:"+ 调用耗时 + " ms!"

运行结果示例:

1579 [main] INFO  c.h.trace.aop.spring.TraceAspect - threadId:1 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:1. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing1()) argsJson: returnJson: cost:882 ms!
1589 [main] INFO  c.h.trace.aop.spring.TraceAspect - threadId:1 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:2. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing1()) argsJson: returnJson: cost:0 ms!
1590 [main] INFO  c.h.trace.aop.spring.TraceAspect - threadId:1 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:3. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:1 ms!
1603 [main] INFO  c.h.trace.aop.spring.TraceAspect - threadId:1 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4. Joinpoint:execution(int com.hooke.biz.TraceTest.doSomeThing3(String)) argsJson:"testmethod3" returnJson:0 cost:13 ms!
1764 [Thread-3] INFO  c.h.trace.aop.spring.TraceAspect - threadId:14 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.2. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:1 ms!
1764 [Thread-1] INFO  c.h.trace.aop.spring.TraceAspect - threadId:12 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.3. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:15 ms!
1764 [Thread-2] INFO  c.h.trace.aop.spring.TraceAspect - threadId:13 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.1. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:15 ms!
1866 [Thread-4] INFO  c.h.trace.aop.spring.TraceAspect - threadId:15 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.4. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
1964 [Thread-5] INFO  c.h.trace.aop.spring.TraceAspect - threadId:16 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.5. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
2066 [Thread-6] INFO  c.h.trace.aop.spring.TraceAspect - threadId:17 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.6. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
2177 [Thread-7] INFO  c.h.trace.aop.spring.TraceAspect - threadId:18 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.7. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:1 ms!
2275 [Thread-8] INFO  c.h.trace.aop.spring.TraceAspect - threadId:19 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.8. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
2403 [Thread-9] INFO  c.h.trace.aop.spring.TraceAspect - threadId:20 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.9. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
2492 [Thread-10] INFO  c.h.trace.aop.spring.TraceAspect - threadId:21 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.10. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
2591 [Thread-11] INFO  c.h.trace.aop.spring.TraceAspect - threadId:22 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.11. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
2700 [Thread-12] INFO  c.h.trace.aop.spring.TraceAspect - threadId:23 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:4.12. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
2800 [main] INFO  c.h.trace.aop.spring.TraceAspect - threadId:1 triceId:887c67ff-7681-4fea-8e9f-e7d3838766f9 sessionId:null ProcessName:test ProcessStep:5. Joinpoint:execution(void com.hooke.biz.TraceTest.doSomeThing2()) argsJson: returnJson: cost:0 ms!
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].