Skip to content

Commit 092a4f0

Browse files
authored
Merge pull request #338 from scouter-project/develop
documentation of plugin guide
2 parents 2ae8917 + c2d27fa commit 092a4f0

File tree

1 file changed

+67
-53
lines changed

1 file changed

+67
-53
lines changed

scouter.document/main/Plugin-Guide.md

Lines changed: 67 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33

44
This article explains plugin funtion which enables scouter's extensibility.
55

6-
With the plugin fuction of Scouter collector sever, data collected by scouter can be modified and can be shared to other softwares. With agent plugin, certain types of data can be modified (선 처리의 개념이 모호하여 modifed 로 번역 하였으나 의미에 따라 pre-handled 등으로 변경 해야 할 수 도 있음.) and other business-meaningful data can be added data to XLog or profile.
6+
With the plugin fuction of Scouter collector sever, data collected by scouter can be pre-handled and can be shared to other softwares.
7+
With agent plugin, certain types of data can be modified and other business-meaningful data can be added data to XLog or profile.
78

8-
> With Scouter plugin, configuration and extension can be done to enable collarboaration with other open source.
9+
> With Scouter plugin, configuration and extension can be done to enable collaboration with other open source.
910
10-
Scouter's profiles has two parts. **server plug-in** is for to collector server and **agent Plugin** is for to Java agent. server plugin has two parts including **scripting plugin** and **built-in plugin**.
11-
Currently, scripting plugin is only one available plugin for java agent.
11+
Scouter has 2 type of plugins - server plugin and an agent plugin.
12+
**server plug-in** is for to collector server
13+
and **agent Plugin** is for to Java agent.
14+
Server plugin has 2 type plugins including **scripting plugin**, **built-in-type plugin**.
1215

1316
## List of available plugins
1417
Below are the list of official plugins from scouter project and from contributors.
1518

16-
#### 1. server plugins
19+
#### 1. server plugins (built-in type)
1720
* **[scouter-plugin-server-null](https://github.com/scouter-project/scouter-plugin-server-null)** : sample plugin prints out data collected
1821
* **[scouter-plugin-server-email](https://github.com/scouter-project/scouter-plugin-server-alert-email)** : emails alters from Scouter
1922
* **[scouter-plugin-server-telegram](https://github.com/scouter-project/scouter-plugin-server-alert-telegram)** : transfer altert from Scouter to telegram
@@ -23,35 +26,49 @@ Below are the list of official plugins from scouter project and from contributor
2326
#### 2. agent plugins
2427
* TBD
2528

26-
## Server Plugin 설명
27-
**Scripting plugin은 코드 변경이 동적으로 load 및 compile되어 runtime에 즉시 반영되므로 debugging등에도 활용될 수 있다.**
29+
## Server Plugin - How to
2830

2931
### 1. Scripting Plugin
30-
Scripting plugin은 scouter DB에 수집데이터가 저장되기전 호출된다.
31-
간단히 java 문법을 사용한 script를 사용하여 처리가 가능하며 특별한 옵션을 지정하지 않은 경우는 server를 실행한 directory의 **./plugin** 디렉토리에 plugin 파일을 작성할 수 있다.
32-
Scouter의 설치본에는 이에 대한 샘플이 포함되어 있으며 해당 파일명으로 로드되므로 파일명을 수정할 수는 없다.
33-
현재 제공되는 server plugin은 7가지 종류이며 각 파일명은 아래와 같다.
34-
* **alert.plug** - alert에 대한 전처리 plugin
35-
* **counter.plug** - 성능카운터 정보에 대한 전처리 plugin
36-
* **object.plug** - object 정보에 대한 전처리 plugin
37-
* **summary.plug** - 성능 summary 정보에 대한 전처리 plugin
38-
* **xlog.plug** - xlog data에 대한 전처리 plugin
39-
* **xlogdb.plug** - xlog를 db에 저장히기 직전 상태에 호출되는 plugin
40-
* **xlogprofile.plug** - 상세 profile 정보에 대한 전처리 plugin
41-
42-
이에 대한 상세 내용은 **[Scripting plugin Server API 설명 페이지](Server-Plugin-Scripting.md)**를 참고한다.
32+
A scripting plugin is called right before xlog data is stored in a repository.
33+
You can add simple script for manipulate some data on the plugin files which are located in the directory **[server_runnig_dir]/plugin** by default.
34+
35+
Scouter distribution has the samples and the file name can not be modified.
36+
Currently 6 types of scripting plugins are supported.
37+
* **alert.plug** - for pre-handling alert
38+
* **counter.plug** - for pre-handling performance metrics(counters)
39+
* **object.plug** - for pre-handling moitoring objects(instnats)
40+
* **summary.plug** - for pre-handling performance summary data
41+
* **xlog.plug** - for pre-handling xlog data
42+
* **xlogprofile.plug** - for pre-handling xlog profile
43+
44+
refer to the link for details.
45+
**[Scripting plugin Server API](Server-Plugin-Scripting.md)**를 참고한다.
4346

4447
### 2. Built-in Plugin
45-
Scripting plugin은 간편하게 작성하고 바로 반영해 볼 수 있다는 장점이 있는 반면 영구적으로 사용해야 하는 Plugin이 필요한 경우는 오히려 쉽게 수정 가능한 text 파일 형태로 유지하는 것이 불편할 수 도 있다.
46-
이를 위해 특정한 방식으로 미리 제작해 놓은 plugin을 삽입할 수 있는 방식을 제공하며 이를 **Built-in Plugin**이라고 부른다.
47-
Scouter에서 미리 제공하는 **annotation**을 사용하여 개발한 후 해당 library를 scouter server의 library 경로에 넣어 놓기만 하면 자동으로 로딩되어 실행된다.
48-
(기본 설정으로는 **./lib** 디렉토리이며 동적로딩이 되지 않으므로 library 변경시 재시작이 필요하다.)
48+
Builing scripting plugin is very simple and can be dynamically loaded on runtime environment.
49+
On the other hand if you need the function permanently, it's too easy to fragile.
50+
So scouter provides another plugin type which allow you can attach pre-built compiled plugin and it's called as **Built-in Plugin**.
4951

50-
#### 2.1 Server Built-in Plugin 개발 가이드
52+
Scouter load the plugins on startup, if the plugins are located in scouter server's library directory.(default:**[server_runnig_dir]/lib**)
53+
54+
#### 2.1 Server Built-in Plugin development guide
5155
##### 1. dependecny
5256
* scouter.common
57+
```xml
58+
<dependency>
59+
<groupId>io.github.scouter-project</groupId>
60+
<artifactId>scouter-common</artifactId>
61+
<version>1.7.0</version>
62+
</dependency>
63+
```
5364
* scouter.server
54-
65+
```xml
66+
<dependency>
67+
<groupId>io.github.scouter-project</groupId>
68+
<artifactId>scouter-server</artifactId>
69+
<version>1.7.0</version>
70+
</dependency>
71+
```
5572
##### 2. Annotation
5673
```scouter.lang.plugin.annotation.ServerPlugin ```
5774

@@ -69,42 +86,39 @@ public class NullPlugin {
6986
}
7087
```
7188

72-
Plugin 개발시 아래 두가지 사항을 준수하여야 한다.
73-
> 1. Annotation scan은 scouter.plugin.server 패키지 하위에서 수행하므로 **scouter.plugin.server** 하위에 작성되어야 한다.
74-
> 2. Scouter server의 configuration을 이용할 수 있으며 이때 **ext_plugin_xxx** 로 시작되어야 한다.
89+
* Check it.
90+
> 1. The file is located sub package of **scouter.plugin.server** because annotation scan scope is from scouter.plugin.server package.
91+
> 2. The plugin can use scouter server's configuration and the option name must start with **ext_plugin_xxx**.
7592
76-
```ServerPlugin``` annotation에 들어가는 value는 아래와 같이 6가지를 제공하며 기본값은 ```PLUGIN_SERVER_COUNTER```이다.
93+
* ```ServerPlugin``` annotations
7794

78-
* **```PLUGIN_SERVER_COUNTER```**
79-
* **```PLUGIN_SERVER_ALERT```**
80-
* **```PLUGIN_SERVER_OBJECT```**
81-
* **```PLUGIN_SERVER_SUMMARY```**
82-
* **```PLUGIN_SERVER_XLOG```**
83-
* **```PLUGIN_SERVER_PROFILE```**
95+
* **```PLUGIN_SERVER_COUNTER```**
96+
* **```PLUGIN_SERVER_ALERT```**
97+
* **```PLUGIN_SERVER_OBJECT```**
98+
* **```PLUGIN_SERVER_SUMMARY```**
99+
* **```PLUGIN_SERVER_XLOG```**
100+
* **```PLUGIN_SERVER_PROFILE```**
84101

85102
#### 3. Sample plugin
86-
단순히 수집된 데이터를 출력하는 간단한 plugin 샘플을 제공한다.
103+
Provided sample plugin that just prints the data collected.
87104
* Sample plugin : [https://github.com/scouter-project/scouter-plugin-server-null](https://github.com/scouter-project/scouter-plugin-server-null)
88105
* Download : [scouter-plugin-server-null.jar](https://github.com/scouter-project/scouter-plugin-server-null/releases/download/v1.0/scouter-plugin-server-null.jar)
89106

90107

91-
## Agent Plugin 설명 - Scripting Plugin
108+
## Agent Plugin - Scripting Plugin
92109

93110
#### Java agent plugin
94-
**Scripting Plugin은 코드 변경이 동적으로 LoadCompile되어 Runtime에 즉시 반영되므로 Debugging등에도 활용될 수 있다.**
95-
특히 특정 method의 파라미터 정보를 확인하거나 해당 위치에서 StackTrace를 유발시켜 호출 경로를 확인해 본다던지 다양한 방식으로 활용이 가능하다.
96-
97-
Scripting Pluging은 응용 어플리케이션의 중요한 몇가지 point에서 각 plugin이 호출이 된다.
98-
간단히 Java 문법을 사용한 Script를 사용하여 처리가 가능하며 특별한 옵션을 지정하지 않은 경우는 **./plugin** 디렉토리에 plugin 파일을 작성할 수 있다.
99-
Scouter의 설치본에는 이에 대한 샘플이 포함되어 있으며 해당 파일명으로 로드되므로 파일명을 수정할 수는 없다.
100-
현재 제공되는 server plugin은 5가지 종류이며 각 파일명은 아래와 같다.
101-
102-
|파일명 | 설명 |
111+
**Scripting plugin can be loaded dynamically on runtime so it is used for debugging also**
112+
It's very useful to print some method's parameters or stacktrace on specific point and also can add additional (user-defined) profile information to the xlog or xlog profile.
113+
The scripting plugin is invoked at some important points and the default location of the plugin file is **./plugin**.
114+
Scouter distribution includes sample plugin files and the file name can not be modified.
115+
116+
|filename | desc |
103117
|-------------------|-------------------------|
104-
|**httpservice.plug** | Http Service 시작점, Http Service이 종료시점에 호출됨. 특정 Service는 사용자가 정의한 조건에 따라 reject할 수 있는 기능을 제공 |
105-
|**service.plug** | Service의 시작점, 종료 시점에 호출됨 (```hook_service_patterns```를 통해 설정된 서비스가 대상이 됨) |
106-
|**httpcall.plug** | HttpClient등을 통해 http call을 사용하는 시점에 호출됨 |
107-
|**capture.plug** | ```hook_method_patterns``````hook_constructor_patterns```등을 통해 설정됨 method에 대해 해당 method의 시작 시점, 종료시점, Constructor 생성 시점에 호출됨 |
108-
|**jdbcpoolplug** | DB connection URL 요청 시점에 호출됨 |
118+
|**httpservice.plug** | Invoked at begin and end of http service. |
119+
|**service.plug** | Invoked at begin and end of user defined service. (The services are set by ```hook_service_patterns``` option) |
120+
|**httpcall.plug** | Invoked at calling to another service using httpclients library |
121+
|**capture.plug** | Invoked at init, start, end of methods that are set by options ```hook_method_patterns``` or ```hook_constructor_patterns``` |
122+
|**jdbcpoolplug** | Invoked at calling DB connection URL |
109123

110-
이에 대한 상세 내용은 **[Scripting plugin java agent API 설명 페이지](JavaAgent-Plugin-Scripting.md)**를 참고한다.
124+
Refer to the link for details **[Scripting plugin java agent API](JavaAgent-Plugin-Scripting.md)**를 참고한다.

0 commit comments

Comments
 (0)