All Projects → libinglong → skywalking-threadpool-agent

libinglong / skywalking-threadpool-agent

Licence: Apache-2.0 license
This project is designed to make it possible to propagate SkyWalking context without changing user's code when using threadpool.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to skywalking-threadpool-agent

skywalking-banyandb
An observability database aims to ingest, analyze and store Metrics, Tracing and Logging data.
Stars: ✭ 111 (+428.57%)
Mutual labels:  skywalking
mix-agent
基于rust语言开发的一套运维监控探针,支持widnows、linux、macos系统
Stars: ✭ 14 (-33.33%)
Mutual labels:  agent
GYM XPLANE ML
GYM Environment for XPlane. Reinforcement Learning and Autonomous Piloting.
Stars: ✭ 45 (+114.29%)
Mutual labels:  agent
thread-pool
A modern thread pool implementation based on C++20
Stars: ✭ 104 (+395.24%)
Mutual labels:  threadpool
YggdrasilOfficialProxy
MojangYggdrasil的更新! 以代理的方式提供伪正版与正版的实现
Stars: ✭ 89 (+323.81%)
Mutual labels:  agent
go2sky-plugins
The plugins of go2sky
Stars: ✭ 46 (+119.05%)
Mutual labels:  skywalking
skywalking-client-js
Client-side JavaScript exception and tracing library for Apache SkyWalking APM.
Stars: ✭ 171 (+714.29%)
Mutual labels:  skywalking
atomicagent
💥 Atomic Agent
Stars: ✭ 18 (-14.29%)
Mutual labels:  agent
evoplex
Evoplex is a fast, robust and extensible platform for developing agent-based models and multi-agent systems on networks. It's available for Windows, Linux and macOS.
Stars: ✭ 98 (+366.67%)
Mutual labels:  agent
re-gent
A Distributed Clojure agent for running remote functions
Stars: ✭ 18 (-14.29%)
Mutual labels:  agent
OneAgent-SDK-for-Java
Enables custom tracing of Java applications in Dynatrace
Stars: ✭ 24 (+14.29%)
Mutual labels:  agent
Loki.Rat
Loki.Rat is a fork of the Ares RAT, it integrates new modules, like recording , lockscreen , and locate options. Loki.Rat is a Python Remote Access Tool.
Stars: ✭ 63 (+200%)
Mutual labels:  agent
skywalking-swck
Apache SkyWalking Cloud on Kubernetes
Stars: ✭ 62 (+195.24%)
Mutual labels:  skywalking
skywalking-query-protocol
Query Protocol for Apache SkyWalking in GraphQL format
Stars: ✭ 45 (+114.29%)
Mutual labels:  skywalking
mps
MPS is a high-performance HTTP(S) proxy library that supports forward proxies, reverse proxies, man-in-the-middle proxies, tunnel proxies, Websocket proxies. MPS 是一个高性能HTTP(s)中间代理库,它支持正向代理、反向代理、中间人代理、隧道代理、Websocket代理
Stars: ✭ 64 (+204.76%)
Mutual labels:  agent
metrics-agent
JVM agent based metrics with Prometheus and Dropwizard support (Java, Scala, Clojure, Kotlin, etc)
Stars: ✭ 25 (+19.05%)
Mutual labels:  agent
tat-agent
TAT agent is an agent written in Rust, which run in CVM, Lighthouse or CPM 2.0 instances. Its role is to run commands remotely without ssh login, invoked from TencentCloud Console/API. Commands include but not limited to: Shell, PowerShell, Python. TAT stands for TencentCloud Automation Tools. See more info at https://cloud.tencent.com/product/tat.
Stars: ✭ 79 (+276.19%)
Mutual labels:  agent
commonpp
Small library helping you with basic stuff like getting metrics out of your code, thread naming, etc.
Stars: ✭ 29 (+38.1%)
Mutual labels:  threadpool
sys-agent
System agent. Reports server status via HTTP API
Stars: ✭ 32 (+52.38%)
Mutual labels:  agent
ws-ldn-10
Generative design workshop (Clojure/ClojureScript)
Stars: ✭ 26 (+23.81%)
Mutual labels:  agent

skywalking-threadpool-agent

This project is designed to make it possible to propagate SkyWalking context without changing user's code when using threadpool.

If the project helps you, please star it!

How to propagate

To propagate context between threads, we may want to enhance Runnable first, but it's not good since Runnable is not only used in threads.So applying advice of ThreadPoolExecutor#execute to wrap the Runnable param is a good choice.However, it's hard to do it.The java agent of SkyWalking usually add a field and implement interface EnhancedInstance when it enhances classes. It fails when the class of the enhanced instance has been loaded because most JVMs do not allow changes in the class file format for classes that have been loaded previously.ThreadPoolExecutor is a special class in the bootstrap class path and may be loaded at any code. Fortunately we don't need to change the layout of ThreadPoolExecutor if we just want to wrap the Runnable param. So let's write another agent to do this.

You can not enhance the instance if the class of it has already been loaded.

How to wrap the Runnable param?

Note the ThreadPoolExecutor is a bootstrap class. We must inject the wrap class, such as your.own.RunnableWrapper into bootstrap classloader.Then you should write a SkyWalking plugin to enhance your.own.RunnableWrapper. There is already a RunnableWrapper, org.apache.skywalking.apm.toolkit.trace.RunnableWrapper, but it's hard to use it.

This RunnableWrapper has a plugin whose active condition is checking if there is @TraceCrossThread. Byte buddy in SkyWalking will use net.bytebuddy.pool.TypePool.Default.WithLazyResolution.LazyTypeDescription to find the annotations of a class. The LazyTypeDescription finds annotations by using a URLClassLoader with no urls if the classloader is null(bootstrap classloader). So it can not find the @TraceCrossThread class unless you change the LocationStrategy of SkyWalking java agent.

In this project, I write my own wrapper class, and simply add a plugin with a name match condition.

How to use

Download the assets from Release.

  • Move this plugin to the "plugins" directory of SkyWalking agent. plugin plugin

  • In jvm options, you should add this agent after the SkyWalking java agent since the wrapper class should be enhanced by SkyWalking java agent. For example,

    java -javaagent:/path/to/skywalking-agent.jar -javaagent:/path/to/skywalking-tool-agent-v1.0.0.jar ...

    agent.png

Release

  • compatibility sheet
Tool agent SkyWalking agent
1.0.0 7.0.0
8.4.0
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].