Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#7742] export trace info for agent-sdk #9175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yjqg6666
Copy link
Contributor

@yjqg6666 yjqg6666 commented Sep 10, 2022

Resolve issue #7742.
Related PR #6801.

Feature

Export txId & spanId to application via pinpoint agent sdk. Disabled by default. It can be enabled by pinpoint config profiler.export.trace.info=true or jvm property: -Dprofiler.export.trace.info=true.

Usage

If my application need to save/notify some system the txId/spanId, i could

  1. import com.navercorp.pinpoint:pinpoint-agent-sdk:2.5.0-SNAPSHOT as dependency.
<dependency>
   <groupId>com.navercorp.pinpoint</groupId>
   <artifactId>pinpoint-agent-sdk</artifactId>
   <version>2.5.0-SNAPSHOT</version>
</dependency>
  1. fetch the txId/spanId

TraceInfo traceInfo = TraceInfoHolder.getTraceInfo();
String altTxId = traceInfo.getTransactionId();
String txId = TraceInfoHolder.getTransactionId();
long spanId = TraceInfoHolder.getSpanId();

Scene

Get the transaction id and process it in a programming way(like saving to a persistent db).

Before this PR, we could only get the txId/spanId from slf4j.MDC in a hacky way.

@yjqg6666
Copy link
Contributor Author

yjqg6666 commented Sep 10, 2022

@codecov
Copy link

codecov bot commented Sep 13, 2022

Codecov Report

Merging #9175 (e7b1184) into master (d745085) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##             master    #9175      +/-   ##
============================================
- Coverage     39.84%   39.80%   -0.04%     
- Complexity    11748    11749       +1     
============================================
  Files          3361     3364       +3     
  Lines         90639    90705      +66     
  Branches      10085    10094       +9     
============================================
- Hits          36113    36107       -6     
- Misses        51445    51518      +73     
+ Partials       3081     3080       -1     
Impacted Files Coverage Δ
...otstrap/plugin/request/ServletRequestListener.java 0.00% <0.00%> (ø)
...ootstrap/plugin/request/util/ClassLoaderUtils.java 0.00% <0.00%> (ø)
...rap/plugin/request/util/TraceInfoExportHelper.java 0.00% <0.00%> (ø)
...p/pinpoint/rpc/stream/StreamChannelRepository.java 57.89% <0.00%> (-21.06%) ⬇️
...vercorp/pinpoint/rpc/packet/ClientClosePacket.java 46.66% <0.00%> (-6.67%) ⬇️
...rc/main/java/com/navercorp/pinpoint/test/Item.java 68.51% <0.00%> (-3.71%) ⬇️
...ollector/cluster/zookeeper/ZookeeperJobWorker.java 78.49% <0.00%> (-1.62%) ⬇️
...point/rpc/client/DefaultPinpointClientHandler.java 70.42% <0.00%> (-1.41%) ⬇️
...orp/pinpoint/rpc/server/DefaultPinpointServer.java 79.83% <0.00%> (-1.24%) ⬇️
...npoint/metric/web/mybatis/DataSourceDelegator.java 21.42% <0.00%> (ø)
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant