GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - tmtbe/PVisualization: 无侵入可视化性能分析工具

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
source
source
 
 
src
src
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

PVisual

性能可视化分析器,可配合Zipkin或者Jaeger实现性能可视化展示。 img.png

  • 采用无侵入模式,支持agent和attach
  • 可快速二次快速开发,实现自主业务关键点追踪
  • 融合TTL支持线程间依赖维护,自动维护跨线程上下文传递 https://github.com/alibaba/transmittable-thread-local
  • 基于魔改版jvm-sandbox https://github.com/tmtbe/jvm-sandbox

开发示例

  • 同步场景的开发示例
public class HttpServletWatch extends PWatch {
    protected Method getMethod;

    public HttpServletWatch() throws PTraceException {
    }

    @Override
    protected WatchConfig createWatchConfig() {
        return WatchConfig.builder()
                .canCreateTrace(true)
                .serviceName("Servlet")
                .className("javax.servlet.http.HttpServlet")
                .behaviorName("service")
                .patternType(EventWatchBuilder.PatternType.REGEX)
                .buildingForBehavior((t) -> t.withAccess(Modifier.PROTECTED)
                        .withParameterTypes("javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse"))
                .buildingForClass((t) -> {
                })
                .build();
    }

    @Override
    protected void checking(ClassLoader classLoader) throws Throwable {
        Class<?> httpServletRequestClass = getBusinessClass("javax.servlet.http.HttpServletRequest", classLoader);
        getMethod = httpServletRequestClass.getDeclaredMethod("getMethod");
    }


    @Override
    protected void before(Advice advice) throws Throwable {
        startSpan(advice, span -> {
            span.kind(Span.Kind.SERVER);
            span.name((String) getMethod.invoke(advice.getParameterArray()[0]));
            addStackTrace(span);
        });
    }
}

这是一个Http Servlet的监控,可以看到开发起来非常简单,只需要描述追踪的目标和增加追踪的数据即可。

  • 异步场景的开发示例
public class NettyHttpWatch extends PWatch {
    public NettyHttpWatch() throws PTraceException {
    }

    @Override
    protected WatchConfig createWatchConfig() {
        return WatchConfig.builder()
                .serviceName("netty")
                .className("reactor.netty.ConnectionObserver")
                .behaviorName("onStateChange")
                .canCreateTrace(true)
                .build();
    }

    @Override
    protected void checking(ClassLoader classLoader) throws Throwable {

    }

    @Override
    protected void before(Advice advice) throws Throwable {
        Connection connection = (Connection) advice.getParameterArray()[0];
        ConnectionObserver.State newState = (ConnectionObserver.State) advice.getParameterArray()[1];
        if (newState == HttpServerState.REQUEST_RECEIVED) {
            startSpanWithAsync(advice, connection, null);
        } else if (newState == HttpServerState.DISCONNECTING) {
            finishSpanWithAsync(advice, connection, null);
        }
    }

    @Override
    protected void after(Advice advice) throws Throwable {

    }
}

这是Netty的Http监控。

  • WebFlux的支持

查看SubscriberInitWatch和SubscriberOnNextWatch例子。

About

无侵入可视化性能分析工具

Resources

Readme
Activity

Stars

9 stars

Watchers

3 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.