In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to achieve JAVA non-intrusive link tracing". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
one。 Invade the link tracking APM tool
Performance management (Application Performance Management,APM) means to monitor and optimize the key business of the enterprise, improve the reliability and quality of the enterprise, ensure that customers get good service, reduce the total operation and maintenance cost of IT, and bring more commercial benefits for the enterprise.
Introduction to Pinpoint
Pinpoint is an APM (Application performance Management) tool suitable for large distributed systems written in Java / PHP. Try to be simple and efficient in use. By installing agent at startup, there is no need to modify a single line of code to minimize performance loss (3%).
Advantages:
1) distributed transaction tracking, tracking messages across distributed applications
2) automatically detect the application topology to help you figure out the architecture of the application
3) scale horizontally to support large server clusters
4) provide code-level visibility to easily locate failure points and bottlenecks
5) use bytecode enhancement technology to add new features without modifying the code.
Main component
Component function Pinpoint-Collector collects all kinds of performance data Pinpoint-Agent probe is associated with the application server (such as tomcat), deployed to the same server Abase Storage collected data stored in HBase Pinpoint-Web will collect the data layer now web display II. Rapid deployment of pinpoint in Rainbond
Key installation based on Rainbond application marketplace.
This deployment method minimizes the difficulty and workload of deployment for complex multi-component applications like pinpoint.
Enter the UI interface of pinpoint through pinpoint-web application
In the default settings, the pinpoint application has monitored its own collector and web components. After entering the UI interface, you can find that they already exist in the application list.
three。 Add monitored objects
Insert agent during war startup
1) enter pinpoint-agent resources into the image beforehand
2) insert the startup key code:
# pinpoint-agent.sh# specify pinpoint-agent resource CATALINA_OPTS= "$CATALINA_OPTS-javaagent:$PINPOINT_AGENT_PATH/pinpoint-bootstrap-$ {PINPOINT_AGETN_VERSION}-SNAPSHOT.jar" # specify pinpoint-agent IDCATALINA_OPTS= "$CATALINA_OPTS-Dpinpoint.agentId=$ {AGENT_ID}" # specify the application name CATALINA_OPTS= "$CATALINA_OPTS-Dpinpoint.applicationName=$ {APP_NAME}" # docker-entrypoint.sh # determine whether pinpoint-agentif is enabled ["$ENABLE_APM" = = "true"] Then # collector address COLLECTOR_TCP_HOST=$ {COLLECTOR_TCP_HOST:-127.0.0.1} # TCP Port COLLECTOR_TCP_PORT=$ {COLLECTOR_TCP_PORT:-9994} COLLECTOR_UDP_SPAN_LISTEN_HOST=$ {COLLECTOR_UDP_SPAN_LISTEN_HOST:-127.0.0.1} COLLECTOR_UDP_SPAN_LISTEN_PORT=$#UDP Port {COLLECTOR_UDP_SPAN_LISTEN_PORT:-9996} COLLECTOR_UDP_STAT_LISTEN_ HOST=$ {COLLECTOR_UDP_STAT_LISTEN_HOST:-127.0.0.1} COLLECTOR_UDP_STAT_LISTEN_PORT=$#UDP port {COLLECTOR_UDP_STAT_LISTEN_PORT:-9995} # load agent sed-I "2a. / usr/local/tomcat/bin/pinpoint-agent.sh" / usr/local/tomcat/bin/catalina.sh # at startup and import it into the pinpoint-agent configuration file sed-I-r-e "s / (profiler.collector .ip) =. * /\ 1room$ {COLLECTOR_TCP_HOST} / "\-e" s / (profiler.collector.tcp.port) = .* /\ 1room$ {COLLECTOR_TCP_PORT} / "\-e" s / (profiler.collector.span.port) = .* /\ 1room$ {COLLECTOR_UDP_SPAN_LISTEN_PORT} / "\-e" s / (profiler.collector.stat.port) = .* /\ 1room$ {COLLECTOR_UDP_STAT_LISTEN_ PORT} / "/ usr/local/pinpoint-agent/pinpoint.config# default value Every application on the platform generates export APP_NAME=$ {APP_NAME:-$ {SERVICE_NAME:-$ {HOSTNAME}} # to distinguish the Agent-IDexport AGENT_ID=$ {APP_NAME}-${POD_IP} fi of each instance under a service by APP_NAME,POD_IP
Insert agent during jar startup
1) put pinpoint-agent resources into the source code repository in advance
2) start the script content:
#! / bin/bash# determines whether to start pinpoint agentif by specific environment variables [[$ENABLE_APM = = "true"]] Then AGENT_ID=$ {SERVICE_ID:0:10} PINPOINT_AGETN_VERSION=1.7.2 PINPOINT_AGENT_PATH=/app/pinpoint# adds pinpoint agent startup parameters to $JAVA_OPTS export JAVA_OPTS= "$JAVA_OPTS-javaagent:$ {PINPOINT_AGENT_PATH} / pinpoint-bootstrap-$ {PINPOINT_AGETN_VERSION}-SNAPSHOT.jar-Dpinpoint.agentId=$ {AGENT_ID:-$ {SERVICE_ID:0:10}}-Dpinpoint.applicationName=$ {APP_NAME:-$ {SERVICE_NAME: -$HOSTNAME}} "fiPORT=$ {PORT:-5000} sleep ${PAUSE:-0} # finally launches the command exec java-Dserver.port=$PORT $JAVA_OPTS-jar target/*.jar
Under the traditional architecture, pinpoint needs to attach Agent to the monitored object and make it effective by modifying the configuration file. On the cloud help platform, we have simplified these two steps accordingly.
The cloud help platform uses the way of setting environment variables instead of configuration files, and the key value pair is very easy to use in the form of environment variables.
Add Pinpoint monitoring object practice
Method one
Take todoapi as an example to introduce the method of adding monitored objects.
Associate Pinpoint-Collector
View connection information
Visit Pinpoint-Web to view:
For deployed applications, you can also configure the corresponding service dependencies and environment variables through the dependencies and settings tabs in the application management interface.
Method two
When Pinpoint-Collector external service is enabled, the platform gateway will define a layer of port mapping relationship.
Check the value of the todoshow variable, check whether the port number is correct, and activate the switch of agent
Visit Pinpoint-Web to see that todoshow has appeared on the interface.
Real-time push in Pinpoint-Web uses the Websocket protocol, but we use the http protocol when accessing Pinpoint-Web applications. Therefore, we cannot receive push in real time. You need to find the Pinpoint-Web application in the application gateway-> access control in the platform, and click parameter configuration to open the Websocket protocol support.
This is the end of the content of "how to achieve JAVA non-intrusive Link tracing". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.