I brief introduction
Skywalking is an open source observable platform for collecting, analyzing, aggregating and visualizing data from services and cloud native infrastructure. Support distributed tracking, performance index analysis, application and service dependency analysis, etc; It is a modern APM designed for cloud native, container based distributed systems.
Rainbow is an open-source cloud native application management platform, which is easy to use and does not need to understand containers and kubernetes. It supports the management of multiple kubernetes clusters and provides the full life cycle management of enterprise applications. Its functions include application development environment, application market, micro service architecture, continuous application delivery, application operation and maintenance, application level multi cloud management, etc.
The integration goal of this paper is to achieve the application running on rainband. By opening the skywalking plug-in of rainband, it can automatically connect to the skywalking server, flexibly open the APM, close the plug-in when it is not needed, and realize the plug and play APM.
II Integrated architecture
When skywalking monitors the service, the server needs to enable the agent service in the monitored service, and the skywalking agent needs to configure the startup command to the application. Although it does not invade the application code, the configuration process needs to invade the application. Rainbow realizes no intrusion to applications through plug-ins, and makes skywalking’s agent into rainbow’sInitialization type plug-in, copy the agent jar package to the application container before the application container starts. The application container can load the agent and connect to skywalking server. The whole process has no invasion to the application container and strong expansibility. Docking with other APMS can also be done in a similar way. Users can connect with different APM tools by replacing plug-ins.
The following figure shows the structure of application monitoring using skywalking in rainbow
III Implementation principle of agent plug-in
The rainbow plug-in system is a part of the rainbow application model. The plug-in is mainly used to realize the extended operation and maintenance capability of the application container. Because the implementation of operation and maintenance tools has great commonality, the plug-in itself can be reused. The plug-in must be bound to the application container before it has runtime status to realize an operation and maintenance capability, such as performance analysis plug-in, network governance plug-in and initialization type plug-in.
The running environment of plug-ins with runtime is consistent with the bound components in the following aspects:
- CyberspaceThis is a very important feature. Cyberspace consistency enables plug-ins to bypass, monitor and intercept component network traffic, and set component local domain name resolution.
- Storage persistence spaceThis feature enables file exchange between plug-ins and components through persistent directories.
- environment variableThis feature allows the plug-in to read the environment variables of the component.
During the integration of skywalking and rainbow, we usedInitialization typePlug in, as the name suggests, is a plug-in that can initialize before the application container starts. Its basic principle is to use kubernetesInit containerImplemented, pod can contain multiple containers in which applications run. At the same time, pod can also have one or more init containers that start before the application container. The application container will run only after the init container runs successfully. Components that have opened this type of plug-in in in rainbow will run the tasks defined in the plug-in before the application container starts until they are completed. Therefore, it only needs to be defined that before the application container is started, the initialization type container is used to copy the data required by the agent to the corresponding directory, so that subsequent services can directly use these data.
IV Install skywalking with one click from rainbow
We have made skywalking as an app and released it to the app market. Users can install it with one click based on the open source app store.
- Search skywalking in the open source app store and click Install to install with one click;
3. After installation, skywalking can be managed and operated through rainbow.
The skywalking server is divided into four parts in terms of Architecture: probe service, back-end service, storage service and UI:
- Platform backend (OAP server)Support data aggregation, analysis and stream processing, including tracking, indicators and logs.
- Storage (elasticsearch-7.13.4)Store skywalking data through an open / pluggable interface. Elasticsearch, H2, mysql, tidb and influxdb are supported.
- UI(skywalking-ui)Is a highly customizable web-based interface that allows skywalking end users to visualize and manage skywalking data.
- Probe (agent)Collect data and reformat the data according to skywalking requirements (different probes support different sources).
V Use skywalking to monitor microservices
Pre prepared environment
- Have a set of monitored services. The example application in this article isSpring cloud microservice framework pig, we haveSpring Cloud-pigMake it as an application and publish it to the application market. Users can install it with one click based on the application market.
Configure the service to support skywalking monitoring
- Deploy plug-ins
Click plug-in in the rainbow team interface to enter the plug-in interface. Click new plug-in to create an initialization type plug-in
After the plug-in is successfully built, it can be used. Open this plug-in for each component of pig service.
- Mount storage
Mount the storage for each component of the pig service and make it share the storage with the plug-in.
Mount path is
/tmp/agent, mount type isShared storage； The storage provides shared storage for the initialization plug-in and the component, and shares the same data.
- Add environment variable
Add environment variables for pig components.
|Variable value||brief introduction|
|-Dskywalking.agent.service_name=**||Service name displayed in skywalking UI|
|-Dskywalking.collector.backend_service=Host:Port||The access address of skywalking OAP server, which is used to receive skywalking trace data|
|-javaagent:/tmp/agent/skywalking-agent.jar||Specify the jar package address to be injected|
After adding environment variables, the update component will take effect.
- Establish dependencies
Establish the dependency between the components to be monitored and the skywalking OAP server service, so that they can connect to the OAP server through the address of 127.0.0.1. For the specific principle, please refer toInter service communication； Or open the external address of OAP server and fill in the address at the monitored end, so there is no need to establish a dependency.
Access the skywalking UI external port to enter the visualization interface.
- Service invocation topology
The rainband based plug-in mechanism is combined with skywalking, without changing the software running environment and adding logic to the project construction script, so as to realize the plug and play of skywalking capability. In addition, rainbow’s plug-in mechanism is open. It extends the application governance functions through the plug-in mechanism, such as network governance plug-ins, log collection plug-ins and data backup plug-ins. Without invading the original application logic, it can analyze the service performance through the network governance plug-ins and collect service logs through the log plug-ins, Connect with elk and other log collection systems; For database and other components, use the backup plug-in to back up the data.
RainbondIt is an open-source cloud native application management platform. It is easy to use and does not need to understand containers and kubernetes. It supports the management of multiple kubernetes clusters and provides full life cycle management of enterprise applications. Its functions include application development environment, application market, micro service architecture, continuous application delivery, application operation and maintenance, application level multi cloud management, etc.
Hundreds of enterprises have used rainbow to manage key business scenarios, covering more than a dozen industries such as manufacturing, energy, universities, public security, government, transportation, military industry and so on. Customers include BOE, yum China, AVIC, Zhonggong high tech and other large enterprises.