## 1. Project Overview & Quickstart (pinpoint-apm/uri_statistics)

# uri_statistics

Open-source repository pinpoint-apm/uri_statistics

### Repository Details
- **Repository:** [pinpoint-apm/uri_statistics](https://github.com/pinpoint-apm/uri_statistics)
- **Primary Language:** Code

*Note: High-volume repository documentation is actively indexed and synchronized by YakaAI.*

## 2. Official Technical Reference & Guides (pinpoint-apm/pinpoint-apm.github.io)

## File: README.md

# Introduction

[](https://github.com/pinpoint-apm/pinpoint/actions?query=workflow%3AMaven)
[](https://codecov.io/gh/pinpoint-apm/pinpoint)

**Pinpoint** is an APM \(Application Performance Management\) tool for large-scale distributed systems written in Java / [PHP](https://github.com/pinpoint-apm/pinpoint-c-agent). Inspired by [Dapper](http://research.google.com/pubs/pub36356.html), Pinpoint provides a solution to help analyze the overall structure of the system and how components within them are interconnected by tracing transactions across distributed applications.

You should definitely check **Pinpoint** out If you want to

* understand your [application topology](want-a-quick-tour/overview.md) at a glance
* monitor your application in _Real-Time_
* gain code-level visibility to every transaction
* install APM Agents without changing a single line of code
* have minimal impact on the performance \(approximately 3% increase in resource usage\)



## Live Demo

* [demo](http://211.233.216.67:8080/serviceMap/shop-front) - Here is a Demo, So that you can take a look at Pinpoint right away.

## Want a quick tour?

* [Overview](want-a-quick-tour/overview.md) / [History](want-a-quick-tour/history.md) / [Tech Details](want-a-quick-tour/techdetail.md) to get to know more about Pinpoint
* [Videos](want-a-quick-tour/videos.md) - Checkout our videos on Pinpoint

{% embed url="https://youtu.be/U4EwnB34Dus" %}

## Getting Started

* [Quick-start guide\(Lastest Snapshot\)](getting-started/quickstart/) for simple test run of Pinpoint
* [Installation guide\(Lastest Snapshot\)](getting-started/installation.md) for further instructions.

## Google Analytics

The web module has google analytics attached that tracks the number and the order of button clicks in the server map, transaction list, and the inspector view.

This data is used to better understand how users interact with the Web UI which gives us valuable information in improving Pinpoint Web's user experience. To disable this for any reason, set the following option to false in _pinpoint-web.properties_ for your web instance.

```text
config.sendUsage=false
```

## Is your application created with PHP?

Pinpoint has started to support application written in PHP. [Check-out our php-agent repository](https://github.com/pinpoint-apm/pinpoint-c-agent).

## Looking for place to ask questions?

[Questions and FAQ](faq.md)

## License

Pinpoint is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/pinpoint-apm/pinpoint/blob/master/LICENSE) for full license text.

```text
Copyright 2019 NAVER Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

---

## File: AGENTS.md

# AGENTS.md — pinpoint-apm.github.io

Personal, uncommitted instructions go in `~/.claude/CLAUDE.md` or `~/.claude/skills`. A `CLAUDE.local.md` anywhere in the tree stops Claude Code from reading this file.

## Testing

- The docs are published by GitBook from this repo. Check documentation changes in the GitBook preview of the branch.
- Changes to `.github/actions/publish-gitbook-docs` need tests in its `__test__/` directory. Run `npm ci` and then `npm test` in that directory.

## Workflow

1. **Issue**: create a GitHub issue in `pinpoint-apm/pinpoint-apm.github.io` (`gh issue create`) if none exists, with the milestone of the next release. The body opens with one or two sentences on what to do, then a task checklist. Under each task, its verification as `input → expected result` bullets that run locally. Reference links go last.
2. **Branch**: create a feature branch from `upstream/main`.
3. **Code changes**: implement the feature or fix.
4. **Testing**: add or update tests, then run them. While they run, show the developer the PR draft (title, body, milestone).
5. **Review**: stop and wait for the developer to review the diff. Do not proceed until they explicitly approve.
6. **Commit and push**: squash into a single commit (`git commit`, not amend) and push the branch. Message: `[#ISSUE_NUMBER] Short description`, the title line only.
7. **PR**: create it with `gh pr create`. Same milestone as the issue; `Closes #ISSUE_NUMBER` in the body.
8. **After merge**: `git fetch upstream` → `git checkout main` → `git rebase upstream/main` → `git push origin main` → delete the feature branch locally and remotely. Tick the issue checklist and reflect any scope change.

## Writing

Issues, PRs, commits and comments are in English, concise, bullet points, no emojis. Post once the draft is approved.

- PR: the title names the main change. The body opens with why the change was made, in one or two sentences, then `## Test plan` with the checked results and `Closes #N`. No other headers.

---

## File: faq.md

---
title: FAQ
sidebar: mydoc_sidebar
keywords: 'faq, question, answer, frequently asked questions, FAQ, question and answer'
last_updated: 'Feb 1, 2018'
permalink: faq.html
toc: false
disqus: false
---

# FAQ

[Github issues](https://github.com/pinpoint-apm/pinpoint/issues)  
[Google group](https://groups.google.com/forum/#!forum/pinpoint_user)  
[Gitter](https://gitter.im/naver/pinpoint)

Chinese groups

| QQ Group: 897594820 | DING Group |
| :---: | :---: |
|  |  |

## How do I get the call stack view?

Click on a server node, which will populate the scatter chart on the right. This chart shows all succeeded/failed requests that went through the server. If there are any requests that spike your interest, simply **drag on the scatter chart** to select them. This will bring up the call stack view containing the requests you've selected.

## How do I change agent's log level?

You can change the log level by modifying the agent's _log4j.xml_ located in _PINPOINT\_AGENT/lib_ directory.

## Why is only the first/some of the requests traced?

There is a sampling rate option in the agent's pinpoint.config file \(profiler.sampling.rate\). Pinpoint agent samples 1 trace every N transactions if this value was set as N. Changing this value to 1 will allow you to trace every transaction.

## Request count in the Scatter Chart is different from the ones in Response Summary chart. Why is this?

The Scatter Chart data have a second granularity, so the requests counted here can be differentiated by a second interval. On the other hand, the Server Map, Response Summary, and Load Chart data are stored in a minute granularity \(the collector aggregates these in memory and flushes them every minute due to performance reasons\). For example, if the data is queried from 10:00:30 to 10:05:30, the Scatter Chart will show the requests counted between 10:00:30 and 10:05:30, whereas the server map, response summary, and load chart will show the requests counted between 10:00:00 and 10:05:59.

## How do I delete application name and/or agent id from HBase?

Application names and agent ids, once registered, stay in HBase until their TTL expires \(default 1year\). You may however delete them proactively using [admin APIs](https://github.com/pinpoint-apm/pinpoint/blob/master/web/src/main/java/com/navercorp/pinpoint/web/controller/AdminController.java) once they are no longer used.

* Remove application name - `/admin/removeApplicationName.pinpoint?applicationName=$APPLICATION_NAME&password=$PASSWORD`
* Remove agent id - `/admin/removeAgentId.pinpoint?applicationName=$APPLICATION_NAME&agentId=$AGENT_ID&password=$PASSWORD`

  Note that the value for the password parameter is what you defined `admin.password` property in _pinpoint-web.properties_. Since 4.0.1, the admin APIs are disabled until you set `admin.password`. Before 4.0.1, leaving this blank allowed you to call admin APIs without the password parameter.

  If another module authorizes the admin APIs, set `admin.password.enabled=false` to skip the password check. See [pinpoint-web](https://github.com/pinpoint-apm/pinpoint/tree/master/web#admin-api).

## What are the criteria for the application name?

Pinpoint's applicationName doesn't support special characters. such as @,\#,$,%,\*. Pinpoint's applicationName only supports \[a-zA-Z0-9\], '.', '-', '\_' characters.

## HBase is taking up too much space, which data should I delete first?

Hbase is very scalable so you can always add more region servers if you're running out of space. Shortening the TTL values, especially for **AgentStatV2** and **TraceV2**, can also help \(though you might have to wait for a major compaction before space is reclaimed\). For details on how to major compact, please refer to [this](https://github.com/pinpoint-apm/pinpoint/blob/master/hbase/scripts/hbase-major-compact-htable.hbase) script.

However, if you **must** make space asap, data in **AgentStatV2** and **TraceV2** tables are probably the safest to delete. You will lose agent statistic data \(inspector view\) and call stack data \(transaction view\), but deleting these will not break anything.

Note that deleting **\*MetaData** tables will result in _\*-METADATA-NOT-FOUND_ being displayed in the call stack and the only way to "fix" this is to restart all the agents, so it is generally a good idea to leave these tables alone.

## My custom jar application is not being traced. Help!

Pinpoint Agent need an entry point to start off a new trace for a transaction. This is usually done by various WAS plugins \(such as Tomcat, Jetty, etc\) in which a new trace is started when they receive an RPC request. For custom jar applications, you need to set this manually as the Agent does not have knowledge of when and where to start a trace. You can set this by configuring `profiler.entrypoint` in _pinpoint.config_ file.

## Building is failing after new release. Help!

Please remember to run the command `./mvnw clean verify -DskipTests=true` if you've used a previous version before, and replace './mvnw' with './mvnw.cmd' if you are using Windows.

## How to set java runtime option when using atlassian OSGi

`-Datlassian.org.osgi.framework.bootdelegation=sun.,com.sun.,com.navercorp.*,org.apache.xerces.*`

## Why do I see UI send requests to [https://www.google-analytics.com/collect?](https://www.google-analytics.com/collect?)

Pinpoint Web module has google analytics attached which tracks the number and the order of button clicks in the Server Map, Transaction List, and the Inspector View.  
This data is used to better understand how users interact with the Web UI which gives us valuable information on improving Pinpoint Web's user experience. To disable this for any reason, set following option to false in pinpoint-web.properties for your web instance.

```text
config.sendUsage=false
```

## I'd like to use Hbase 2.x for Pinpoint.

If you'd like to use Hbase 2.x for Pinpoint database, check out [Hbase2-module](https://github.com/pinpoint-apm/pinpoint/tree/master/hbase2-module).

---

## File: main.md

# What's New in v4.0.1
## Improvements  
**[Agent]** Enhanced Reactor tracing — propagate unsampled traces across publishOn, subscribeOn, delay, and interval (#14604)  
**[Agent]** Propagate unsampled traces across Reactor subscribe and retry (#14594)  
**[Agent]** Propagate unsampled traces across coroutine dispatch (#14592)  
**[Agent]** Added user-supplied URI template support for URI stat in the Jetty plugins (#14546)  
**[Agent]** Added serviceName to the span event ContextData  
**[Collector]** Apply the durability setting to SpanChunk (#14544)  
**[Web]** Added a search box to the sidebar service selector  
**[Web]** Added a search box to the server map service selector  
**[Web]** Switched the alarm modules from thymeleaf to thymeleaf-spring6 (#14534)

## Bug Fixes  
**[Agent]** Fixed a class retransform issue by keeping the original constant pool indices when rewriting a class from its class file (#9246)  
**[Agent]** Fixed a Base64 decoding compatibility issue by downgrading commons-codec to 1.22.1 (#14605)  
**[Agent]** Fixed an unnecessary retransform by skipping Spring beans that declare no method to intercept  
**[Agent]** Fixed the trace block depth in DisableTrace and DisableChildTrace traceBlockEnd()  
**[Web]** Fixed the DEFAULT servicemap not applying the search option (#14600)  
**[Web]** Fixed the server map right-click handlers to read the latest disableMenu state  
**[Web]** Fixed the Apdex hover popup to attach to the side of the node that has room  
**[Web]** Fixed the Apdex and service group popups disappearing when the server map menu is disabled  
**[Web]** Fixed an extra drawer scroll when viewing servers  
**[Web]** Fixed the group-by remove button showing when the error table cannot remove a group  
**[Web]** Fixed focus to return to the service search box with ArrowUp from the first result

## Security  
**[none]** Bumped fastjson from 1.2.83 to 1.2.84 to fix CVE-2026-16723 (RCE under the default configuration) (#14584)  
**[Web]** Bumped handlebars, storybook, and shell-quote to fix critical vulnerabilities  
**[Web]** Bumped vite, zod, and transitive dependencies to fix high vulnerabilities  
**[Web]** Bumped postcss-selector-parser to 7.1.7 to fix a moderate vulnerability  
**[Web]** Reported by @Hamaecco: Reject admin API calls when admin.password is not set (#14533)

## Dependency Updates  
**[Build]**   
- Spring Boot 3.5.14 → 3.5.16  
- Spring Framework 6.2.18 → 6.2.19  
- Spring Security 6.5.10 → 6.5.11  
- Spring Batch 5.2.5 → 5.2.6  
- Spring Data 3.5.11 → 3.5.13  
- Spring Cloud 4.3.0 → 4.3.3  
- Spring Kafka 3.3.15 → 3.3.16  
- Spring Retry 2.0.12 → 2.0.13  
- Spring Shell 3.4.2 → 3.4.3  
- log4j2 2.25.4 → 2.25.5  
- jackson 2.21.4 → 2.21.8  
- snakeyaml 2.4 → 2.7  
- bouncycastle 1.81 → 1.86  
- httpclient5 5.4.4 → 5.6.5  
- tomcat-embed 10.1.55 → 10.1.61  
- snappy-java 1.1.10.4 → 1.1.10.12  
- oshi-core 6.9.1 → 7.7.3  
- jna 5.18.1 → 5.19.1  
- zstd-jni 1.5.7-16 → 1.5.7-25  
- HikariCP 7.0.1 → 7.1.0  
- commons-lang3 3.18.0 → 3.21.0  
- commons-io 2.20.0 → 2.22.0  
- commons-codec 1.17.1 → 1.23.0  
- commons-pool2 2.12.0 → 2.13.1  
- commons-collections4 4.4 → 4.6.0  
- hamcrest 2.2 → 3.0


## Downloads

Binaries are attached to this release:

- pinpoint-agent-4.0.1.tar.gz  
- pinpoint-batch-4.0.1-exec.jar  
- pinpoint-alarm-batch-starter-4.0.1-exec.jar  
- pinpoint-collector-4.0.1-exec.jar  
- pinpoint-collector-starter-4.0.1-exec.jar  
- pinpoint-web-4.0.1-exec.jar  
- pinpoint-web-starter-4.0.1-exec.jar

## What's Changed  
* [#14502] Prepare 4.0.1-SNAPSHOT by @intr3p1d in https://github.com/pinpoint-apm/pinpoint/pull/14505  
* [#noissue] Update the live demo address by @jaehong-kim in https://github.com/pinpoint-apm/pinpoint/pull/14509  
* [#14521] Dispatch only the release id to pinpoint-apm.github.io by @feelform in https://github.com/pinpoint-apm/pinpoint/pull/14522  
* [#noissue] Document the authorization scope of basic login by @ga-ram in https://github.com/pinpoint-apm/pinpoint/pull/14506  
* [#14510] Bump spring framework from 6.2.18 to 6.2.19 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14523  
* [#14511] Bump spring boot from 3.5.14 to 3.5.16 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14524  
* [#14514] Bump spring batch from 5.2.5 to 5.2.6 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14525  
* [#14515] Bump spring security from 6.5.10 to 6.5.11 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14526  
* [#14516] Bump spring retry from 2.0.12 to 2.0.13 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14527  
* [#14512] Bump jackson from 2.21.4 to 2.21.8 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14528  
* [#14513] Bump log4j2 from 2.25.4 to 2.25.5 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14529  
* Bump snappy-java from 1.1.10.4 to 1.1.10.12 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14532  
* [#14533] Reject admin API calls when admin.password is not set by @ga-ram in https://github.com/pinpoint-apm/pinpoint/pull/14531   
* [#14534] Switch the alarm modules from thymeleaf to thymeleaf-spring6 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14535  
* [#14517] Bump spring data from 3.5.11 to 3.5.13 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14536  
* [#14519] Bump spring cloud from 4.3.0 to 4.3.3 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14537  
* [#14520] Bump spring kafka from 3.3.15 to 3.3.16 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14538  
* [#noissue] Hide the group by remove button when the error table cannot remove a group by @jihea-park in https://github.com/pinpoint-apm/pinpoint/pull/14539  
* [#14540] Bump spring shell from 3.4.2 to 3.4.3 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14541  
* [#14542] Bump tomcat embed from 10.1.55 to 10.1.61  by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14543  
* [#14544] Collector does not apply the durability setting to SpanChunk by @koo-taejin in https://github.com/pinpoint-apm/pinpoint/pull/14545  
* [#noissue] Skip the spring beans retransform when the bean declares n… by @jaehong-kim in https://github.com/pinpoint-apm/pinpoint/pull/14547  
* [#14550] Bump HikariCP from 7.0.1 to 7.1.0 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14551  
* [#14546] Support the user-supplied URI template for URI stat in the Jetty plugins by @ga-ram in https://github.com/pinpoint-apm/pinpoint/pull/14549  
* [#14517] Manage spring-data-commons in the root pom so spring-batch r… by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14552  
* [#9246] Keep the original constant pool indices when rewriting a clas… by @jaehong-kim in https://github.com/pinpoint-apm/pinpoint/pull/14548  
* [#14553] Bump commons-lang3 from 3.18.0 to 3.21.0 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14554  
* [#noissue] Remove the commons-io dependency from the agent testwebs by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14555  
* [#14556] Bump commons-collections4 from 4.4 to 4.6.0 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14557  
* [#noissue] Remove the unused cglib-nodep version pin by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14559  
* [#14560] Bump hamcrest from 2.2 to 3.0 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14561  
* [#noissue] Remove the MySQL Connector/J 6.x branches from the mysql-jdbc plugin by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14563  
* [#14564] Bump commons-pool2 from 2.12.0 to 2.13.1 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14566  
* [#14562] Bump commons-codec from 1.17.1 to 1.23.0 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14565  
* [#noissue] Remove the MySQL Connector/J 6.x plugin ITs by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14567  
* [#14568] Bump bouncycastle from 1.81 to 1.86 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14569  
* [#noissue] Remove the unused jakarta.transaction-api version pin by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14570  
* [#14571] Bump httpclient5 from 5.4.4 to 5.6.5 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14572  
* [#14573] Bump commons-io from 2.20.0 to 2.22.0 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14574  
* [#14575] Bump zstd-jni from 1.5.7-16 to 1.5.7-25 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14576  
* [#14577] Bump jna from 5.18.1 to 5.19.1 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14578  
* [#14579] Bump snakeyaml from 2.4 to 2.7 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14580  
* [#14581] Bump oshi-core from 6.9.1 to 7.7.3 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14583  
* [#14584] Bump fastjson from 1.2.83 to 1.2.84 by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14586  
* [#noissue] Fix the server map popups when the menu is disabled and the hover popup placement by @jihea-park in https://github.com/pinpoint-apm/pinpoint/pull/14585  
* [#noissue] Add a search box to the sidebar service selector by @jihea-park in https://github.com/pinpoint-apm/pinpoint/pull/14588  
* [#14592] Propagate unsampled traces across coroutine dispatch by @cj848 in https://github.com/pinpoint-apm/pinpoint/pull/14593  
* [#14594] Propagate unsampled traces across Reactor subscribe and retry by @cj848 in https://github.com/pinpoint-apm/pinpoint/pull/14595  
* [#noissue] Fix web-frontend npm Dependabot alerts by @jihea-park in https://github.com/pinpoint-apm/pinpoint/pull/14597  
* [#noissue] Decrease depth in DisableTrace and DisableChildTrace traceBlockEnd() by @cj848 in https://github.com/pinpoint-apm/pinpoint/pull/14599  
* [#14605] Downgrade commons-codec to 1.22.1 for Base64 decoding compatibility by @ga-ram in https://github.com/pinpoint-apm/pinpoint/pull/14606  
* [#noissue] Fix the agent path and the agent JVM arguments of the agen… by @jaehong-kim in https://github.com/pinpoint-apm/pinpoint/pull/14607  
* [#14600] Apply the search option to the DEFAULT servicemap by @cj848 in https://github.com/pinpoint-apm/pinpoint/pull/14601  
* [#14604] Seed the AsyncContext at reactor publishOn, subscribeOn, del… by @jaehong-kim in https://github.com/pinpoint-apm/pinpoint/pull/14609  
* [#noissue] Remove the unused StackTraceProcessor SPI by @emeroad in https://github.com/pinpoint-apm/pinpoint/pull/14611  
* [#noissue] Add serviceName to the span event ContextData by @donghun-cho in https://github.com/pinpoint-apm/pinpoint/pull/14608  
* [#noissue] Clean up native scrollbar color and the extra server view scroll by @jihea-park in https://github.com/pinpoint-apm/pinpoint/pull/14613  
* [#14612] 4.0.1 release by @intr3p1d in https://github.com/pinpoint-apm/pinpoint/pull/14614


**Full Changelog**: https://github.com/pinpoint-apm/pinpoint/compare/v4.0.0...v4.0.1



## Upgrade consideration

HBase compatibility table:


| Pinpoint Version | HBase 1.x | HBase 2.x                                                                                                             |
|------------------|-----------|-----------------------------------------------------------------------------------------------------------------------|
| 2.0.x - 2.2.x    | yes       | [optional](https://pinpoint-apm.gitbook.io/pinpoint/documents/hbase-upgrade#do-you-like-to-use-hbase-2x-for-pinpoint) |
| 2.3.x - 2.5.x    | yes       | [hbase2-module](https://github.com/pinpoint-apm/pinpoint/tree/2.3.x/hbase2-module)                                    |
| 3.0.x            | no        | yes                                                                                                                   |
| 3.1.x            | no        | yes                                                                                                                   |
| 4.0.x            | no        | yes                                                                                                                   |




Agent compatibility to Collector table:



| Agent Version | Collector 2.x.x | Collector 3.0.x | Collector 3.1.x | Collector 4.0.x |
|---------------|-----------------|-----------------|-----------------|-----------------|
| 2.x.x         | yes             | yes             | yes             | yes             |
| 3.0.x         | no              | yes             | yes             | yes             |
| 3.1.x         | no              | no              | yes             | yes             |
| 4.0.x         | no              | no              | no              | yes             |




Additionally, the required Java version to run each Pinpoint component is given below:


| Pinpoint Version | Agent | Collector | Web | Batch | 
|------------------|-------|-----------|-----|-------|
| 2.0.x            | 6-13  | 8         | 8   | 8     |
| 2.1.x            | 6-14  | 8         | 8   | 8     |
| 2.2.x            | 7-14  | 8         | 8   | 8     |
| 2.3.x            | 7-17  | 8         | 8   | 8     |
| 2.4.x            | 7-18  | 11        | 11  | 11    |
| 2.5.x            | 8-19  | 11        | 11  | 11    |
| 3.0.x            | 8-21  | 17        | 17  | 17    |
| 3.1.x            | 8-25  | 17        | 17  | 17    |
| 4.0.x            | 8-25  | 17        | 17  | 17    |




## Supported Modules

* JDK 6+
* Supported versions of the \* indicated library may differ from the actual version.





| Title | Instrumented Library | Min | Max | Comment |  |
| :--- | :--- | :--- | :--- | :--- | :--- |
| [Tomcat](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/tomcat) |  | 6.x | 9.x |  |  |
| [Jetty](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/jetty) |  | 8.x | 9.x |  |  |
| [JBoss](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/jboss) |  | 6.x | 7.x |  |  |
| [Websphere](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/websphere) |  | 6.x | 8.x |  |  |
| [Vertx](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/vertx) |  | 3.3 | 3.5 |  |  |
| [Weblogic](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/weblogic) |  | 10.x | 12.x |  |  |
| [Undertow](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/undertow) |  |  |  |  |  |
| [Undertow Servlet](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/undertow-servlet) |  |  |  |  |  |
| Jasper |  |  |  |  |  |
|  |  |  |  |  |  |
| Java Async Thread |  |  |  |  |  |
|  |  |  |  |  |  |
| OpenWhisk | whisk.core |  |  |  |  |
|  |  |  |  |  |  |
| SpringMVC Framework | spring-webmvc | 3.0.7 | 5.3.6 |  |  |
| Spring Web | spring-web | 4.1.2 | 4.3.30 |  |  |
| Spring RabbitMQ | spring-rabbit | 1.3.3 | 2.2.16 |  |  |
| Spring IBatis | spring-ibatis | 2.0.7 | 2.0.8 |  |  |
| Spring MyBatis | mybatis-spring | 1.1.0 | 1.3.3 |  |  |
| \*[Spring Boot](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/spring-boot) | spring-boot-autoconfigure |  |  |  |  |
| \*[Spring Webflux](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/spring-webflux) | spring-webflux |  |  |  |  |
|  |  |  |  |  |  |
| MyBatis | mybatis | 3.0.3 | 3.3.1 |  |  |
| [Hystrix](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/hystrix) | hystrix-core | 1.4.0 | 1.5.18 |  |  |
|  |  |  |  |  |  |
| JDKHTTP |  |  |  |  |  |
| Httpclient3 | commons-httpclient | 3.0 | 3.1 |  |  |
| Httpclient4 | httpclient | 4.0 | 4.5.4 |  |  |
| Thrift | libthrift | 0.9.1 | 0.14.1 |  |  |
| Google HTTP Client | google-http-client | 1.19.0 | 1.39.2 |  |  |
| AsyncHttpClient | org.asynchttpclient:async-http-client | 2.0.0 | 3.0.14 |  |  |
| OkHttp | okhttp | 2.0.0 | 3.3.1 |  |  |
| Apache HttpAsyncClient | httpasyncclient | 4.0 | 4.1.3 |  |  |
| \*Akka HTTP | akka-http\_2.12 | 10.1.0 | 10.1.x |  |  |
| \*[Kafka](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/kafka) | kafka-clients | 0.11.0.1 |  |  |  |
| GRPC | grpc-stub | 1.8.0 | 1.37.0 |  |  |
| \*[Reactor](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/reactor) | reactor-core | 3.3.0 | 3.3.1 |  |  |
| \*[Reactor Netty](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/reactor-netty) | reactor-netty | 0.8.0 | 0.9.2 |  |  |
|  |  |  |  |  |  |
| Log4j | log4j | 1.2.16 | 1.2.17 |  |  |
| Logback | logback-classic | 1.0.13 | 1.2.3 |  |  |
| Log4j2 | log4j-core | 2.0 | 2.12.1 |  |  |
|  |  |  |  |  |  |
| \*Arcus | arcus-java-client | 1.7.0 | 1.11.4 |  |  |
| \*MsSQL \(jTDS\) | jtds | 1.2.8 |  |  |  |
| \*MsSQL | mssql-jdbc |  |  |  |  |
| HikariCP | HikariCP-java6 | 2.3.0 | 2.3.13 |  |  |
| Jackson-mapper-asl | jackson-mapper-asl | 1.0.1 | 1.8.11 |  |  |
| Jackson Databind | jackson-databind | 2.0.6 | 2.12.3 |  |  |
| MariaDB Connector/J | mariadb-java-client | 1.3.0 | 2.7.2 |  |  |
| MongoDB Java Driver | mongodb-driver | 3.0.0 | 3.12.8 |  |  |
| Elasticsearch | elasticsearch-rest-high-level-client | 6.0.0 | 6.8.15 |  |  |
| Datastax Java Driver | cassandra-driver-core | 2.0.10 | 3.11.0 |  |  |
| Druid | druid | 1.0.0 | 1.2.6 |  |  |
| \*Cubrid | cubrid-jdbc-driver | 8.4.1 | 10.0.0 |  |  |
| \*Commons DBCP | commons-dbcp | 1.0 | 1.4 |  |  |
| \*Commons DBCP2 | commons-dbcp2 | 2.0 | 2.5.0 |  |  |
| \*HBase | hbase-client | 1.2.6.1 | 1.2.6.1 |  |  |
| \*MySQL | mysql-connector-java | 5.0 | 8.x |  |  |
| \*Oracle JDBC Driver | ojdbc |  |  |  |  |
| \*PostgreSQL JDBC Driver | postgresql |  |  |  |  |
| \*[Redis](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/redis) | jedis | 2.4.2 |  |  |  |
| \*[Redis](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/redis-lettuce) | lettuce-core | 5.0.0 | 5.1.2 |  |  |
| \*[Redis](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/redis-redisson) | redisson | 3.10.0 | 3.10.4 |  |  |
|  |  |  |  |  |  |
| Apache CXF | cxf-rt-rs-client | 3.0.0 | 3.4.3 |  |  |
| Netty | netty-all | 4.1.0 | 4.1.63 |  |  |
| ActiveMQ | activemq-all | 5.1.0 | 5.16.1 |  |  |
| [RxJAVA](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/rxjava) | rxjava | 1.0.0 | 1.3.8 |  |  |
| [RabbitMQ](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/rabbitmq) | amqp-client | 2.7.0 | 5.12.0 |  |  |
| [Paho MQTT](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/paho-mqtt) | org.eclipse.paho.client.mqttv3 | 1.0.2 | 1.2.5 |  |  |
| [Paho MQTT](https://github.com/pinpoint-apm/pinpoint/tree/master/agent-module/plugins/paho-mqtt) | org.eclipse.paho.mqttv5.client | 1.2.5 | 1.2.5 |  |  |
|  |  |  |  |  |  |
| Gson | gson | 1.1 | 2.8.3 |  |  |
| Json | json-lib | 1.0 | 2.2.2 |  |  |
| FastJson | fastjson | 1.2.10 | 1.2.76 |  |  |
| Dubbo | dubbo | 2.5.1 | 2.6.9 |  |  |
| kafka-clients | kafka-clients | 0.11.0.0 | 2.6.1 |  |  |
| postgresql | postgresql | 9.4.1208 | 42.2.19 |  |  |
| ojdbc8 | ojdbc8 | 12.2.0.1 | 21.1.0.0 |  |  |
| ojdbc10 | ojdbc10 | 19.3.0.0 | 19.10.0.0 |  |  |

---

## File: performance.md

---
title: Performance Analysis
keywords: 'performance, test'
last_updated: 'Oct 23, 2019'
sidebar: mydoc_sidebar
permalink: performance.html
disqus: false
---

# Performance Analysis

## Introduction

Team members of Pinpoint are always aware of performance and stability issues. We've adapted technologies to reduced elements that hinder performance and always carefully examine the codes when there is a plugin pull requests.\(plugin codes affects most in performance\)

While we have been testing internally everyday for last few years, We've finally had the chance to make the data presentable.

This article doesn't include results compared with other APMs. It's pointless to compare with others due to the difference in collected data. Pinpoint collects massive data to enhance observability as much as possible. But still with minimum impact on the performance

## Test Environment

JVM : 1.8.0\_77 \(G1, -Xms4g, -Xmx4g\)  
Server : Tomcat  
Database : Cubrid  
Stress test generator : [NGrinder](https://github.com/pinpoint-apm/ngrinder)

## Test Result



_off : non traced_    
on-20 : trace 5% transaction using thrift  
_grpc-on-20 : trace 5% transaction using grpc_    
on-1 : trace 100% transaction using thrift  
\*grpc-on-1 : trace 100% transaction using grpc

**Test result shows that Pinpoint affects less than 3% in performance and memory**  
**TPS is effected by various reasons, which may not always be exact**  
**gRPC is little slow than thrift in this test, the performance gap between the two is expected to be reduced, or even more, reversed in v1.9.0 release**

## Conclusion

Pinpoint is already being used in dozens of global companies in the world. With right environment and configuration it's been proved to be worthy. We believe most of the services can spare their 3% of resource to gain high observability with Pinpoint.

## Check List

If you still have low performance issue due to Pinpoint. Here are several items to check in advance.

1. Check the default log option for Pinpoint-Agent \(Default was `DEBUG` prior to v1.8.1\)
2. JVM option 
   * use G1 for the GC Type
   * fix initial/maximum memory allocation pool with same size. ex\) -Xms4g -Xmx4g
3. Change [sampling rate](faq.md#why-is-only-the-first-some-of-the-requests-traced). Even 1~2% would be enough if you are dealing big data.

   When certain transaction doesn't bypass database, it may appear that Pinpoint is consuming much more resources than 3%, since instrumentation time is not relative, but absolute. But this phenomenon appears in all APM, not only Pinpoint.

## Reference Data

We run test with various technology stacks. Planning to expand more as we go.  
[Full Result]()

---

## File: powered-by.md

---
title: Powered by Pinpoint
keywords: 'pinpoint, used, working, use, inuse, poweredby'
last_updated: 'Jun 23, 2022'
sidebar: mydoc_sidebar
permalink: poweredby.html
disqus: false
---

# Powered by Pinpoint

This page, documents **alphabetical list** of organizations using Pinpoint.

## Sites using Pinpoint

1. Coupang (www.coupang.com)
2. Echemi (www.echemi.com)
3. HANATOUR (www.hanatour.com)
4. NAVER (www.naver.com)
5. NHN Entertainment
6. Pikicast (www.pikicast.com)
7. SKPlanet (www.skplanet.com)
8. THE PIRATES(www.tpirates.com)
9. Toss ([toss.im](https://toss.im))
10. XLGAMES (www.xlgames.com)

## Naver

Naver Co., Ltd. uses Pinpoint as primary APM. Monitoring 2k+ applications with 10k+ instances. Supports 870k+ tps with only 17 Pinpoint-Collectors. Around 70 billion span chunks are collected per day. Which is equivalent to 10 billion transaction.

---

## File: resources.md

---
title: Resources
keywords: 'resources, other sites'
last_updated: 'Feb 1, 2018'
sidebar: mydoc_sidebar
permalink: resources.html
disqus: false
---

# Resources

If you have created informative posts on pinpoint and want the link to be added. Feel free to contact us anytime. We are glad to add more links.

## Resources \(KOREAN\)

* 유용한 자료를 작성하셨다면 공유부탁드립니다!!!
* [Pinpoint 개발자가 작성한 Pinpoint 기술문서 \(helloworld.naver.com\)](http://helloworld.naver.com/helloworld/1194202)
* [설치 가이드 동영상 강좌 1 \(okjsp 대표 허광남님\)](https://www.youtube.com/watch?v=hrvKaEaDEGs)
* [설치 가이드 동영상 강좌 2 \(okjsp 대표 허광남님\)](https://www.youtube.com/watch?v=fliKPGHGXK4)

## Resources \(ENGLISH\)

* Anyone who would like to share any document are always welcome
* [Technical Overview of Pinpoint](https://github.com/pinpoint-apm/pinpoint/wiki/Technical-Overview-Of-Pinpoint)
* [Official Docker Repository](https://github.com/pinpoint-apm/pinpoint-docker)
* [Notes on Jetty Plugin for Pinpoint](https://github.com/cijung/Docs/blob/master/JettyPluginNotes.md) \([@cijung](https://github.com/cijung)\)

## Resources \(中文\)

* [Pinpoint学习笔记](http://skyao.gitbooks.io/leaning-pinpoint/)：中文资料收集整理和更重要的-中文翻译！
* [Pinpoint - 应用性能管理\(APM\)平台实践之部署篇](https://sconts.com/11)
* [开源APM工具Pinpoint线上部署](https://www.iqarr.com/2018/02/04/java/pinpoint/pinpoint-deploy/)

---

## File: SUMMARY.md

# Table of contents

* [Introduction](README.md)
* [What's New](main.md)

## Want a quick tour?

* [Overview](want-a-quick-tour/overview.md)
* [History](want-a-quick-tour/history.md)
* [Tech Details](want-a-quick-tour/techdetail.md)
* [Videos](want-a-quick-tour/videos.md)
* [Additional Plugins](want-a-quick-tour/untitled.md)

## Getting Started

* [Quick-start guide](getting-started/quickstart/README.md)
  * [quickstart.Win.en](getting-started/quickstart/quickstart.win.en.md)
  * [quickstart.Win.ko](getting-started/quickstart/quickstart.win.ko.md)
* [Installation guide](getting-started/installation.md)
* [Install with Docker](getting-started/docker.md)
* [TrobleShooting\(Network\)](getting-started/troubleshooting_network.md)

## Documents
* [Plugin Developer Guide](documents/plugin-dev-guide.md)
* [Setting Alarm](documents/alarm.md)
* [New Inspector](documents/new-inspector.md)
* [System Metric](documents/system_metric.md)  
* [URI Statistics](documents/uri_statistics.md)
* [URI Statistics Alarm](documents/uri_statistics_alarm.md)
* [OpenTelemetry Metric](documents/otel_metric.md)
* [Heatmap](documents/heatmap.md)
* [Error Analysis](documents/error_analysis.md)
* [Service](documents/service.md)
* [How to use Application Inspector](documents/application-inspector.md)
* [Realtime Request Monitoring](documents/realtime.md)
* [Separate Logging Per Request](documents/per-request_feature_guide.md)
* [Marking Transaction as Fail](documents/http-status-code-failure.md)
* [Monitoring Proxy Server](documents/proxy-http-header.md)
* [Upgrade Database Hbase2](documents/hbase-upgrade.md)
* [HBase Table Changes](documents/hbase-table-changes.md)

## Contribution <a id="contribution-1"></a>

* [Contribution](contribution-1/contribution.md)
* [Open to Contribution](https://github.com/pinpoint-apm/pinpoint/labels/proposal)

---

* [Performance Analysis](performance.md)
* [Twitter](https://twitter.com/Pinpoint_APM)
* [Release Notes](https://github.com/pinpoint-apm/pinpoint/releases)
* [FAQ](faq.md)
* [Powered by Pinpoint](powered-by.md)
* [Questions & answers](https://github.com/pinpoint-apm/pinpoint/issues)
* [Fork me at Github](https://github.com/pinpoint-apm/pinpoint)
* [Earlier documents](https://pinpoint-apm.github.io/pinpoint/)
* [Resources](resources.md)

---

## File: contribution-1/contribution.md

---
title: Contribution
keywords: help
last_updated: 'Feb 1, 2018'
sidebar: mydoc_sidebar
permalink: contribution.html
disqus: false
---

# Contribution

Thank you very much for choosing to share your contribution with us. Please read this page to help yourself to the contribution.

Before making first pull-request, please make sure you've signed the [Contributor License Agreement](http://goo.gl/forms/A6Bp2LRoG3). This isn't a copyright - it gives us \(Naver\) permission to use and redistribute your code as part of the project.

## Making Pull Requests

Apart from trivial fixes such as typo or formatting, all pull requests should have a corresponding issue associated with them. It is always helpful to know what people are working on, and different \(often better\) ideas may pop up while discussing them. Please keep these in mind before you create a pull request:

* Every new java file must have a copy of the license comment. You may copy this from an existing file.
* Make sure you've tested your code thoroughly. For plugins, please try your best to include integration tests if possible.
* Before submitting your code, make sure any changes introduced by your code does not break the build, or any tests.
* Clean up your commit log into logical chunks of work to make it easier for us to figure out what and why you've changed something. \(`git rebase -i` helps\)
* Please try best to keep your code updated against the master branch before creating a pull request.
* Make sure you create the pull request against our master branch.
* If you've created your own plugin, please take a look at [plugin contribution guideline](contribution.md#plugin-contribution-guideline)

## Plugin Contribution Guideline

We welcome your plugin contribution. Currently, we would love to see additional tracing support for libraries such as [Storm](https://storm.apache.org), [HBase](http://hbase.apache.org), as well as profiler support for additional languages \(.NET, C++\).

### Technical Guide

**For technical guides for developing plug-in,** take a look at our [plugin development guide](../documents/plugin-dev-guide.md), along with [plugin samples](https://github.com/pinpoint-apm/pinpoint-plugin-sample) project to get an idea of how we do instrumentation. The samples will provide you with example codes to help you get started.

### Contributing Plugin

If you want to contribute your plugin, it has to satisfy the following requirements:

1. Configuration key names must start with `profiler.[pluginName]`.
2. At least 1 plugin integration test.

Once your plugin is complete, please open an issue to contribute the plugin as below:

```text
Title: [Target Library Name] Plugin Contribution

Link: Plugin Repository URL
Target: Target Library Name
Supported Version: 
Description: Simple description about the target library and/or target library homepage URL

ServiceTypes: List of service type names and codes the plugin adds
Annotations: List of annotation key names and codes the plugin adds
Configurations: List of configuration keys and description the plugin adds.
```

Our team will review the plugin, and your plugin repository will be linked at the third-party plugin list page if everything checks out. If the plugin is for a widely used library, and if we feel confident that we can continuously provide support for it, you may be asked to send us a PR. Should you choose to accept it, your plugin will be merged to the Pinpoint repository.

As much as we'd love to merge all the plugins to the source repository, we do not have the man power to manage all of them, yet. We are a very small team, and we certainly are not experts in all of the target libraries. We feel that it would be better to not merge a plugin if we are not confident in our ability to provide continuous support for it.

To send a PR, you have to modify your plugin like this:

* Fork Pinpoint repository
* Copy your plugin under /plugins directory
* Set parent pom

  ```text
    <parent>
        <groupId>com.navercorp.pinpoint</groupId>
        <artifactId>pinpoint-plugins</artifactId>
        <version>Current Version</version>
    </parent>
  ```

* Add your plugin to _plugins/pom.xml_ as a sub-module.
* Add your plugin to _plugins/assembly/pom.xml_ as a dependency.
* Copy your plugin integration tests under /agent-it/src/test directory.
* Add your configurations to /agent/src/main/resources/\*.config files.
* Insert following license header to all java source files.

  ```text
  /*
  * Copyright 2018 Pinpoint contributors and NAVER Corp.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
  ```

If you do not want to be bothered with a PR, you may choose to tell us to do it ourselves. However, please note that your contribution will not visible through git history or the Github profile.

---

## File: documents/alarm.md

[English](alarm.md#service-alarm) | [한국어](alarm.md#service-alarm-ko)
# Service Alarm <a id="service-alarm"></a>

Pinpoint now has the Service feature, and a new Service Alarm screen lets you set alarms for each service. Service Alarm runs alarm rules on the applications of a service. When a rule condition is met, it sends a notification through a channel.

The legacy alarm works only in the `DEFAULT` service. For a service that you create, manage the alarms of its applications on the Service Alarm screen.

Service Alarm requires the Service Map feature. If `pinpoint.modules.web.servicemap.enabled` is `false`, all applications belong to the `DEFAULT` service, and only the legacy alarm screen appears.

### Main Changes

| Item | Legacy Alarm | Service Alarm |
|---|---|---|
| Service | `DEFAULT` | A service that you create |
| Channel | Set for each rule | Registered once per service and shared by many rules and templates |
| Rule registration | Register the same rule again for each application | Make a template and apply it to many applications |
| Condition | One simple comparison on one metric | Many metrics combined with `AND`/`OR` |
| Operator | Fixed for each checker | Select `>`, `>=`, `<`, or `<=` |
| Evaluation window | Fixed at 5 minutes | Set for each rule |
| Repeat notification | Sent at the 1st, 3rd, 7th, 15th... consecutive detection | Set the interval with Action Interval |

For the full comparison, refer to [9. Legacy Alarm and Service Alarm Comparison](alarm.md#alarm-comparison).

### Notes

- Legacy rules do not move to Service Alarm automatically.
  - If you move an application to a service, register its Service Alarm rules again.
- The legacy alarm of the `DEFAULT` service continues to run in `alarmJob` of the `batch` module.
- During the migration, if you enable the same condition in both the legacy alarm and Service Alarm, you get duplicate notifications.

Service Alarm needs a separate Alarm Batch process. The operation guide starts at [10. Components](alarm.md#alarm-components).

# User Guide

## 1. Open the Alarm Screen

1. Select the service to set alarms for.
2. At the bottom left, click **Service → Alarm**.
3. At the top, select an application.

The alarm screen has three tabs.

| Tab | Description |
|---|---|
| Rules | Register and manage the rules of the selected application. |
| Channels | Register the channels that receive notifications. |
| Templates | Group many rules into one template and apply it to many applications. |



## 2. Register a Rule

On the **Rules** tab, click **Add Rule**, enter the items below, and click **Add**. To change a registered rule, click **Save**.

| Item | Description |
|---|---|
| Name, Description | Rule name and description. They appear in the notification message. |
| Severity | Notification level. `WARNING` or `CRITICAL` |
| Data Source | Data that the condition uses. Refer to [3. Data Sources and Metrics](alarm.md#alarm-data-sources). |
| Check Interval | How often the condition is checked |
| Action Interval | Minimum interval before the same rule sends a notification again |
| Condition | Condition that sends a notification. Refer to [Condition](alarm.md#alarm-condition) below. |
| Filters | Conditions that narrow the target. Some data sources do not support filters. |
| Notification Channels | Channels that receive the notification |



### Condition <a id="alarm-condition"></a>

A condition has a metric, an aggregation, a comparison operator, a threshold, and an evaluation window (Window).

- Select a comparison operator from `>`, `>=`, `<`, and `<=`.
- To add a condition, click **Add Condition**.
- To combine conditions with `AND` or `OR`, click **Add Group**.

> Set the Window to the Check Interval or longer. If the Window is shorter, the data between two checks is not evaluated.



## 3. Data Sources and Metrics <a id="alarm-data-sources"></a>

| Data Source | Metric | Aggregation | Filter | Remarks |
|---|---|---|---|---|
| Application Response | Slow Count, Error Count, Total Count | SUM | Not supported | |
| | Slow Rate (%), Error Rate (%) | Ratio over the whole window | | |
| | Apdex Score | Score over the whole window | | 0 to 100 |
| Calls To Another Application | Slow Count, Error Count, Total Count | SUM | `callee`, `callee_host` | |
| | Slow Rate (%), Error Rate (%) | Ratio over the whole window | | |
| Agent Stat | Heap Usage Rate (%), JVM CPU Usage Rate (%), System CPU Usage Rate (%), Open File Descriptor Count, Connection Pool Usage Rate (%) | MAX, MIN, AVG | Not supported | Aggregates the value of each agent. The notification shows the agents that crossed the threshold. |
| Agent Event | Deadlock Detected | None | Not supported | Sends a notification when a new deadlock occurs. No threshold. |

### Application Response and Calls To Another Application

- `Application Response` counts the requests that the application receives.
- `Calls To Another Application` counts the calls that the application sends to other targets, such as a DB or an external API.

For example, one incoming request calls the DB three times and an external API once. Then the Total Count of `Application Response` is 1, and the Total Count of `Calls To Another Application` is 4.

### Filters

- Only `Calls To Another Application` supports filters. For a data source without filter support, the add filter button is disabled.
- `callee` specifies the target application. `callee_host` specifies the target host.
- If you add many filters, only the calls that match all filters are counted.
- Without a filter, the calls to all targets are added together. Then the failures of one target can be hidden by the successful calls to other targets. Specify the target.
  - Example: 9,900 successful DB calls and 100 failed external API calls give a total Error Rate of 1%.

## 4. Register a Channel

1. On the **Channels** tab, click **Add Channel**.
2. Enter the name, the channel type, and the recipient, and click **Add**.

| Type | Recipient | Remarks |
|---|---|---|
| EMAIL | User Group | Sends to the email addresses of the user group members. |
| SMS | User Group | The operator must register an SMS implementation. Refer to [12. Run Alarm Batch](alarm.md#alarm-batch). |
| WEBHOOK | URL | Format is `DEFAULT` or `SLACK`. A private address works only for hosts that the operator allows. A channel with a blocked address can be saved, but it sends no notification. |



Channels work as follows.

- If you select a user group without recipients, a warning appears in the channel list and in the channel selection of rules and templates.
- Many rules and templates in the same service can share one channel.
- When you change a channel, all later notifications through that channel use the change.



## 5. Templates and Presets

A template is a group of rules. Apply one template to many applications to use the same alarm criteria.

### Make a Template

1. On the **Templates** tab, click **Add Template**.
2. Select the rules for the template and click **Start with N rules**. You can select many items from the three groups below.
3. Adjust the template name, channels, and rules, and click **Save**.

| Group | Description |
|---|---|
| Start from a preset | Built-in rule groups. Refer to [Built-in Presets](alarm.md#alarm-presets). |
| Copy one of my templates | Templates registered in this service |
| Import standalone rules | Rules registered directly on an application |

- The selected rules are copied into the new template. Later changes to the source preset, template, or rule do not change the new template.
- To start with an empty template, select nothing and click **Start empty**.



### Apply a Template to an Application

1. On the **Rules** tab, select an application.
2. Click **Add from template** and select a template.

You cannot select a template that is already applied to the application.



### Effect of Template Changes

| Action | Effect |
|---|---|
| Change a template | The change applies to the rules of all applications that use the template. Added and removed rules also apply. |
| Change template channels | The change applies to all rules made from the template. |
| Remove a template from an application | Deletes only the rules made from that template in the selected application. |
| Delete a template | Deletes the rules made from that template in all applications. |

> If you change a value of a template rule directly on an application, later template changes do not change that value.

### Built-in Presets <a id="alarm-presets"></a>

**Agent Health Basics**: Monitors agent health with heap, CPU, and connection pool usage, and deadlocks.

| Rule | Severity | Condition | Check / Action |
|---|---|---|---|
| High heap usage | WARNING | Heap Usage Rate MAX >= 90% in 10 minutes | 5 min / 30 min |
| High JVM CPU usage | WARNING | JVM CPU Usage Rate MAX >= 90% in 10 minutes | 5 min / 30 min |
| High connection pool usage | CRITICAL | Connection Pool Usage Rate MAX >= 90% in 10 minutes | 5 min / 30 min |
| Deadlock detected | CRITICAL | A new deadlock occurs | 5 min / 60 min |

**Response Quality Basics**: Monitors response quality with error rate, slow rate, and Apdex.

| Rule | Severity | Condition | Check / Action |
|---|---|---|---|
| High error rate | CRITICAL | Error Rate >= 10% in 5 minutes | 3 min / 30 min |
| High slow rate | WARNING | Slow Rate >= 20% in 5 minutes | 3 min / 30 min |
| Apdex drop | WARNING | Apdex Score < 70 in 5 minutes | 3 min / 30 min |

## 6. Status and History

### Rule Status

| Status | Description |
|---|---|
| `NORMAL` | The condition is not met. |
| `FIRING` | The condition is met and the alarm fired. |
| `CHECK_FAILED` | The data query, the evaluation, or the notification preparation failed. |

### History

| Event | When it is recorded | Notification |
|---|---|---|
| `FIRED` | When the alarm fires and sends a notification. A repeat inside the Action Interval is not recorded. | Sent |
| `RESOLVED` | When the rule returns to normal from `FIRING` or `CHECK_FAILED` | Not sent |
| `CHECK_FAILED` | When a check fails for the first time. Continued failures are not recorded again. | Not sent |

- In the rule list, click **Actions → History** to see the current status and the history of a rule.
- The history keeps the rule settings and the measured values at the time of the alarm. Later rule changes do not change the history.



### Notification Content

A notification includes the service, the application, the rule, and the measured values.

| Button | Destination |
|---|---|
| View Details | The Service Map for the time range of the alarm. Inspector for Agent Stat and Agent Event rules |
| Alarm History | The history of the rule |



## 7. Input Limits

| Item | Limit |
|---|---|
| Rule name / description | 255 / 1000 characters |
| Rules in a template | 30 per template |
| Conditions | 10 conditions and groups in total, group depth 2 |
| One group | 3 conditions, 2 subgroups |
| Filters | 5 per rule, 512 characters per value |
| Window | 1 minute to 24 hours (except metrics without a threshold) |
| Check Interval | 1, 3, 5, 10, 30, 60 minutes |
| Action Interval | 5, 10, 30 minutes, 1, 6, 12, 24 hours |

## 8. Migrate Legacy Alarm Rules

Legacy rules do not move automatically. Legacy rules have no severity, Action Interval, or shared channel, and their window and check interval are fixed. Register new Service Alarm rules with the mapping below.

| Legacy checker | Data Source | Metric and settings |
|---|---|---|
| `SLOW_COUNT`, `SLOW_RATE` | Application Response | Slow Count, Slow Rate (%) |
| `ERROR_COUNT`, `ERROR_RATE` | Application Response | Error Count, Error Rate (%) |
| `TOTAL_COUNT` | Application Response | Total Count |
| `APDEX_SCORE` | Application Response | Apdex Score. To keep the legacy behavior, select `<=`. |
| `*_TO_CALLEE` | Calls To Another Application | Same metric. Move the target in the notes of the legacy rule to the `callee` or `callee_host` filter. |
| `HEAP_USAGE_RATE`, `JVM_CPU_USAGE_RATE`, `SYSTEM_CPU_USAGE_RATE`, `FILE_DESCRIPTOR_COUNT` | Agent Stat | Same metric. To keep the legacy behavior, select the `MAX` aggregation and `>=`. |
| `DATASOURCE_CONNECTION_USAGE_RATE` | Agent Stat | Connection Pool Usage Rate (%). To keep the legacy behavior, select the `MAX` aggregation and `>`. |
| `DEADLOCK_OCCURRENCE` | Agent Event | Deadlock Detected |

The SMS, email, and webhook settings of legacy rules do not move. Register channels in the service and connect them to the rules.

### Migration Steps

1. Make the Service Alarm rule in the disabled state.
2. Compare the service, condition, threshold, target, and recipients with the legacy rule.
3. Disable the legacy rule and enable the Service Alarm rule immediately.
4. Make sure that notifications arrive and the history is recorded.

## 9. Legacy Alarm and Service Alarm Comparison <a id="alarm-comparison"></a>

| Item | Legacy Alarm | Service Alarm |
|---|---|---|
| Management unit | Application | Application of a service |
| Condition | One metric per rule | Combined conditions with `AND`/`OR` |
| Comparison | Fixed for each checker (Apdex: less than or equal, connection pool: greater than, others: greater than or equal) | Select `>`, `>=`, `<`, or `<=` |
| Evaluation window | Fixed at 5 minutes | Window for each rule |
| Check interval | Fixed at 3 minutes | 1, 3, 5, 10, 30, 60 minutes |
| Repeat notification | Sent at the 1st, 3rd, 7th, 15th... consecutive detection | Action Interval |
| Agent condition | Fires when any agent crosses the threshold | `MAX`, `MIN`, `AVG` (`MAX` matches the legacy behavior) |
| Target selection | One target in the notes of the rule | `callee`, `callee_host` filters |
| Severity | None | `WARNING`, `CRITICAL` |
| Channel | User group and SMS, email, webhook on/off | Shared service channels connected to rules and templates |
| Reuse | Register rules for each application | Templates and presets |
| History | Not shown on screen | Status and history for each rule, history link in the notification |

# Operation Guide

## 10. Components <a id="alarm-components"></a>

| Component | Role |
|---|---|
| Pinpoint Web | Provides the API and the screen for rules, channels, and templates. Included without extra settings. |
| Alarm Batch (`alarm-batch-starter`) | Checks the rules and sends notifications. Runs as a separate process. |
| Pinpoint Batch (`batch`) | Deletes old alarm history. Optional. Refer to [Clean Up the History](alarm.md#alarm-history-cleanup). |
| MySQL | Stores the alarm tables and the Spring Batch metadata. |
| HBase, Pinot | Alarm Batch reads metrics from them. |

- The legacy alarm is evaluated by `alarmJob` of the `batch` module and checks only the applications of the `DEFAULT` service.
- Service Alarm is evaluated and sent by Alarm Batch.

```mermaid
flowchart LR
    user(["User"])
    api["Pinpoint Web<br/>Alarm API"]
    mysql[("MySQL<br/>Alarm tables")]

    subgraph batch["Alarm Batch"]
        direction TB
        eval["Rule evaluation<br/>every 10 seconds"]
        send["Notification delivery<br/>every 5 seconds"]
    end

    subgraph metrics["Metric storage"]
        direction TB
        hbase[("HBase<br/>Map statistics · Agent Event")]
        pinot[("Pinot<br/>Agent statistics")]
    end

    ch["Email · SMS · Webhook"]

    user -- "Manage rules, channels, templates" --> api
    api -- "Save" --> mysql
    mysql <-- "Read rules / save status and history" --> eval
    eval -- "Query metrics" --> metrics
    eval -. "Queue delivery<br/>(MySQL)" .-> send
    send -- "Send" --> ch
```

| Data Source | Source |
|---|---|
| Application Response, Calls To Another Application | HBase map statistics |
| Agent Stat | Pinot agent statistics table |
| Agent Event | HBase Agent Event |

> Pinpoint Web does not check permissions on the alarm API. A user who can access Web can read and change the rules, channels, and templates of all services.

## 11. Prepare the Database

MySQL 8.4 or later is recommended. The configuration columns of the alarm tables use the JSON type.

Make the alarm tables with this script.

```text
alarm/alarm-common/src/main/resources/sql/alarm/CreateTableStatement-mysql.sql
```

| Group | Tables |
|---|---|
| Template | `alarm_template`, `alarm_template_item` |
| Rule | `alarm_rule_v2`, `alarm_rule_local_config` |
| Channel | `alarm_notification_channel`, `alarm_channel_binding` |
| Status and history | `alarm_state`, `alarm_history_v2` |
| Delivery queue | `alarm_notification_outbox` |

Alarm Batch does not make the Spring Batch metadata schema. Make it with this script.

```text
web/src/main/resources/sql/SpringBatchJobRepositorySchema-mysql.sql
```

## 12. Run Alarm Batch <a id="alarm-batch"></a>

- Executable: `pinpoint-alarm-batch-starter-<version>-exec.jar`
- Container image: `pinpoint-alarm-batch`
- External configuration file: `-Dpinpoint.alarm.batch.config.location=`

### Required Settings

| Item | Setting | Remarks |
|---|---|---|
| MySQL | `jdbc.properties` | Use the same alarm tables as Web. |
| Spring Batch metadata | `spring.meta-datasource.*` | If not set, uses the same DB as the MySQL setting. |
| HBase | `hbase.properties` | |
| Pinot | `spring.pinot-datasource.*` | |
| Agent statistics table | `alarm.agent-stat.table.prefix`, `alarm.agent-stat.table.padding-length`, `alarm.agent-stat.table.count` | Startup fails without these values. The release profile has them only as comments, so set them yourself. |

### Notification Settings

| Item | Setting | Remarks |
|---|---|---|
| Notification link | `alarm.pinpoint.web.url` | If empty, notifications have no View Details or Alarm History link. |
| Email | `alarm.email.sender`, `spring.mail.*` | If `alarm.email.sender` is empty, no email is sent. |
| Webhook private addresses | `pinpoint.webhook.allowed-private-hosts`, `pinpoint.webhook.allowed-private-host-suffixes` | By default, all private addresses are blocked. |
| SMS | `SmsAlarmSender` bean | No default implementation. Refer to the description below. |

To use SMS channels, implement the interfaces below and register them as a `SmsAlarmSender` bean.

- `SmsDispatcher`: Receives a list of phone numbers and a message, and sends the SMS.
- `UserGroupPhoneResolver`: Finds the phone numbers of the user group members.

Without this bean, SMS channels send no notification, and the failure is recorded in the alarm history. The other channels of the same rule still send notifications.

### Tunable Settings

| Setting | Default | Description |
|---|---|---|
| `pinpoint.modules.batch.alarm.fixedDelayMs` | `10000` | Rule check interval (ms) |
| `pinpoint.modules.batch.alarm.batchSize` | `300` | Number of rules read at a time |
| `pinpoint.modules.batch.alarm.worker.coreSize`, `.maxSize` | `4`, `4` | Number of rule evaluation threads |
| `pinpoint.modules.batch.alarm.jobName` | `alarmEvaluationJob` | Name that separates this job from the legacy alarm (`alarmJob`) when both use the same metadata schema |
| `pinpoint.modules.batch.alarm.outbox.fixedDelayMs` | `5000` | Notification delivery interval (ms) |
| `pinpoint.modules.batch.alarm.outbox.batchSize` | `100` | Number of notifications sent at a time |
| `pinpoint.modules.batch.alarm.outbox.maxAttempts` | `5` | Maximum delivery attempts, including the first attempt (1 to 255) |
| `pinpoint.modules.batch.alarm.outbox.leaseSec` | `60` | Time (seconds) during which no other process takes a notification that is being sent |
| `alarm.pinpoint.web.alarm-path` | `/config/alarm` | Path of the Alarm History link |

### Clean Up the History <a id="alarm-history-cleanup"></a>

`alarmHistoryCleanupJob` of the `batch` module deletes old alarm history. It runs in Pinpoint Batch, not in Alarm Batch, and uses the MySQL of its `jdbc.properties`. It is off by default.

| Setting | Default | Description |
|---|---|---|
| `job.cleanup.alarm.history.enable` | `false` | Turns on the job |
| `job.cleanup.alarm.history.cron` | `0 30 3 * * *` | Run schedule |
| `job.cleanup.alarm.history.expiration-days` | `14` | Retention (days). The job deletes the history older than this. |
| `job.cleanup.alarm.history.chunk-size` | `5000` | Number of rows deleted at a time |

The job deletes the sent and dead items of the delivery queue (`alarm_notification_outbox`) first, then the history (`alarm_history_v2`). A history with an item that waits for delivery stays until that item is sent or dead.


# Service 알람 가이드 <a id="service-alarm-ko"></a>

Pinpoint에 Service 기능이 추가되면서, Service 단위로 알람을 설정할 수 있는 Service 알람 화면이 추가되었습니다. Service 알람은 Service의 Application에 알람 룰을 등록하고, 조건을 만족하면 채널로 알림을 보냅니다.

기존 알람은 `DEFAULT` Service에서만 사용할 수 있습니다. 직접 생성한 Service에서는 Service 알람 화면에서 그 Service의 Application 알람을 관리합니다.

Service 알람은 Service Map 기능이 켜져 있을 때만 사용할 수 있습니다. `pinpoint.modules.web.servicemap.enabled`가 `false`이면 모든 Application이 `DEFAULT` Service로 처리되어 기존 알람 화면만 표시됩니다.

### 주요 변경 사항

| 항목 | 기존 알람 | Service 알람 |
|---|---|---|
| 사용하는 Service | `DEFAULT` | 직접 생성한 Service |
| 채널 | 룰마다 지정 | Service 단위로 등록하고 여러 룰·템플릿에서 재사용 |
| 룰 등록 | Application마다 같은 룰을 새로 등록 | 템플릿을 만들어 여러 Application에 적용 |
| 조건 | 단일 지표 단순 비교 | 여러 지표를 `AND`/`OR`로 결합 |
| 연산자 | checker마다 고정 | `>`, `>=`, `<`, `<=` 중 선택 |
| 평가 구간 | 5분 고정 | 룰별로 지정 |
| 재알림 | 연속 감지 1·3·7·15...번째에 발송 | Action Interval로 재알림 간격 지정 |

자세한 비교는 [9. 기존 알람과 Service 알람 비교](alarm.md#alarm-comparison-ko)를 참고합니다.

### 안내 사항

- 기존 룰은 자동 이전되지 않습니다.
  - Application을 Service로 옮겼다면 Service 알람 룰을 다시 등록해야 합니다.
- `DEFAULT` Service의 기존 알람은 `batch` 모듈의 `alarmJob`에서 계속 동작합니다.
- 전환 기간에 같은 조건을 기존 알람과 Service 알람에서 모두 켜면 알림이 중복됩니다.

Service 알람을 운영하려면 별도의 Alarm Batch 프로세스가 필요합니다. [10. 구성 요소](alarm.md#alarm-components-ko)부터 운영 방법을 설명합니다.

# 사용 가이드

## 1. 알람 화면 열기

1. 알람을 설정할 Service를 선택합니다.
2. 왼쪽 아래 **Service → Alarm**을 누릅니다.
3. 상단에서 Application을 선택합니다.

알람 화면은 세 개의 탭으로 구성됩니다.

| 탭 | 내용 |
|---|---|
| Rules | 선택한 Application의 룰을 등록하고 관리합니다. |
| Channels | 알림을 받을 채널을 등록합니다. |
| Templates | 여러 룰을 하나의 템플릿으로 묶고 여러 Application에 적용합니다. |



## 2. 룰 등록

**Rules** 탭에서 **Add Rule**을 누르고, 아래 항목을 입력한 뒤 **Add**를 누릅니다. 등록한 룰을 수정할 때는 **Save**를 누릅니다.

| 항목 | 설명 |
|---|---|
| Name, Description | 룰 이름과 설명. 알림 메시지에 표시됩니다. |
| Severity | 알림 등급. `WARNING` 또는 `CRITICAL` |
| Data Source | 조건에 사용할 데이터. [3. 데이터 소스와 지표](alarm.md#alarm-data-sources-ko)에서 설명합니다. |
| Check Interval | 조건을 검사하는 주기 |
| Action Interval | 같은 룰의 알림을 다시 보내기까지의 최소 간격 |
| Condition | 알림을 보낼 조건. 아래 [조건 구성](alarm.md#alarm-condition-ko)에서 설명합니다. |
| Filters | 검사 대상을 좁히는 조건. 일부 Data Source는 필터를 지원하지 않습니다. |
| Notification Channels | 알림을 보낼 채널 |



### 조건 구성 <a id="alarm-condition-ko"></a>

조건 하나는 지표, 집계 방식, 비교 연산자, 임계값, 평가 구간(Window)으로 구성됩니다.

- 비교 연산자는 `>`, `>=`, `<`, `<=` 중에서 선택합니다.
- 조건을 더 추가하려면 **Add Condition**을 누릅니다.
- 여러 조건을 `AND` 또는 `OR`로 묶으려면 **Add Group**을 누릅니다.

> Window는 Check Interval 이상으로 설정합니다. Window가 더 짧으면 두 검사 사이의 데이터가 평가에서 빠집니다.



## 3. 데이터 소스와 지표 <a id="alarm-data-sources-ko"></a>

| Data Source | 지표 | 집계 | 필터 | 비고 |
|---|---|---|---|---|
| Application Response | Slow Count, Error Count, Total Count | SUM | 지원 안 함 | |
| | Slow Rate (%), Error Rate (%) | 평가 구간 전체의 비율 | | |
| | Apdex Score | 평가 구간 전체의 점수 | | 0~100 |
| Calls To Another Application | Slow Count, Error Count, Total Count | SUM | `callee`, `callee_host` | |
| | Slow Rate (%), Error Rate (%) | 평가 구간 전체의 비율 | | |
| Agent Stat | Heap Usage Rate (%), JVM CPU Usage Rate (%), System CPU Usage Rate (%), Open File Descriptor Count, Connection Pool Usage Rate (%) | MAX, MIN, AVG | 지원 안 함 | Agent별로 집계하고, 기준을 넘은 Agent를 알림에 표시합니다. |
| Agent Event | Deadlock Detected | 없음 | 지원 안 함 | 새 데드락이 발생하면 임계값 없이 알림 |

### Application Response와 Calls To Another Application

- `Application Response`는 Application으로 들어온 요청을 집계합니다.
- `Calls To Another Application`은 Application이 DB, 외부 API 같은 다른 대상으로 보낸 호출을 집계합니다.

예를 들어 들어온 요청 하나가 DB를 세 번, 외부 API를 한 번 호출하면 `Application Response`의 Total Count는 1, `Calls To Another Application`의 Total Count는 4입니다.

### 필터

- `Calls To Another Application`만 필터를 지원합니다. 필터를 지원하지 않는 Data Source에서는 필터 추가 버튼이 비활성화됩니다.
- `callee`는 호출 대상 Application을, `callee_host`는 호출 대상 host를 지정합니다.
- 여러 필터를 등록하면 모든 필터를 만족하는 호출만 집계합니다.
- 필터가 없으면 모든 호출 대상을 합산합니다. 이 경우 특정 대상의 실패가 다른 대상의 정상 호출에 묻힐 수 있으므로 대상을 지정합니다.
  - 예: 정상 DB 호출 9,900건과 모두 실패한 외부 API 호출 100건이 있으면 전체 Error Rate는 1%입니다.

## 4. 채널 등록

1. **Channels** 탭에서 **Add Channel**을 누릅니다.
2. 이름, 채널 종류, 수신 대상을 입력하고 **Add**를 누릅니다.

| 종류 | 수신 대상 | 비고 |
|---|---|---|
| EMAIL | User Group | User Group 구성원의 이메일로 보냅니다. |
| SMS | User Group | 운영자가 SMS 발송 구현을 등록해야 합니다. [12. Alarm Batch 실행](alarm.md#alarm-batch-ko)을 참고합니다. |
| WEBHOOK | URL | 형식은 `DEFAULT` 또는 `SLACK`. 사설 주소는 운영자가 허용한 호스트만 사용할 수 있으며, 허용되지 않은 주소는 저장되어도 알림이 발송되지 않습니다. |



채널은 다음과 같이 동작합니다.

- 수신자가 없는 User Group을 선택하면 채널 목록과 룰·템플릿의 채널 선택 화면에 경고가 표시됩니다.
- 채널은 같은 Service의 여러 룰과 템플릿에서 재사용할 수 있습니다.
- 채널 정보를 수정하면 그 채널을 사용하는 이후 알림에 모두 반영됩니다.



## 5. 템플릿과 Preset

템플릿은 여러 룰을 하나로 묶은 것입니다. 템플릿 하나를 여러 Application에 적용하면 같은 기준으로 알람을 설정할 수 있습니다.

### 템플릿 만들기

1. **Templates** 탭에서 **Add Template**을 누릅니다.
2. 템플릿에 넣을 룰을 고르고 **Start with N rules**를 누릅니다. 아래 세 그룹에서 여러 개를 함께 고를 수 있습니다.
3. 템플릿 이름, 채널, 룰을 조정하고 **Save**를 누릅니다.

| 그룹 | 설명 |
|---|---|
| Start from a preset | 기본 제공 룰 묶음. [기본 제공 Preset](alarm.md#alarm-presets-ko)을 참고합니다. |
| Copy one of my templates | 이 Service에 등록한 템플릿 |
| Import standalone rules | Application에 직접 등록한 룰 |

- 고른 룰은 새 템플릿으로 복사됩니다. 원본 Preset, 템플릿, 룰을 나중에 바꿔도 새 템플릿은 바뀌지 않습니다.
- 아무것도 고르지 않으면 **Start empty**를 눌러 빈 템플릿으로 시작합니다.



### Application에 적용

1. **Rules** 탭에서 Application을 선택합니다.
2. **Add from template**을 누르고 템플릿을 선택합니다.

이미 그 Application에 적용한 템플릿은 다시 선택할 수 없습니다.



### 템플릿 변경의 영향

| 작업 | 영향 |
|---|---|
| 템플릿 수정 | 템플릿을 적용한 모든 Application의 룰에 반영됩니다. 룰을 추가하거나 삭제해도 함께 반영됩니다. |
| 템플릿 채널 변경 | 템플릿으로 만든 모든 룰에 반영됩니다. |
| 템플릿 적용 해제 | 선택한 Application에서 그 템플릿으로 만든 룰만 삭제됩니다. |
| 템플릿 삭제 | 모든 Application에서 그 템플릿으로 만든 룰이 삭제됩니다. |

> Application에서 템플릿 룰의 값을 직접 바꾸면 그 항목은 템플릿을 수정해도 바뀌지 않습니다.

### 기본 제공 Preset <a id="alarm-presets-ko"></a>

**Agent Health Basics**: 힙, CPU, 커넥션 풀 사용률과 데드락으로 Agent 상태를 감시합니다.

| 룰 | Severity | 조건 | Check / Action |
|---|---|---|---|
| High heap usage | WARNING | 10분 동안 Heap Usage Rate MAX >= 90% | 5분 / 30분 |
| High JVM CPU usage | WARNING | 10분 동안 JVM CPU Usage Rate MAX >= 90% | 5분 / 30분 |
| High connection pool usage | CRITICAL | 10분 동안 Connection Pool Usage Rate MAX >= 90% | 5분 / 30분 |
| Deadlock detected | CRITICAL | 새 데드락 발생 | 5분 / 60분 |

**Response Quality Basics**: 에러율, 느린 응답 비율, Apdex로 응답 품질을 감시합니다.

| 룰 | Severity | 조건 | Check / Action |
|---|---|---|---|
| High error rate | CRITICAL | 5분 동안 Error Rate >= 10% | 3분 / 30분 |
| High slow rate | WARNING | 5분 동안 Slow Rate >= 20% | 3분 / 30분 |
| Apdex drop | WARNING | 5분 동안 Apdex Score < 70 | 3분 / 30분 |

## 6. 상태와 이력

### 룰 상태

| 상태 | 의미 |
|---|---|
| `NORMAL` | 조건을 만족하지 않는 상태 |
| `FIRING` | 조건을 만족해 알람이 발생한 상태 |
| `CHECK_FAILED` | 데이터 조회, 평가, 알림 준비 중 하나가 실패한 상태 |

### 이력

| 이벤트 | 기록 시점 | 알림 |
|---|---|---|
| `FIRED` | 알람이 발생해 알림을 보낼 때. Action Interval 안에 다시 발생하면 기록하지 않습니다. | 보냄 |
| `RESOLVED` | `FIRING` 또는 `CHECK_FAILED`에서 정상으로 돌아왔을 때 | 보내지 않음 |
| `CHECK_FAILED` | 검사에 처음 실패했을 때. 실패가 이어지는 동안에는 다시 기록하지 않습니다. | 보내지 않음 |

- 룰 목록에서 룰의 **Actions → History**를 누르면 현재 상태와 이력을 확인할 수 있습니다.
- 이력에는 알람이 발생한 시점의 룰 설정과 측정값이 남습니다. 이후에 룰을 수정해도 이력은 바뀌지 않습니다.



### 알림 내용

알림에는 Service, Application, 룰, 측정값이 포함됩니다.

| 버튼 | 이동하는 화면 |
|---|---|
| View Details | 알람이 발생한 시간 범위의 Service Map. Agent Stat, Agent Event 룰은 Inspector |
| Alarm History | 그 룰의 이력 |



## 7. 입력 제한

| 항목 | 제한 |
|---|---|
| 룰 이름 / 설명 | 255자 / 1000자 |
| 템플릿의 룰 | 템플릿당 30개 |
| 조건 | 조건과 그룹을 합쳐 10개, 그룹 깊이 2단 |
| 그룹 하나 | 조건 3개, 하위 그룹 2개 |
| 필터 | 룰당 5개, 값 512자 |
| Window | 1분 이상 24시간 이하 (임계값이 없는 지표는 제외) |
| Check Interval | 1, 3, 5, 10, 30, 60분 |
| Action Interval | 5, 10, 30분, 1, 6, 12, 24시간 |

## 8. 기존 알람 룰 전환

기존 룰은 자동으로 이전되지 않습니다. 기존 룰에는 Severity, Action Interval, 공용 채널이 없고 평가 구간과 검사 주기가 고정되어 있어서 그대로 옮길 수 없기 때문입니다. 아래 대응표를 보고 Service 알람 룰을 새로 등록합니다.

| 기존 checker | Data Source | 지표와 설정 |
|---|---|---|
| `SLOW_COUNT`, `SLOW_RATE` | Application Response | Slow Count, Slow Rate (%) |
| `ERROR_COUNT`, `ERROR_RATE` | Application Response | Error Count, Error Rate (%) |
| `TOTAL_COUNT` | Application Response | Total Count |
| `APDEX_SCORE` | Application Response | Apdex Score. 기존 동작과 같게 하려면 `<=`를 선택합니다. |
| `*_TO_CALLEE` | Calls To Another Application | 같은 지표. 기존 룰의 notes에 적은 호출 대상은 `callee` 또는 `callee_host` 필터로 옮깁니다. |
| `HEAP_USAGE_RATE`, `JVM_CPU_USAGE_RATE`, `SYSTEM_CPU_USAGE_RATE`, `FILE_DESCRIPTOR_COUNT` | Agent Stat | 같은 지표. 기존 동작과 같게 하려면 집계 `MAX`와 `>=`를 선택합니다. |
| `DATASOURCE_CONNECTION_USAGE_RATE` | Agent Stat | Connection Pool Usage Rate (%). 기존 동작과 같게 하려면 집계 `MAX`와 `>`를 선택합니다. |
| `DEADLOCK_OCCURRENCE` | Agent Event | Deadlock Detected |

기존 룰의 SMS, 메일, 웹훅 설정은 옮겨지지 않습니다. Service에 채널을 등록하고 룰에 연결합니다.

### 전환 순서

1. Service 알람 룰을 꺼진 상태로 만듭니다.
2. 기존 룰과 Service, 조건, 임계값, 호출 대상, 수신자를 대조합니다.
3. 기존 룰을 끄고 바로 Service 알람 룰을 켭니다.
4. 실제로 알림이 오는지, 이력이 남는지 확인합니다.

## 9. 기존 알람과 Service 알람 비교 <a id="alarm-comparison-ko"></a>

| 구분 | 기존 알람 | Service 알람 |
|---|---|---|
| 관리 단위 | Application | Service의 Application |
| 조건 | 룰당 지표 1개 | `AND`/`OR` 복합 조건 |
| 비교 방식 | checker마다 고정 (Apdex는 이하, 커넥션 풀은 초과, 나머지는 이상) | `>`, `>=`, `<`, `<=` 중 선택 |
| 평가 구간 | 5분 고정 | 룰별 Window |
| 검사 주기 | 3분 고정 | 1, 3, 5, 10, 30, 60분 |
| 반복 알림 | 연속 감지 1·3·7·15...번째에 발송 | Action Interval |
| Agent 조건 | Agent 하나라도 넘으면 발생 | `MAX`, `MIN`, `AVG` (`MAX`가 기존과 같음) |
| 호출 대상 지정 | 룰의 notes에 1개 | `callee`, `callee_host` 필터 |
| Severity | 없음 | `WARNING`, `CRITICAL` |
| 채널 | User Group과 SMS·메일·웹훅 on/off | Service 공용 채널을 룰과 템플릿에 연결 |
| 재사용 | Application마다 룰 등록 | 템플릿과 Preset |
| 이력 | 화면에서 볼 수 없음 | 룰별 상태와 이력, 알림의 이력 링크 |

# 운영 가이드

## 10. 구성 요소 <a id="alarm-components-ko"></a>

| 구성 요소 | 역할 |
|---|---|
| Pinpoint Web | 룰, 채널, 템플릿 API와 화면을 제공합니다. 별도 설정 없이 포함됩니다. |
| Alarm Batch (`alarm-batch-starter`) | 룰을 검사하고 알림을 보냅니다. 별도 프로세스로 실행합니다. |
| Pinpoint Batch (`batch`) | 오래된 알람 이력을 지웁니다. 선택 사항입니다. [이력 정리](alarm.md#alarm-history-cleanup-ko)를 확인합니다. |
| MySQL | 알람 테이블과 Spring Batch 메타데이터를 저장합니다. |
| HBase, Pinot | Alarm Batch가 지표를 조회합니다. |

- 기존 알람은 `batch` 모듈의 `alarmJob`에서 평가하며, `DEFAULT` Service의 Application만 검사합니다.
- Service 알람은 Alarm Batch에서 평가하고 발송합니다.

```mermaid
flowchart LR
    user(["사용자"])
    api["Pinpoint Web<br/>알람 API"]
    mysql[("MySQL<br/>알람 테이블")]

    subgraph batch["Alarm Batch"]
        direction TB
        eval["룰 평가<br/>10초마다"]
        send["알림 발송<br/>5초마다"]
    end

    subgraph metrics["지표 저장소"]
        direction TB
        hbase[("HBase<br/>Map 통계 · Agent Event")]
        pinot[("Pinot<br/>Agent 통계")]
    end

    ch["메일 · SMS · 웹훅"]

    user -- "룰·채널·템플릿 관리" --> api
    api -- "저장" --> mysql
    mysql <-- "룰 조회 / 상태·이력 저장" --> eval
    eval -- "지표 조회" --> metrics
    eval -. "발송 대기 등록<br/>(MySQL)" .-> send
    send -- "발송" --> ch
```

| Data Source | 조회 대상 |
|---|---|
| Application Response, Calls To Another Application | HBase Map 통계 |
| Agent Stat | Pinot Agent 통계 테이블 |
| Agent Event | HBase Agent Event |

> Pinpoint Web은 알람 API에 권한 검사를 적용하지 않습니다. Web에 접근할 수 있는 사용자는 모든 Service의 룰, 채널, 템플릿을 조회하고 수정할 수 있습니다.

## 11. DB 준비

MySQL 8.4 이상을 권장합니다. 알람 테이블의 설정 컬럼은 JSON 타입입니다.

다음 스크립트로 알람 테이블을 만듭니다.

```text
alarm/alarm-common/src/main/resources/sql/alarm/CreateTableStatement-mysql.sql
```

| 구분 | 테이블 |
|---|---|
| 템플릿 | `alarm_template`, `alarm_template_item` |
| 룰 | `alarm_rule_v2`, `alarm_rule_local_config` |
| 채널 | `alarm_notification_channel`, `alarm_channel_binding` |
| 평가 상태와 이력 | `alarm_state`, `alarm_history_v2` |
| 발송 대기열 | `alarm_notification_outbox` |

Alarm Batch는 Spring Batch 메타데이터 스키마를 자동으로 만들지 않습니다. 다음 스크립트로 직접 만듭니다.

```text
web/src/main/resources/sql/SpringBatchJobRepositorySchema-mysql.sql
```

## 12. Alarm Batch 실행 <a id="alarm-batch-ko"></a>

- 실행 파일: `pinpoint-alarm-batch-starter-<version>-exec.jar`
- 컨테이너 이미지: `pinpoint-alarm-batch`
- 외부 설정 파일: `-Dpinpoint.alarm.batch.config.location=<경로>`

### 필수 설정

| 항목 | 설정 | 비고 |
|---|---|---|
| MySQL | `jdbc.properties` | Web과 같은 알람 테이블을 사용해야 합니다. |
| Spring Batch 메타데이터 | `spring.meta-datasource.*` | 지정하지 않으면 MySQL 설정과 같은 DB를 사용합니다. |
| HBase | `hbase.properties` | |
| Pinot | `spring.pinot-datasource.*` | |
| Agent 통계 테이블 | `alarm.agent-stat.table.prefix`, `alarm.agent-stat.table.padding-length`, `alarm.agent-stat.table.count` | 값이 없으면 시작에 실패합니다. release 프로필에는 주석으로만 들어 있으므로 직접 지정합니다. |

### 알림 설정

| 항목 | 설정 | 비고 |
|---|---|---|
| 알림 링크 | `alarm.pinpoint.web.url` | 비어 있으면 알림에 View Details와 Alarm History 링크가 없습니다. |
| 메일 | `alarm.email.sender`, `spring.mail.*` | `alarm.email.sender`가 비어 있으면 메일을 보내지 않습니다. |
| 웹훅 사설 주소 허용 | `pinpoint.webhook.allowed-private-hosts`, `pinpoint.webhook.allowed-private-host-suffixes` | 기본값은 모든 사설 주소 차단 |
| SMS | `SmsAlarmSender` 빈 | 기본 구현이 없습니다. 아래 설명을 참고합니다. |

SMS 채널을 사용하려면 다음을 구현해 `SmsAlarmSender` 빈으로 등록합니다.

- `SmsDispatcher`: 전화번호 목록과 메시지를 받아 실제로 SMS를 보냅니다.
- `UserGroupPhoneResolver`: User Group 구성원의 전화번호를 찾습니다.

등록하지 않으면 SMS 채널로는 알림을 보내지 않고, 실패 내용을 알람 이력에 남깁니다. 같은 룰의 다른 채널은 정상으로 발송됩니다.

### 조정할 수 있는 값

| 설정 | 기본값 | 설명 |
|---|---|---|
| `pinpoint.modules.batch.alarm.fixedDelayMs` | `10000` | 룰 검사 주기(ms) |
| `pinpoint.modules.batch.alarm.batchSize` | `300` | 한 번에 읽는 룰 수 |
| `pinpoint.modules.batch.alarm.worker.coreSize`, `.maxSize` | `4`, `4` | 룰 평가 스레드 수 |
| `pinpoint.modules.batch.alarm.jobName` | `alarmEvaluationJob` | 기존 알람(`alarmJob`)과 메타데이터 스키마를 함께 쓸 때 구분하는 이름 |
| `pinpoint.modules.batch.alarm.outbox.fixedDelayMs` | `5000` | 알림 발송 주기(ms) |
| `pinpoint.modules.batch.alarm.outbox.batchSize` | `100` | 한 번에 보내는 알림 수 |
| `pinpoint.modules.batch.alarm.outbox.maxAttempts` | `5` | 첫 시도를 포함한 최대 발송 시도 횟수 (1~255) |
| `pinpoint.modules.batch.alarm.outbox.leaseSec` | `60` | 발송 중인 알림을 다른 프로세스가 가져가지 않는 시간(초) |
| `alarm.pinpoint.web.alarm-path` | `/config/alarm` | Alarm History 링크의 경로 |

### 이력 정리 <a id="alarm-history-cleanup-ko"></a>

오래된 알람 이력은 `batch` 모듈의 `alarmHistoryCleanupJob`이 지웁니다. 이 잡은 Alarm Batch가 아니라 Pinpoint Batch에서 실행되며, Pinpoint Batch의 `jdbc.properties`에 설정한 MySQL을 사용합니다. 기본값은 꺼짐입니다.

| 설정 | 기본값 | 설명 |
|---|---|---|
| `job.cleanup.alarm.history.enable` | `false` | 정리 잡 사용 여부 |
| `job.cleanup.alarm.history.cron` | `0 30 3 * * *` | 실행 주기 |
| `job.cleanup.alarm.history.expiration-days` | `14` | 보관 기간(일). 이보다 오래된 이력을 지웁니다. |
| `job.cleanup.alarm.history.chunk-size` | `5000` | 한 번에 지우는 행 수 |

발송을 마친 대기열(`alarm_notification_outbox`의 `SENT`, `DEAD`)을 먼저 지우고 이력(`alarm_history_v2`)을 지웁니다. 발송을 기다리는 알림이 있는 이력은 그 알림의 발송이 끝날 때까지 남습니다.

---

## File: documents/application-inspector.md

---
title: How to use Application Inspector
keywords: 'inspector, how, how-to'
last_updated: 'Feb 1, 2018'
sidebar: mydoc_sidebar
permalink: applicationinspector.html
disqus: false
---

# How to use Application Inspector

[English](application-inspector.md#application-inspector) \| [한국어](application-inspector.md#application-inspector-1)

## Application Inspector

### 1. Introduction

Application inspector provides an aggregate view of all the agent's resource data \(cpu, memory, tps, datasource connection count, etc\) registered under the same application name. A separate view is provided for the application inspector with stat charts similar to the agent inspector.

To access application inspector, click on the application inspector menu on the left side of the screen.

* 1 : application inspector menu, 2 : application stat data

  

The Heap Usage chart above for example, shows the average\(Avg\), smallest\(Min\), greatest\(Max\) heap usage of the agents registered under the same application name along with the id of the agent that had the smallest/greatest heap usage at a certain point in time. The application inspector also provides other statistics found in the agent inspector in a similar fashion.



Application inspector requires [flink](https://flink.apache.org) and [zookeeper](https://zookeeper.apache.org/). Please read on for more detail.

### 2. Architecture



**A.** Run a streaming job on [flink](https://flink.apache.org).  
**B.** The taskmanager server is registered to zookeeper as a data node once the job starts.  
**C.** The Collector obtains the flink server info from zookeeper to create a tcp connection with it and starts sending agent data.  
**D.** The flink server aggregates data sent by the Collector and stores them into hbase.

### 3. Configuration

In order to enable application inspector, you will need to do the following and run Pinpoint.

**A.** Create **ApplicationStatAggre** table \(refer to [create table script](https://github.com/pinpoint-apm/pinpoint/tree/master/hbase/scripts)\), which stores application stat data.

**B.** Configure zookeeper address in [Pinpoint-flink.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/flink/src/main/resources/pinpoint-flink.properties) which will be used to store flink's taskmanager server information.

```text
    flink.cluster.enable=true
    flink.cluster.zookeeper.address=YOUR_ZOOKEEPER_ADDRESS
    flink.cluster.zookeeper.sessiontimeout=3000
    flink.cluster.zookeeper.retry.interval=5000
    flink.cluster.tcp.port=19994
```

**C.** Configure job execution type and the number of listeners to receive data from the Collector in [Pinpoint-flink.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/flink/src/main/resources/profiles/release/pinpoint-flink.properties).

* If you are running a flink cluster, set _flink.StreamExecutionEnvironment_ to **server**.
* If you are running flink as a standalone, set _flink.StreamExecutionEnvironment_ to **local**.

  ```text
    flink.StreamExecutionEnvironment=server
  ```

**D.** Configure hbase address in [hbase.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/flink/src/main/resources/profiles/release/hbase.properties) which will be used to store aggregated application data.

```text
    hbase.client.host=YOUR_HBASE_ADDRESS
    hbase.client.port=2181
```

**E.** Build [Pinpoint-flink](https://github.com/pinpoint-apm/pinpoint/tree/master/flink) and run the streaming job file created under _target_ directory on the flink server.

* The name of the streaming job is `pinpoint-flink-job-{pinpoint.version}.jar`.
* For details on how to run the job, please refer to the [flink website](https://flink.apache.org).
* You must put `spring.profiles.active release` or`spring.profiles.active local` as the job parameter so that the job can refer to the configuration file configured above when running. It must be entered because it uses the spring profile function inside the job to refer to the configuration file.

**F.** Configure zookeeper address in [Pinpoint-Collector.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/collector/src/main/resources/profiles/release/pinpoint-collector.properties) so that the Collector can connect to the flink server.

```text
    flink.cluster.enable=true
    flink.cluster.zookeeper.address=YOUR_ZOOKEEPER_ADDRESS
    flink.cluster.zookeeper.sessiontimeout=3000
```

**G.** Enable application inspector in the web-ui by enabling the following configuration in [pinpoint-web.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/web/src/main/resources/pinpoint-web-root.properties).

```text
    config.show.applicationStat=true
```

### 4. Monitoring Streaming Jobs

There is a batch job that monitors how Pinpoint streaming jobs are running. To enable this batch job, configure the following files for _Pinpoint-web_.

**batch.properties**

```text
batch.flink.server=FLINK_MANGER_SERVER_IP_LIST
# Flink job manager server IPs, separated by ','.
# ex) batch.flink.server=123.124.125.126,123.124.125.127
```

**applicationContext-batch-schedule.xml**

```markup
<task:scheduled-tasks scheduler="scheduler">
    ...
    <task:scheduled ref="batchJobLauncher" method="flinkCheckJob" cron="0 0/10 * * * *" />
</task:scheduled-tasks>
```

If you would like to send alarms in case of batch job failure, you must implement `com.navercorp.pinpoint.web.batch.JobFailMessageSender class` and register it as a Spring bean.

### 5. Others

For more details on how to install and operate flink, please refer to the [flink website](https://flink.apache.org).

## Application Inspector

### 1. 기능 설명

application inspector 기능은 agent들의 리소스 데이터\(stat : cpu, memory, tps, datasource connection count\)를 집계하여 데이터를 보여주는 기능이다. 참고로 application은 agent의 그룹으로 이뤄진다. 그리고 agent의 리소스 데이터는 agent inspector 화면에서 에서 볼 수 있다. application inspector 기능 또한 별도의 화면에서 확인할 수 있다.

inspector 화면 왼쪽 메뉴의 링크를 클릭하면 application inspector 버튼을 클릭하고 데이터를 볼 수 있다.

* 1 : application inspector menu, 2: application stat data

  

예를들면 A라는 application에 포함된 agent들의 heap 사용량을 모아서 heap 사용량 평균값 , heap 사용량의 평균값, heap 사용량이 가장 높은 agentid와 사용량, heap 사용량이 가장 적은 agentid와 사용량을 보여준다. 이외에도 agent inspector 에서 제공하는 다른 데이터들도 집계하여 application inspector에서 제공한다.



application inspector 기능을 동작시키기 위해서는 [flink](https://flink.apache.org)와 [zookeeper](https://zookeeper.apache.org/)가 필요하고, 기능의 동작 구조와 구성 및 설정 방법을 아래 설명한다.

### 2. 동작 구조

application inspector 기능의 동작 및 구조를 그림과 함께 보자.



**A.** [flink](https://flink.apache.org)에 streaming job을 실행시킨다.  
**B.** job이 실행되면 taskmanager 서버의 정보가 zookeeper의 데이터 노드로 등록이 된다.  
**C.** Collector는 zookeeper에서 flink 서버의 정보를 가져와서 flink 서버와 tcp 연결을 맺고 agent stat 데이터를 전송한다.  
**D.** flink 서버에서는 agent 데이터를 집계하여 통계 데이터를 hbase에 저장한다.

### 3. 기능 실행 방법

application inspector 기능을 실행하기 위해서 아래와 같이 설정을 변경하고 Pinpoint를 실행해야 한다.

**A.** [테이블 생성 스크립트를 참조](https://github.com/pinpoint-apm/pinpoint/tree/master/hbase/scripts)하여 application 통계 데이터를 저장하는 **ApplicationStatAggre** 테이블을 생성한다.

**B.** flink 프로젝트 설정파일\([Pinpoint-flink.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/flink/src/main/resources/profiles/release/pinpoint-flink.properties)\)에 taskmanager 서버 정보를 저장하는 zookeeper 주소를 설정한다.

```text
    flink.cluster.enable=true
    flink.cluster.zookeeper.address=YOUR_ZOOKEEPER_ADDRESS
    flink.cluster.zookeeper.sessiontimeout=3000
    flink.cluster.zookeeper.retry.interval=5000
    flink.cluster.tcp.port=19994
```

**C.** flink 프로젝트 설정파일\([Pinpoint-flink.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/flink/src/main/resources/profiles/release/pinpoint-flink.properties)\)에 job의 실행 방법과 Collector에서 데이터를 받는 listener의 개수를 설정한다.

* flink를 cluster로 구축해서 사용한다면 _flink.StreamExecutionEnvironment_에는 **server**를 설정한다.
* flink를 Standalone 형태로 실행한다면 _flink.StreamExecutionEnvironment_에는 **local**을 설정한다.

```text
    flink.StreamExecutionEnvironment=server
    flink.sourceFunction.Parallel=1
```

**D.** flink 프로젝트 설정파일\([hbase.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/flink/src/main/resources/profiles/release/hbase.properties)\)에 집계 데이터를 저장하는 hbase 주소를 설정한다.

```text
    hbase.client.host=YOUR_HBASE_ADDRESS
    hbase.client.port=2181
```

**E.** [flink 프로젝트](https://github.com/pinpoint-apm/pinpoint/tree/master/flink)를 빌드하여 target 폴더 하위에 생성된 streaming job 파일을 flink 서버에 job을 실행한다.

* streaming job 파일 이름은 `pinpoint-flink-job-{pinpoint.version}.jar` 이다.
* 실행방법은 [flink 사이트](https://flink.apache.org)를 참조한다.
* 반드시 실행시 job이 위에서 설정한 설정파일을 참고 할수 있도록 job parameter로 `spring.profiles.active release` or `spring.profiles.active local`를 넣어주야 한다. job 내부에서 spring profile 기능을 사용하여 설정파일을 참고 하고 있기때문에 반드시 입력해야한다.

**F.** Collector에서 flink와 연결을 맺을 수 있도록 설정파일\([Pinpoint-Collector.properties](https://github.com/pinpoint-apm/pinpoint/blob/master/collector/src/main/resources/pinpoint-collector.properties)\)에 zookeeper 주소를 설정한다.

```text
    flink.cluster.enable=true
    flink.cluster.zookeeper.address=YOUR_ZOOKEEPER_ADDRESS
    flink.cluster.zookeeper.sessiontimeout=3000
```

**G.** web에서 application inspector 버튼을 활성화 하기 위해서 설정파일\(pinpoint-web.properties\)을 수정한다.

```text
    config.show.applicationStat=true
```

### 4. streaming job 동작 확인 모니터링 batch

Pinpoint streaming job이 실행되고 있는지 확인하는 batch job이 있다. batch job을 동작 시키고 싶다면 Pinpoint web 프로젝트의 설정 파일을 수정하면 된다.

**batch.properties**

```text
batch.flink.server=FLINK_MANGER_SERVER_IP_LIST
#`batch.flink.server` 속성 값에 flink job manager 서버 IP를 입력하면 된다. 서버 리스트의 구분자는 ','이다.
# ex) batch.flink.server=123.124.125.126,123.124.125.127
```

**applicationContext-batch-schedule.xml**

```markup
<task:scheduled-tasks scheduler="scheduler">
    ...
    <task:scheduled ref="batchJobLauncher" method="flinkCheckJob" cron="0 0/10 * * * *" />
</task:scheduled-tasks>
```

batch job이 실패할 경우 알람이 전송되도록 기능을 추가 하고싶다면 `com.navercorp.pinpoint.web.batch.JobFailMessageSender class` 구현체를 만들고 bean으로 등록하면 된다.

### 5. 기타

자세한 flink 운영 설치에 대한 내용은 [flink 사이트](https://flink.apache.org)를 참고하자.

---

## File: documents/error_analysis.md

[English](error_analysis.md#error-analysis) | [한국어](error_analysis.md#error-analysis-ko)

# Error Analysis <a id="error-analysis"></a>



Error Analysis is a new feature introduced in Pinpoint v3.0.0.

The Pinpoint agent collects more detailed exception information and transmits it to the Pinpoint collector via gRPC. The Pinpoint collector then stores this data in Apache Pinot through Apache Kafka. You can view the stored Error Analysis data in the Pinpoint web interface.

# 1. Installation and Configuration Guide

## 1.1. Pinot and Kafka Setup

If Pinot and Kafka are already installed, you can skip this setup step. Otherwise, set them up by following the [Pinot installation guide](../getting-started/installation.md#pinot) before creating Error Analysis topics and tables.

## 1.2. Create Kafka Topics

You need to create a topic named `exception-trace`.
Use the following command to create the `exception-trace` topic:
```shell
$ bin/kafka-topics.sh --create --topic exception-trace --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
```

## 1.3. Create Pinot Tables

Pinpoint Error Analysis requires [CLP (Compressed Log Processor)](https://docs.pinot.apache.org/basics/data-import/clp), supported from Pinot version 1.0.0, to appropriately process and group error messages. Please ensure you are using the correct version.

Due to the binary issue with `clp-ffi-java`, we recommend using an amd64-based / x86-based machine when installing Pinot version 1.0.0. [Related Issue](https://github.com/pinpoint-apm/pinpoint/issues/11170)

Create the following table in Pinot:
- `exceptionTrace`

Refer to the [table schema file](https://github.com/pinpoint-apm/pinpoint/tree/master/exceptiontrace/exceptiontrace-common/src/main/pinot) for details on creating the table.

## 1.4. Pinpoint Agent Configuration

This section covers the settings related to Error Analysis data collection. The default settings for the release profile are as follows:

```config
###########################################################
# Exception Trace
###########################################################
profiler.exceptiontrace.enable=true
# Permits per second
profiler.exceptiontrace.new.throughput=1000
profiler.exceptiontrace.errormessage.max=2048
# Permits depth of exception. if max depth is 0, it is unlimited.
profiler.exceptiontrace.max.depth=5
profiler.exceptiontrace.io.buffering.buffersize=20
```

- `profiler.exceptiontrace.enable`
  - `true`: Collects exceptions that occur. **Default**
  - `false`: Does not collect exceptions that occur.
- `profiler.exceptiontrace.new.throughput`
  - **Default**: `1000`
  - Determines how many exceptions per second to collect from the agent.
- `profiler.exceptiontrace.errormessage.max`
  - **Default**: `2048`
  - Determines the maximum length of the error message for exceptions collected by the agent.
- `profiler.exceptiontrace.max.depth`
  - **Default**: `5`
  - Determines the depth to traverse the exception chain.
  - If the value is 0, it will traverse until `Throwable.getCause()` returns null.
- `profiler.exceptiontrace.io.buffering.buffersize`
  - **Default**: `20`
  - Determines the number of exceptions to buffer.
  - This buffer is approximately the size of the buffer generated per Span.

## 1.5. Pinpoint Collector and Web Configuration and Execution

### 1.5.1. Collector Configuration and Execution

Configure and run the [collector starter](../getting-started/installation.md#collector-starter) with `BASIC` or `ALL` type before enabling exception storage.

Ensure that `pinpoint.modules.collector.exceptiontrace.enabled=true` is set to enable exception storage. **Default**: `true`

### 1.5.2. Web Configuration and Execution

Configure and run the [web starter](../getting-started/installation.md#web-starter) before reading exception data.

Additionally, ensure that `pinpoint.modules.web.exceptiontrace.enabled=true` is set to enable reading exception data. **Default**: `true`

For Error Analysis, the following setting is added to `pinpoint-web-metric.properties` to control whether the Error Analysis item is displayed in the side menu. **Default**: `true`
```config
config.show.exceptionTrace=true
```

---

# Error Analysis <a id="error-analysis-ko"></a>

Error Analysis 는 핀포인트 v3.0.0 에 신규로 추가되었다.
핀포인트 에이전트에서 보다 상세한 Exception 정보를 수집하여 gRPC 를 통해 핀포인트 콜렉터로 전달한다.
핀포인트 콜렉터는 이를 아파치 카프카를 통해 아파치 피노에 값을 저장한다.
핀포인트 웹에서 저장된 Error Analysis 를 확인할 수 있다.

# 1. 설치 및 설정 방법

## 1.1. Pinot와 Kafka 준비
Pinot와 Kafka가 이미 설치되어 있다면 이 준비 단계는 건너뛰어도 됩니다. 아직 설치하지 않았다면 Error Analysis용 topic과 table을 생성하기 전에 [Pinot 설치 가이드](../getting-started/installation.md#pinot)를 참고하여 Pinot와 Kafka를 준비합니다.

## 1.2. Kafka topic 생성
`exception-trace` 라는 이름의 topic 을 생성해야 한다.
아래와 같이 `exception-trace` 토픽을 생성한다.
```shell
$ bin/kafka-topics.sh --create --topic exception-trace --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
```

## 1.3. Pinot table 생성
핀포인트는 Error Message 를 적절히 처리하고 그룹화하기 위해 Pinot 1.0.0 부터 지원하는 [CLP (Compressed Log Processor)](https://docs.pinot.apache.org/basics/data-import/clp) 가 필요하다. 버전에 주의할 것.

피노 Pinot 에 다음 테이블을 새로 생성한다.
- `exceptionTrace`
[테이블 생성 스키마 파일](https://github.com/pinpoint-apm/pinpoint/tree/master/exceptiontrace/exceptiontrace-common/src/main/pinot)의 테이블 정보를 참고하여 생성한다.

## 1.4 핀포인트 에이전트 설정

Error Analysis 데이터 수집과 관련된 설정이다.
release 프로필의 기본 설정은 다음과 같다.

```config
###########################################################
# Exception Trace
###########################################################
profiler.exceptiontrace.enable=true
# Permits per second
profiler.exceptiontrace.new.throughput=1000
profiler.exceptiontrace.errormessage.max=2048
# Permits depth of exception. if max depth is 0, it is unlimited.
profiler.exceptiontrace.max.depth=5
profiler.exceptiontrace.io.buffering.buffersize=20
```
- `profiler.exceptiontrace.enable`
	- `true`: 발생하는 exception 을 수집한다. **기본값**
	- `false` : 발생하는 exception 을 수집하지 않는다.
- `profiler.exceptiontrace.new.throughput`
	- **기본값** 1000
	- 해당 에이전트에서 초당 몇개까지의 exception 을 수집할지 결정한다. 
- `profiler.exceptiontrace.errormessage.max`
	- **기본값** 2048
	- 해당 에이전트에서 발생하는 exception 의 error message 를 몇자까지 수집할지 결정한다.
- `profiler.exceptiontrace.max.depth`
	- **기본값** 5
	- exception chain 이 주어졌을 때, 깊이를 어느정도 순회할지 결정한다.
	- 값이 0이면 Throwable.getCause() 가 null 일 때까지 순회한다.
- `profiler.exceptiontrace.io.buffering.buffersize`
	- **기본값** 20
	- buffer 에 exception 을 몇개까지 쌓아둘지 결정한다.
	- 해당 buffer 는 대략 Span 단위로 생성되는 buffer 이다.


## 1.5 핀포인트 콜렉터와 핀포인트 웹 설정 및 실행

### 1.5.1. collector 설정 및 실행
exception 저장을 활성화하려면 [collector starter](../getting-started/installation.md#collector-starter)를 `BASIC` 또는 `ALL` 타입으로 실행한다.

이에 추가적으로
`pinpoint.modules.collector.exceptiontrace.enabled=true`
로 되어있어야 exception 을 저장한다. **기본값** `true`

### 1.5.2 web 설정 및 실행
exception 데이터를 읽으려면 [web starter](../getting-started/installation.md#web-starter)를 실행한다.

이에 추가적으로
`pinpoint.modules.web.exceptiontrace.enabled=true`
로 되어있어야 exception 데이터를 읽어온다. **기본값** `true`

위 설정 외에 Error Analysis 를 위해 pinpoint-web-metric.properties에 아래 설정값이 추가되었다:
이 설정은 좌측 사이드 메뉴에서 Error Analysis 항목을 노출시킬지 결정한다.
**기본값**`true`
- ```
	config.show.exceptionTrace=true
	```

---

## File: documents/hbase-table-changes.md

# HBase Table Changes

## 3.1.0

Table creation scripts for 3.1.0:

- [hbase-create.hbase](https://github.com/pinpoint-apm/pinpoint/blob/v3.1.0/hbase/scripts/hbase-create.hbase)
- [hbase-create-snappy.hbase](https://github.com/pinpoint-apm/pinpoint/blob/v3.1.0/hbase/scripts/hbase-create-snappy.hbase)

### Before You Start

Create the new HBase tables before changing table-related properties or starting upgraded components.

The property values shown below are the 3.1.0 defaults and use the new tables.

### Upgrade Order

1. Create the new HBase tables.
2. Enable dual write for each feature (see each feature's **Transition**).
3. Switch reads to the legacy tables during migration (see each feature's **Transition**).
4. Run the copy APIs to migrate historical data, if supported.
5. Switch reads back to the new tables, if changed in step 3.
6. Disable legacy writes once the new tables are confirmed healthy.

### Application & Agent List

#### Tables

`ApplicationIndex` is split into two new tables:

| Legacy | New |
|---|---|
| `ApplicationIndex` | `Application`, `AgentId` |

#### Properties

**Collector**

```properties
pinpoint.collector.application.index.v1.enabled=false
pinpoint.collector.application.index.v2.enabled=true
```

**Web**

```properties
# v1/v2 enabled properties are used for delete operations.
pinpoint.web.application.index.v1.enabled=false
pinpoint.web.application.index.v2.enabled=true
pinpoint.web.application.index.read.v2=true
```

**Batch**

```properties
pinpoint.batch.application.index.read.v2=true

# Legacy ApplicationIndex cleanup
job.cleanup.inactive.applications.enable=true
job.cleanup.inactive.applications.cron=0 0 3 * * THU
job.cleanup.inactive.applications.emptydurationthreshold=P35D
# - emptyItemWriter: Not actually removes application
# - cleanTargetWriter: Actually removes application
job.cleanup.inactive.applications.writer=emptyItemWriter

# New Application and AgentId table cleanup
# Disabled by default; enable after verifying with dry-run.
job.cleanup.inactive.agent-application.enable=false
job.cleanup.inactive.agent-application.cron=0 0 4 * * THU
# Test run only. Does not delete data.
job.cleanup.inactive.agent-application.dry-run=true
job.cleanup.inactive.agent-application.threshold-days=30
```

#### Transition

- Collector: set `pinpoint.collector.application.index.v1.enabled=true` for dual write.
- Web: set `pinpoint.web.application.index.v1.enabled=true` to delete from the legacy table during migration.
- Web: set `pinpoint.web.application.index.read.v2=false` to read from the legacy table during migration.
- Batch: set `pinpoint.batch.application.index.read.v2=false` to read from the legacy table during migration.

#### Data Migration

Application & Agent List supports historical data migration through Web copy APIs.

| API | Description |
|---|---|
| `/api/admin/copy/applications` | Copy all application index data |
| `/api/admin/copy/agents/all` | Copy all agent index data, using more time and resources |
| `/api/admin/copy/agents?durationDays=30` | Copy agent index data for recent `durationDays` |
| `/api/admin/copy/agents?applicationName=app` | Copy agent index data for a specific `applicationName` |
| `/api/admin/copy/agents?serviceTypeCode=1000` | Copy agent index data for a specific `serviceTypeCode` |

Notes:

- Copy APIs are exposed on the Web component.
- Agent copy APIs use the `AgentInfo` table; Java agents send `AgentInfo` periodically, so `durationDays` can include long-running active agents.
- Some agents may not send `AgentInfo` periodically; use `serviceTypeCode` for them.
- `durationDays` and `/agents/all` copy a wider range of data, so they may take longer to complete.
- `applicationName` and `serviceTypeCode` copy the least required data.

Example:

```bash
# copy all applications
curl -X POST /api/admin/copy/applications

# copy all agents
curl -X POST /api/admin/copy/agents/all

# copy agents for recent 30 days
curl -X POST "/api/admin/copy/agents?durationDays=30"

# copy agents for a specific application
curl -X POST "/api/admin/copy/agents?applicationName=my-app"

# copy agents for a specific service type
curl -X POST "/api/admin/copy/agents?serviceTypeCode=1000"
```

### ServerMap

#### Tables

`ApplicationMapStatisticsSelf_Ver2` is split into two new tables:

| Legacy | New |
|---|---|
| `HostApplicationMap_Ver2` | `MapAppHost` |
| `ApplicationMapStatisticsCaller_Ver2` | `MapAppOut` |
| `ApplicationMapStatisticsCallee_Ver2` | `MapAppIn` |
| `ApplicationMapStatisticsSelf_Ver2` | `MapAppSelf`, `MapAgentSelf` |

#### Properties

**Collector**

```properties
# v2: legacy table, v3: new table, dual: dual write for data migration
pinpoint.modules.uid.version=v3
```

**Web**

```properties
# v2: legacy table, v3: new table
pinpoint.modules.uid.version=v3
```

#### Transition

- Collector: set `pinpoint.modules.uid.version=dual` for dual write.
- Web: set `pinpoint.modules.uid.version=v2` to read from the legacy tables during migration.

### TraceIndex

#### Tables

| Legacy | New |
|---|---|
| `ApplicationTraceIndex` | `TraceIndex` |

#### Properties

**Collector**

```properties
pinpoint.collector.application.trace.index.v1.enabled=false
pinpoint.collector.application.trace.index.v2.enabled=true
```

**Web**

```properties
pinpoint.web.trace.index.read.v2=true
```

#### Transition

- Collector: set `pinpoint.collector.application.trace.index.v1.enabled=true` for dual write.
- Web: set `pinpoint.web.trace.index.read.v2=false` to read from the legacy table during migration.

---

## File: documents/hbase-upgrade.md

---
title: Hbase Upgrade
keywords: 'hbase, upgrade'
last_updated: 'Mar 8, 2019'
sidebar: mydoc_sidebar
permalink: hbaseupgrade.html
disqus: false
---

# Upgrade Database Hbase2

### Do you like to use Hbase 2.x for Pinpoint? <a id="do-you-like-to-use-hbase-2x-for-pinpoint"></a>

Default settings of current releases are for Hbase 1.x.

If you'd like to use Hbase 2.x for Pinpoint database.

check out [Hbase2-module](https://github.com/pinpoint-apm/pinpoint/tree/master/hbase2-module).

---

## File: documents/heatmap.md

[English](heatmap.md#heatmap) | [한국어](heatmap.md#heatmap-ko)


# 1 Overview <a id="heatmap"></a>

Heatmap is a new visualization feature introduced in Pinpoint v3.1.0. It provides a statistics-based view of transaction response time distribution alongside the existing Scatter Chart.

While Scatter Chart plots every individual transaction, Heatmap aggregates transactions into time/elapsed-time buckets and displays density using color intensity. This approach significantly improves rendering performance for high-volume applications and makes it easier to quickly grasp overall transaction distribution patterns.

Both views coexist — users can switch between Heatmap and Scatter Chart via a toggle button.



# 2 Architecture

Heatmap data flows through the following pipeline:

1. Pinpoint Agent sends span data to Pinpoint Collector via gRPC.
2. Collector aggregates response time data and publishes to Kafka (`heatmap-stat-app-*` topics).
3. Apache Pinot ingests from Kafka into the `heatmapStatApp` table, aggregating counts per time bucket (10-second intervals).
4. Pinpoint Web queries Pinot to render the heatmap visualization.

Pinot schema and table configuration details are described in [section 3.3](#33-create-pinot-tables) below.

# 3 Installation and Configuration

## 3.1 Pinot and Kafka Setup

If Pinot and Kafka are already installed, you can skip this step. Otherwise, set them up by following the [Pinot installation guide](../getting-started/installation.md#pinot) before creating Heatmap topics and tables.

## 3.2 Create Kafka Topics

Create a Kafka topic with the name below:

- `heatmap-stat-app-00`

```
$ bin/kafka-topics.sh --create --topic heatmap-stat-app-00 --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
```

The topic name follows the pattern `{prefix}{index}`, where `prefix` is `heatmap-stat-app-` and `index` is zero-padded to 2 digits.

## 3.3 Create Pinot Tables

Create the `heatmapStatApp` table in both REALTIME and OFFLINE modes (hybrid table) for optimal query performance.

Schema and table configuration files are located in [`collector/src/main/pinot/`](https://github.com/pinpoint-apm/pinpoint/tree/master/collector/src/main/pinot):

| File | Description |
|---|---|
| `pinot-heatmap-stat-application-schema.json` | Table schema |
| `pinot-heatmap-stat-application-realtime-table.json` | Realtime table config |
| `pinot-heatmap-stat-application-offline-table.json` | Offline table config |

Refer to the [Pinot documentation](https://docs.pinot.apache.org/basics/components/table#streaming-table-creation) for table creation instructions.

Default retention is defined in the table configuration files. You can adjust it in the Pinot table settings as needed.

## 3.4 Configure and Run Pinpoint Collector and Web

### Collector

Configure and run the [collector starter](../getting-started/installation.md#collector-starter) with `BASIC` or `ALL` type.

Heatmap is enabled by default in the `application.yml` of `collector-starter`:

```yaml
pinpoint:
  modules:
    collector:
      heatmap:
        enabled: true
```

Collector Kafka settings are configured by default in `heatmap-collector.properties`:

```properties
kafka.heatmap.topic.count=1
kafka.heatmap.topic.prefix=heatmap-stat-app-
kafka.heatmap.topic.padding.length=2
kafka.heatmap.key.partition.count=1
```

### Web

Configure and run the [web starter](../getting-started/installation.md#web-starter).

Heatmap is enabled by default in the `application.yml` of `web-starter`:

```yaml
pinpoint:
  modules:
    web:
      heatmap:
        enabled: true
```

Web Pinot settings are configured by default in `heatmap-web.properties`:

```properties
pinot.heatmap.topic.count=1
pinot.heatmap.topic.prefix=heatmap-stat-
pinot.heatmap.topic.padding.length=2
```

# 4 Usage

1. Select an application in Pinpoint Web.
2. Click the toggle button on the Scatter Chart area to switch to the Heatmap view.
3. The heatmap displays transaction distribution with color intensity indicating density — darker colors represent higher transaction counts.
4. Click on a cell to drill down into the individual transactions for that time/response-time range.

# 5 Scatter Chart vs Heatmap

| | Scatter Chart | Heatmap |
|---|---|---|
| Data | Individual transactions | Aggregated statistics |
| Performance | Degrades with high volume | Consistent regardless of volume |
| Use case | Detailed analysis of individual transactions | Quick overview of distribution patterns |
| Storage | HBase (real-time) | Pinot (pre-aggregated) |

# 6 Notes

- Heatmap feature is enabled by default starting from v3.1.0.
- No additional agent configuration is required — heatmap data is derived from the same span data collected by the existing agent.
- Both Scatter Chart and Heatmap can be used simultaneously.


------------------------------------------


# 1 개요 <a id="heatmap-ko"></a>

Heatmap은 Pinpoint v3.1.0에 새로 추가된 시각화 기능입니다. 기존 Scatter Chart와 함께 트랜잭션 응답시간 분포를 통계 기반으로 보여줍니다.

Scatter Chart는 개별 트랜잭션을 하나씩 점으로 표시하지만, Heatmap은 트랜잭션을 시간/응답시간 구간별로 집계하여 색상 농도로 밀도를 표현합니다. 이 방식은 대량 트랜잭션 환경에서 렌더링 성능을 크게 향상시키며, 전체 트랜잭션 분포 패턴을 빠르게 파악할 수 있게 합니다.

두 뷰는 공존하며, 토글 버튼으로 Heatmap과 Scatter Chart를 전환할 수 있습니다.



# 2 구조

Heatmap 데이터는 다음 파이프라인으로 처리됩니다:

1. Pinpoint Agent가 gRPC로 span 데이터를 Collector에 전송합니다.
2. Collector가 응답시간 데이터를 집계하여 Kafka (`heatmap-stat-app-*` topic)에 발행합니다.
3. Apache Pinot가 Kafka에서 데이터를 수집하여 `heatmapStatApp` 테이블에 저장합니다 (10초 단위로 집계).
4. Pinpoint Web이 Pinot에서 데이터를 조회하여 heatmap을 렌더링합니다.

Pinot 스키마 및 테이블 설정은 아래 [3.3 Pinot table 생성](#33-pinot-table-생성)에서 자세히 설명합니다.

# 3 설치/설정 방법

## 3.1 Pinot와 Kafka 준비

Pinot와 Kafka가 이미 설치되어 있다면 이 준비 단계는 건너뛰어도 됩니다. 아직 설치하지 않았다면 Heatmap용 topic과 table을 생성하기 전에 [Pinot 설치 가이드](../getting-started/installation.md#pinot)를 참고하여 Pinot와 Kafka를 준비합니다.

## 3.2 Kafka topic 생성

아래 topic을 생성합니다.

- `heatmap-stat-app-00`

```
$ bin/kafka-topics.sh --create --topic heatmap-stat-app-00 --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
```

topic 이름은 `{prefix}{index}` 형식으로, prefix는 `heatmap-stat-app-`이고 index는 2자리로 zero-padding됩니다.

## 3.3 Pinot table 생성

`heatmapStatApp` 테이블을 REALTIME과 OFFLINE 모드 모두로 생성합니다 (hybrid table).

스키마 및 테이블 설정 파일은 소스코드의 [`collector/src/main/pinot/`](https://github.com/pinpoint-apm/pinpoint/tree/master/collector/src/main/pinot) 디렉토리에 있습니다.

| 파일 | 설명 |
|---|---|
| `pinot-heatmap-stat-application-schema.json` | 테이블 스키마 |
| `pinot-heatmap-stat-application-realtime-table.json` | Realtime 테이블 설정 |
| `pinot-heatmap-stat-application-offline-table.json` | Offline 테이블 설정 |

테이블 생성 방법은 [Pinot 가이드](https://docs.pinot.apache.org/basics/components/table#streaming-table-creation)를 참고하세요.

기본 retention은 테이블 설정 파일에 정의되어 있습니다. 필요에 따라 Pinot 테이블 설정에서 변경할 수 있습니다.

## 3.4 Collector와 Web 설정 및 실행

### Collector

[collector starter](../getting-started/installation.md#collector-starter)를 `BASIC` 또는 `ALL` 타입으로 실행합니다.

Heatmap 기능은 `collector-starter`의 `application.yml`에서 기본적으로 활성화되어 있습니다:

```yaml
pinpoint:
  modules:
    collector:
      heatmap:
        enabled: true
```

Collector Kafka 설정은 `heatmap-collector.properties`에 기본적으로 설정되어 있습니다:

```properties
kafka.heatmap.topic.count=1
kafka.heatmap.topic.prefix=heatmap-stat-app-
kafka.heatmap.topic.padding.length=2
kafka.heatmap.key.partition.count=1
```

### Web

[web starter](../getting-started/installation.md#web-starter)를 실행합니다.

Heatmap 기능은 `web-starter`의 `application.yml`에서 기본적으로 활성화되어 있습니다:

```yaml
pinpoint:
  modules:
    web:
      heatmap:
        enabled: true
```

Web Pinot 설정은 `heatmap-web.properties`에 기본적으로 설정되어 있습니다:

```properties
pinot.heatmap.topic.count=1
pinot.heatmap.topic.prefix=heatmap-stat-
pinot.heatmap.topic.padding.length=2
```

# 4 사용 방법

1. Pinpoint Web에서 애플리케이션을 선택합니다.
2. Scatter Chart 영역의 토글 버튼을 클릭하여 Heatmap 뷰로 전환합니다.
3. Heatmap은 색상 농도로 트랜잭션 분포를 표시합니다 — 색이 진할수록 트랜잭션 수가 많습니다.
4. 셀을 클릭하면 해당 시간/응답시간 구간의 개별 트랜잭션을 확인할 수 있습니다.

# 5 Scatter Chart vs Heatmap

| | Scatter Chart | Heatmap |
|---|---|---|
| 데이터 | 개별 트랜잭션 | 집계된 통계 |
| 성능 | 대량 데이터 시 성능 저하 | 데이터 양에 관계없이 일정 |
| 용도 | 개별 트랜잭션 상세 분석 | 분포 패턴 빠른 파악 |
| 저장소 | HBase (실시간) | Pinot (사전 집계) |

# 6 참고사항

- Heatmap 기능은 v3.1.0부터 기본으로 활성화되어 있습니다.
- 별도의 Agent 설정은 필요 없습니다 — heatmap 데이터는 기존 Agent가 수집하는 span 데이터에서 파생됩니다.
- Scatter Chart와 Heatmap을 동시에 사용할 수 있습니다.

---

## File: documents/http-status-code-failure.md

---
title: Marking Transaction as Fail
keywords: 'http, code fail, failure, http status'
last_updated: 'Feb 1, 2018'
sidebar: mydoc_sidebar
permalink: httpstatuscodefailure.html
disqus: false
---

# Marking Transaction as Fail

## HTTP Status Code with Request Failure. <a id="http-status-code-with-request-failure"></a>



## Pinpoint Configuration

pinpoint.config

```text
profiler.http.status.code.errors=5xx, 401, 403, 406
```

Comma separated list of HTTP status codes.

* 1xx: Informational\(100 ~ 199\).
  * 100: Continue
  * 101: Switching Protocols
* 2xx: Successful\(200 ~ 299\).
  * 200: OK
  * 201: Created
  * 202: Accepted
  * 203: Non-Authoritative Information
  * 204: No Content
  * 205: Reset Content
  * 206: Partial Content
* 3xx: Redirection\(300 ~ 399\).
  * 300: Multiple Choices
  * 301: Moved Permanently
  * 302: Found
  * 303: See Other
  * 304: Not Modified
  * 305: Use Proxy
  * 307: Temporary Redirect
* 4xx: Client Error\(400 ~ 499\).
  * 400: Bad Request
  * 401: Unauthorized
  * 402: Payment Required
  * 403: Forbidden
  * 404: Not Found
  * 405: Method Not Allowed
  * 406: Not Acceptable
  * 407: Proxy Authentication Required
  * 408: Request Time-out
  * 409: Conflict
  * 410: Gone
  * 411: Length Required
  * 412: Precondition Failed
  * 413: Request Entity Too Large
  * 414: Request-URI Too Large
  * 415: Unsupported Media Type
  * 416: Requested range not satisfiable
  * 417: Expectation Failed
* 5xx: Server Error\(500 ~ 599\).
  * 500: Internal Server Error
  * 501: Not Implemented
  * 502: Bad Gateway
  * 503: Service Unavailable
  * 504: Gateway Time-out
  * 505: HTTP Version not supported

Resources

* [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)

---

## File: documents/new-inspector.md

[English](new-inspector.md#new-inspector) | [한국어](new-inspector.md#new-inspector-ko)

# 1 Overview <a id="new-inspector"></a>
There has been changes in inspector in v3.0.0. The newly renewed inspector will be referred to as 'New Inspector' below, while the previous version will be referred to as 'Legacy Inspector' ([Legacy Application Inspector](https://pinpoint-apm.gitbook.io/pinpoint/v/v2.5.4/documents/application-inspector)).

Although users won't see significant changes on front-end, but the whole architecture has been rebuilt from the scratch.
The data storage has been changed from HBase to Pinot.
And the APIs have been improved so that it is more easily extenable and their responses more clear to understand.

# 2 Installation and Configuration

## 2.1 Pinot and Kafka Setup

If Pinot and Kafka are already installed, you can skip this setup step. Otherwise, set them up by following the [Pinot installation guide](../getting-started/installation.md#pinot) before creating New Inspector topics and tables.

## 2.2 Create Kafka Topics for New Inspector

Create the Kafka topics below with the partition counts shown. These counts match the `numPartitions` values in Pinpoint's default Pinot table configurations, which use `segmentPartitionConfig`.

| Kafka topic | Pinot table | Partitions |
| --- | --- | --- |
| `inspector-stat-agent-00` | `inspectorStatAgent00` | 32 |
| `inspector-stat-app` | `inspectorStatApp` | 64 |

```
$ bin/kafka-topics.sh --create --topic inspector-stat-agent-00 --partitions 32 --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
$ bin/kafka-topics.sh --create --topic inspector-stat-app --partitions 64 --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
```

## 2.3 Create Pinot Tables

- Create 2 tables with the names below:
  - inspectorStatAgent00: This table stores agent inspector data. The [script file to create the table](https://github.com/pinpoint-apm/pinpoint/tree/master/inspector-module/inspector-collector/src/main/pinot/multi-table) is provided in our github repository.
  - inspectorStatApp: This table stores application inspector data.
- Refer to the [github repository](https://github.com/pinpoint-apm/pinpoint/tree/master/inspector-module/inspector-collector/src/main/pinot) for table schema and configuration settings.

## 2.4 Configure and Run Pinpoint Collector, Web, and Batch with New Inspector
Configure and run the following with matching [Pinot connection settings](../getting-started/installation.md#pinot-connection-settings):

- [Collector starter](../getting-started/installation.md#collector-starter) with `BASIC` or `ALL` type — collects New Inspector data.
- [Web starter](../getting-started/installation.md#web-starter) — displays New Inspector data from Pinot.
- [Pinpoint Batch](../getting-started/installation.md#pinot-connection-settings) — processes New Inspector alarms.
- **New Inspector feature options are enabled by default, so no additional feature option changes are required for the configuration files provided in our github repository.**
- When upgrading from Pinpoint version below 3.0 to version 3.0.0 or above, some of the options may be missing in the configuration properties files you have been using. Please refer to the related configurations in the following section to check if any changes are needed in your settings.

# 3 Related Settings of Pinpoint Components
- The following configurations are already set by default in Pinpoint version 3.0.
- When upgrading from Pinpoint version below 3.0 to version 3.0.0 or above and when you wish to continue using customized configuration files you have been using, please check if below mentioned configurations are well set in your files.

## Pinpoint Collector
- `application.yml` file in `collector-starter` module:

```
pinpoint:
  modules:
    collector:
      inspector:
        enabled: true
```

## Pinpoint Web
- `application.yml` file in `web-starter` module:


```
pinpoint:
  modules:
    web:
      inspector:
        enabled: true
```

## Pinpoint Batch
- `batch-root.properties` file in `batch` module:


```
alarm.collector.version=2
```

# 4 Q&A

### A Can we still use the Legacy Inspector to save the data to HBase?

Yes, but Legacy Inspector will be deprecated in v3.0.1 so we recommended you to use the New Inspector.

To use Legacy Inspector with v3.0.0, you need to add the following settings to the Pinpoint components:

**Modify `application.yml` file in `collector-starter` module OR add java vm option when running Pinpoint Collector.**

- application.yml

```
pinpoint:
  modules:
    collector:
      inspector:
        hbase:
          enabled: true
```

- java vm option


```
-Dpinpoint.modules.collector.inspector.hbase.enabled=true
```

**Modify `batch-root.properties` file in `batch` module OR add java vm option when running Pinpoint Batch.**

- batch-root.properties


```
alarm.collector.version=1
```

- java vm option


```
-Dalarm.collector.version=1
```


### B Why change database to Pinot when there are no additional features provided to users?

New Inspector saves and retrieves the data faster than the Legacy Inspector thanks to Pinot. As Pinot project gets mature over time, there can be further improvements on performance or additional features can be introduced to Pinpoint Inpsector as well.

### C Reading inspector-stat-agent table becomes slow as more data is being stored.

You can improve performance by distributing the data across multiple tables. Follow the steps below to create multiple Pinot tables and Kafka topics. Then, add settings to Pinpoint components to read and write data from multiple Pinot tables.

**Create More Kafka Topics**

- Create N Kafka topics. (From 00 to N-1)
- The format of the topics is as follows:
  - inspector-stat-agent-00
  - inspector-stat-agent-01
  - ...
  - inspector-stat-agent-99

**Create More Pinot Tables**

- Create N Pinot tables. (From 00 to N-1)
  - [The script file](https://github.com/pinpoint-apm/pinpoint/tree/master/inspector-module/inspector-collector/src/main/pinot/multi-table) creating multiple Pinot tables is provided in our github repository.
- The format of the table names and schema names is as follows:
  - inspectorStatAgent00
  - inspectorStatAgent01
  - ...
  - inspectorStatAgent99

**Modify `application.yml` file in `collector-starter` module OR add java vm option when running Pinpoint Collector**

- application.yml


```
kafka:
  inspector:
    agent:
      table:
        count: N
```

- java vm option


```
-Dkafka.inspector.agent.topic.count=N
```

**Modify `application.yml` file in `web-starter` module OR add java vm option when running Pinpoint Web**

- application.yml


```
pinot:
  inspector:
    agent:
      table:
        count: N
```

- java vm option


```
-Dpinot.inspector.agent.topic.count=N
```

**Modify `batch-root.properties` file in `batch` module OR add java vm option when running Pinpoint Batch**

- batch-root.properties


```
job.alarm.agent.inspector.stat.table.count=N
```

- java vm option

```
-Djob.alarm.agent.inspector.stat.table.count=N
```


------------------------------------------


# 1 개요 <a id="new-inspector-ko"></a>
inspector가 Pinpoint v3.0.0에서 새로워졌습니다.
이하 새로워진 inspector를 'New Inspector'이라고 부르고 과거의 inspector는 'Legacy Inspector'라고 칭합니다 ([Legacy Application Inspector](https://pinpoint-apm.gitbook.io/pinpoint/v/v2.5.4/documents/application-inspector)). 

New Inspector에서 사용자가 보는 화면은 크게 달라진 건은 없습니다.
그러나 내부적으로 많은 변화가 있었습니다. 데이터를 저장하는 저장소가 HBase에서 Pinot로 변경이 되었습니다. api를 쉽게 확장할 수 있고, response를 명확한 형식으로 개편했습니다.
즉 inspector 기능을 추가하고 확장하기 쉽게 개선되었습니다.


# 2 설치/설정 방법

## 2.1 Pinot와 Kafka 준비

Pinot와 Kafka가 이미 설치되어 있다면 이 준비 단계는 건너뛰어도 됩니다. 아직 설치하지 않았다면 New Inspector용 topic과 table을 생성하기 전에 [Pinot 설치 가이드](../getting-started/installation.md#pinot)를 참고하여 Pinot와 Kafka를 준비합니다.

## 2.2 Kafka topic 생성

아래 Kafka topic을 지정된 partition 수로 생성합니다. 이 partition 수는 `segmentPartitionConfig`를 사용하는 Pinpoint 기본 Pinot table 설정의 `numPartitions` 값과 일치합니다.

| Kafka topic | Pinot table | partitions |
| --- | --- | --- |
| `inspector-stat-agent-00` | `inspectorStatAgent00` | 32 |
| `inspector-stat-app` | `inspectorStatApp` | 64 |

```
$ bin/kafka-topics.sh --create --topic inspector-stat-agent-00 --partitions 32 --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
$ bin/kafka-topics.sh --create --topic inspector-stat-app --partitions 64 --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
```


## 2.3 Pinot table 생성

- 아래 2개 테이블을 생성합니다.
  - inspectorStatAgent00: 이 테이블은 agent inspector data를 저장합니다. [스크립트](https://github.com/pinpoint-apm/pinpoint/tree/master/inspector-module/inspector-collector/src/main/pinot/multi-table)로 생성이 가능합니다.
  - inspectorStatApp: 이 테이블은 application inspector data를 저장합니다.
- table schema와 configuration은 [github repository](https://github.com/pinpoint-apm/pinpoint/tree/master/inspector-module/inspector-collector/src/main/pinot)를 참고해주세요.


## 2.4 Pinpoint Collector, Web, Batch의 New Inspector 기능 활성화

아래 컴포넌트들을 동일한 [Pinot connection settings](../getting-started/installation.md#pinot-connection-settings)로 설정하고 실행한다:

- [Collector starter](../getting-started/installation.md#collector-starter) — `BASIC` 또는 `ALL` 타입으로 실행, New Inspector 데이터를 수집한다.
- [Web starter](../getting-started/installation.md#web-starter) — Pinot에 저장된 New Inspector 데이터를 표시한다.
- [Pinpoint Batch](../getting-started/installation.md#pinot-connection-settings) — New Inspector 알람을 처리한다.
- **New Inspector 기능 옵션은 기본적으로 활성화되어 있으므로 github repository에서 제공하는 설정 파일에서 별도 기능 옵션 변경은 필요하지 않습니다.**
- Pinpoint 3.0 미만버전에서 3.0.0 이상버전으로 업그레이드 시 일부 옵션이 누락되는경우 아래 관련 옵션 설명을 참고해주세요.

# 3 Pinpoint 컴포넌트의 관련 설정

- 아래 설정들은 Pinpoint 3.0 버전에서 기본적으로 설정되어있습니다.
- Pinpoint 버전을 3.0으로 업그레이드하는경우 일부 설정이 누락되는 경우 참고하기 위해서 설정을 명시해놓습니다.


## Pinpoint Collector

- `collector-starter` 모둘의 `application.yml` 파일:

```
pinpoint:
  modules:
    collector:
      inspector:
        enabled: true
```

## Pinpoint Web

- `web-starter` 모듈의 `application.yml` 파일:

```
pinpoint:
  modules:
    web:
      inspector:
        enabled: true
```


## Pinpoint Batch

- `batch` 모듈의 `batch-root.properties` 파일:

```
alarm.collector.version=2
```


# 4 Q&A

### A HBase에 데이터를 저장하는 Legacy Inspector를 사용할 수 없나요?

가능합니다. 그러나 3.0.1 버전 이상 부터는 Legacy Inspector를 삭제할 예정이므로 Pinpoint 버전이 올라갈수록 기능을 사용할수 없으므로 New Inspector를 사용하는것을 권장합니다.
기능을 사용하려면 Pinpoint 컴포넌트들에 아래 설정을 추가해야합니다.

**collector-starter 프로젝트의 application.yml 파일이나 java vm option에 아래 설정을 추가해주세요.**

- application.yml
```
pinpoint:
  modules:
    collector:
      inspector:
        hbase:
          enabled: true
```

- java vm option
```
-Dpinpoint.modules.collector.inspector.hbase.enabled=true
```

**batch 프로젝트에서 batch-root.properties 파일이나 java vm option에 아래 설정을 추가해주세요.**

- batch-root.properties
```
alarm.collector.version=1
```

- java vm option
```
-Dalarm.collector.version=1
```


### B 사용자에게 제공되는 기능은 비슷한데 Pinot기반으로 inspector를 개선한 이유는 뭘까요?

다양한 데이터를 빠르게 저장하고 확인하고 위해서 Pinot로 데이터를 저장하도록 개선되었고
아직 부족한 기능이 많지만 Pinot의 발전에 맞춰서 기능을 보완하도록 하겠습니다.

### C inspector-stat-agent 테이블의 데이터가 많아서 읽기 속도가 느려집니다.

여러 개의 체이블에 데이터를 나누어 저장해서 성능 향상을 얻을 수 있습니다.
아래를 단계를 따라 전체 N 개의 Pinot table과 Kafka topic을 생성하고, Pinpoint 컴포넌트들에 설정을 추가해서 data를 수집/조회합니다.

**Kafka topic 생성**

- N개 Kafka topic을 생성합니다. (00에서 N-1까지)
- topic의 형식은 다음과 같습니다.
  - inspector-stat-agent-00
  - inspector-stat-agent-01
  - ...
  - inspector-stat-agent-99


**Pinot table 생성**

- N개 Pinot table을 생성합니다. (00에서 N-1까지)
  - [스크립트](https://github.com/pinpoint-apm/pinpoint/tree/master/inspector-module/inspector-collector/src/main/pinot/multi-table)로 다수의 테이블 생성이 가능합니다.
- table name과 schema name의 형식은 다음과 같습니다.
  - insepctorStatAgent00
  - insepctorStatAgent01
  - ...
  - insepctorStatAgent99


**`collector-starter` 모듈의 `application.yml` 파일이나 java vm option에 아래 설정을 추가해 주세요.**

- application.yml
```
kafka:
  inspector:
    agent:
      table:
        count: N
```

- java vm option
```
-Dkafka.inspector.agent.topic.count=N
```

**`web-starter` 모듈의 `application.yml` 파일이나 java vm option에 아래 설정을 추가해 주세요.**
- application.yml
```
pinot:
  inspector:
    agent:
      table:
        count: N
```

- java vm option
```
-Dpinot.inspector.agent.topic.count=N
```

**`batch` 모듈의 `batch-root.properties` 파일이나 java vm option에 아래 설정을 추가해 주세요.**
- batch-root.properties
```
job.alarm.agent.inspector.stat.table.count=N
```

- java vm option
```
-Djob.alarm.agent.inspector.stat.table.count=N
```

---

## File: documents/otel_metric.md

> **⚠ This document is currently being written.**

---

[English](otel_metric.md#opentelemetry-metric) | [한국어](otel_metric.md#opentelemetry-metric-ko)


# OpenTelemetry Metric <a id="opentelemetry-metric"></a>

## 1. Overview

Pinpoint provides OpenTelemetry metric ingestion via HTTP. Send metric data in OpenTelemetry format to Pinpoint Collector, and view the data through Pinpoint Web.

[OpenTelemetry](https://opentelemetry.io/) is an open-source framework for tracking and monitoring application performance and health.



---

## 2. Prerequisites

- Apache Pinot and Kafka must be installed. If they are already installed, you can skip this setup step. Otherwise, see [Pinot installation](../getting-started/installation.md#pinot).
- Pinpoint Collector must be installed and deployed.
- Pinpoint Web must be installed and deployed.
- MySQL must be installed.

---

## 3. Storage Configuration (Apache Pinot)

You need to create tables in Apache Pinot to store OTel metric data.

### 3.1 Pinot and Kafka Setup

If Pinot and Kafka are already installed, you can skip this setup step. Otherwise, set them up by following the [Pinot installation guide](../getting-started/installation.md#pinot) before creating OTel Metric topics and tables.

### 3.2 Create Kafka Topics

Create 3 topics with the names below:

- `otlp-metric-double-00`
- `otlp-metric-long-00`
- `otlp-metric-metadata`

### 3.3 Create Pinot Tables

For realtime tables, create the Kafka topics referenced by the table configuration before creating the Pinot tables.

Three tables are required.

| Table | Purpose |
|---|---|
| `otlpMetricDouble` | Stores double-type metric values |
| `otlpMetricLong` | Stores long-type metric values |
| `otlpMetricMetadata` | Stores metric metadata |

Schema and table configuration files are located in the [`otlpmetric/pinot-tables/`](https://github.com/pinpoint-apm/pinpoint/tree/master/otlpmetric/pinot-tables) directory.

| File | Description |
|---|---|
| `pinot-otlpmetric-double-schema.json` | Double table schema |
| `pinot-otlpmetric-long-schema.json` | Long table schema |
| `pinot-otlpmetric-metadata-schema.json` | Metadata table schema |
| `pinot-otlpmetric-double-realtime-table.json` | Double realtime table config |
| `pinot-otlpmetric-long-realtime-table.json` | Long realtime table config |
| `pinot-otlpmetric-metadata-realtime-table.json` | Metadata realtime table config |
| `pinot-otlpmetric-double-offline-table.json` | Double offline table config |
| `pinot-otlpmetric-long-offline-table.json` | Long offline table config |

### 3.4 Data Retention

Default retention is defined in the table configuration files. You can adjust it in the Pinot table settings as needed.

---

## 4. MySQL Configuration

You need to create a table in MySQL to store dashboard definition data.

The SQL file is located at `otlpmetric/otlpmetric-web/src/main/resources/sql/CreateTableStatement-mysql.sql`.

```sql
CREATE TABLE `application_metric_definition` (
     `application_name` VARCHAR(255) NOT NULL,
     `metric_definition` text NOT NULL,
     `schema_version` int(10) NOT NULL,
     PRIMARY KEY (`application_name`)
);
```

---

## 5. Collector Configuration

OTel metric ingestion is enabled by default.

Configure and run the [collector starter](../getting-started/installation.md#collector-starter) with `METRIC` or `ALL` type.

Running with `METRIC` or `ALL` type starts an HTTP server on port 9995, receiving metric data at the `POST /opentelemetry` endpoint.

---

## 6. Web Configuration

Configure and run the [web starter](../getting-started/installation.md#web-starter).
OTel metric viewing is enabled by default. When you run Web, the OpenTelemetry menu item appears in the left sidebar.

---

## 7. Client Setup

This example uses [Micrometer](https://micrometer.io/), a library that sends metrics in OpenTelemetry format.

### 7.1 Add Dependency

```xml
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-otlp</artifactId>
    <version>1.13.3</version>
</dependency>
```

### 7.2 application.yml Configuration

Add the following configuration to send Micrometer metric data in OpenTelemetry format.

```yaml
management:
  otlp:
    metrics:
      export:
        enabled: true
        step: 30s
        batch-size: 10000
        url: http://<your-collector-host>:9995/opentelemetry
  opentelemetry:
    resource-attributes:
      service.name: ${pinpoint.applicationName}
      pinpoint.agentId: ${pinpoint.agentId}
```

**resource-attributes**

- `service.name`: Set this to your Pinpoint applicationName.
- `pinpoint.agentId`: Set this to your Pinpoint agentId.

### 7.3 Micrometer Guide

- Micrometer quick guide: https://www.baeldung.com/micrometer
- Micrometer OTLP export guide: https://docs.micrometer.io/micrometer/reference/implementations/otlp.html

---

## 8. Metric Dashboard

Unlike other metric pages, you need to build the dashboard yourself.

### 8.1 Define Metrics

**Step 1: Select Application**

Select an application at the top and click the 'Create a new metric' button to add a metric.



**Step 2: Define Metric**



**Data Configuration**

Define a metric by matching the stored metric data's metricGroupName, metricName, field, and tag.

Tags and fields have an N:N relationship. Select one primary search condition from either tag or field first, then select the remaining as multiple values.

**Graph Configuration**

Define how the graph should be displayed.

The stack option allows you to view data values stacked on top of each other.

### 8.2 Adjust Metric Position and Size

Added metrics can be repositioned and resized.

Click a metric to move its position. Click the bottom-right corner to resize.

### 8.3 Save Timing

Dashboard definitions are saved each time a metric is added.

When the 'Save Dashboard' button in the upper right blinks, it means the dashboard definition has changed and needs to be saved.



---

## 9. Dashboard Example



---

## 10. Notes

- The OpenTelemetry feature is in beta; page layout and features may change.
- Libraries other than Micrometer may require additional testing and improvements.

------------------------------------------


# 1. OpenTelemetry Metric 기능이란? <a id="opentelemetry-metric-ko"></a>

## 1. 개요

OpenTelemetry metric 데이터를 HTTP 방식으로 Pinpoint Collector에 전송하면, Pinpoint Web에서 데이터를 확인할 수 있는 기능을 제공합니다.

[OpenTelemetry](https://opentelemetry.io/)는 애플리케이션의 성능과 상태를 추적하고 모니터링하기 위한 오픈소스 프레임워크입니다.



---

## 2. 사전 조건

- Apache Pinot와 Kafka가 설치되어 있어야 합니다. 이미 설치되어 있다면 이 준비 단계는 건너뛰어도 됩니다. 아직 설치하지 않았다면 [Pinot 설치](../getting-started/installation.md#pinot)를 참고하세요.
- Pinpoint Collector가 설치 및 배포되어 있어야 합니다.
- Pinpoint Web이 설치 및 배포되어 있어야 합니다.
- MySQL이 설치되어 있어야 합니다.

---

## 3. 스토리지 설정 (Apache Pinot)

OTel metric 데이터 저장을 위해 Apache Pinot에 테이블을 생성해야 합니다.

### 3.1 Pinot와 Kafka 준비

Pinot와 Kafka가 이미 설치되어 있다면 이 준비 단계는 건너뛰어도 됩니다. 아직 설치하지 않았다면 OTel Metric용 topic과 table을 생성하기 전에 [Pinot 설치 가이드](../getting-started/installation.md#pinot)를 참고하여 Pinot와 Kafka를 준비합니다.

### 3.2 Kafka topic 생성

아래 3개 topic을 생성합니다.

- `otlp-metric-double-00`
- `otlp-metric-long-00`
- `otlp-metric-metadata`

### 3.3 Pinot table 생성

realtime table은 Pinot table을 생성하기 전에 table 설정에서 참조하는 Kafka topic을 먼저 생성해야 합니다.

총 3개의 테이블이 필요합니다.

| 테이블 | 용도 |
|---|---|
| `otlpMetricDouble` | double 타입 metric 값 저장 |
| `otlpMetricLong` | long 타입 metric 값 저장 |
| `otlpMetricMetadata` | metric 메타데이터 저장 |

스키마 및 테이블 설정 파일은 소스코드의 [`otlpmetric/pinot-tables/`](https://github.com/pinpoint-apm/pinpoint/tree/master/otlpmetric/pinot-tables) 디렉토리에 있습니다.

| 파일 | 설명 |
|---|---|
| `pinot-otlpmetric-double-schema.json` | double 테이블 스키마 |
| `pinot-otlpmetric-long-schema.json` | long 테이블 스키마 |
| `pinot-otlpmetric-metadata-schema.json` | metadata 테이블 스키마 |
| `pinot-otlpmetric-double-realtime-table.json` | double realtime 테이블 설정 |
| `pinot-otlpmetric-long-realtime-table.json` | long realtime 테이블 설정 |
| `pinot-otlpmetric-metadata-realtime-table.json` | metadata realtime 테이블 설정 |
| `pinot-otlpmetric-double-offline-table.json` | double offline 테이블 설정 |
| `pinot-otlpmetric-long-offline-table.json` | long offline 테이블 설정 |

### 3.4 Data Retention

기본 retention은 테이블 설정 파일에 정의되어 있습니다. 필요에 따라 Pinot 테이블 설정에서 변경할 수 있습니다.

---

## 4. MySQL 설정

대시보드 정의 데이터를 저장하기 위해 MySQL에 테이블을 생성해야 합니다.

SQL 파일은 소스코드의 `otlpmetric/otlpmetric-web/src/main/resources/sql/CreateTableStatement-mysql.sql`에 있습니다.

```sql
CREATE TABLE `application_metric_definition` (
     `application_name` VARCHAR(255) NOT NULL,
     `metric_definition` text NOT NULL,
     `schema_version` int(10) NOT NULL,
     PRIMARY KEY (`application_name`)
);
```

---

## 5. Collector 설정

OTel metric 수신 기능은 기본으로 활성화되어 있습니다.

[collector starter](../getting-started/installation.md#collector-starter)를 `METRIC` 또는 `ALL` 타입으로 실행합니다.

`METRIC` 또는 `ALL` 타입으로 실행하면 포트 9995에서 HTTP 서버가 시작되며, `POST /opentelemetry` 엔드포인트로 metric 데이터를 수신합니다.

---

## 6. Web 설정

[web starter](../getting-started/installation.md#web-starter)를 실행합니다.
OTel metric 조회 기능은 기본으로 활성화되어 있습니다. Web을 실행하면 좌측 메뉴에 OpenTelemetry 항목이 노출됩니다.

---

## 7. 클라이언트 설정

OpenTelemetry 스펙으로 metric을 전송하는 라이브러리 중 [Micrometer](https://micrometer.io/)를 사용하여 metric을 전송하는 예제입니다.

### 7.1 dependency 추가

```xml
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-otlp</artifactId>
    <version>1.13.3</version>
</dependency>
```

### 7.2 application.yml 설정

Micrometer metric 데이터를 OpenTelemetry 형태로 전송되도록 설정을 추가합니다.

```yaml
management:
  otlp:
    metrics:
      export:
        enabled: true
        step: 30s
        batch-size: 10000
        url: http://<your-collector-host>:9995/opentelemetry
  opentelemetry:
    resource-attributes:
      service.name: ${pinpoint.applicationName}
      pinpoint.agentId: ${pinpoint.agentId}
```

**resource-attributes 설정**

- `service.name`에는 Pinpoint의 applicationName을 넣으면 됩니다.
- `pinpoint.agentId`에는 Pinpoint의 agentId을 넣으면 됩니다.

### 7.3 Micrometer 가이드

- Micrometer quick guide: https://www.baeldung.com/micrometer
- Micrometer OTLP export guide: https://docs.micrometer.io/micrometer/reference/implementations/otlp.html

---

## 8. Metric 대시보드

다른 metric 페이지들과 다르게 대시보드를 직접 구성해야 합니다.

### 8.1 metric 정의

**step 1 : application 선택**

상단의 application을 선택하고 'Create a new metric' 버튼을 클릭하여 metric을 추가합니다.



**step 2 : metric 정의**



**Data configuration 영역**

저장된 metric 데이터의 metricGroupName, metricName, field, tag를 매칭시켜서 metric을 정의합니다.

tag, field는 N:N 관계를 갖고 있고, tag, field 중에 우선시 되는 검색 조건을 먼저 하나 선택하고 나머지를 다중으로 선택할 수 있습니다.

**Graph configuration 영역**

graph를 어떤 형태로 출력할지 정의합니다.

stack 옵션은 출력되는 데이터의 수치값을 stack 형태로 값을 쌓아서 볼 수 있습니다.

### 8.2 메트릭 위치, 크기 조절

추가된 metric은 위치 크기 조절이 가능합니다.

메트릭을 클릭하여 위치를 옮길 수 있고, 오른쪽 하단을 클릭하면 크기를 변경할 수 있습니다.

### 8.3 저장 타이밍

메트릭을 추가할 때마다 dashboard의 정의 내용은 저장됩니다.

오른쪽 상단의 save dashboard 버튼이 깜빡이면 dashboard 정의 값이 변경되어 저장이 필요하다는 뜻입니다.



---

## 9. 대시보드 예시



---

## 10. 참고사항

- OpenTelemetry 기능은 beta라 페이지 구성과 기능이 변경될 수 있습니다.
- Micrometer 라이브러리 외에 다른 수집 라이브러리는 테스트 및 개선이 필요할 수 있습니다.

---

## File: documents/per-request_feature_guide.md

---
title: Separate Logging Per Request
keywords: history
last_updated: 'Feb 1, 2018'
sidebar: mydoc_sidebar
permalink: perrequestfeatureguide.html
disqus: false
---

# Separate Logging Per Request

## ENGLISH GUIDE

### Per-request logging

#### 1. Description

Pinpoint saves additional information\(transactionId, spanId\) in log messages to classify them by request.

When tomcat processes multiple requests concurrently, we can see log files printed in chronological order. But we can not classify them by each request. For example when an exception message is logged, we can not easily identify all the logs related to the request that threw the exception.

Pinpoint is able to classify logs by requests by storing additional information\(transactionId, spanId\) in MDC of each request. The transactionId printed in the log message is the same as the transactionId in Pinpoint Web’s Transaction List view.

Let’s take a look at a more specific example. The log below is from an exception that occurred without using Pinpoint. As you can see, it is hard to identify the logs related to the request that threw the exception. ex\) Without Pinpoint

```text
2015-04-04 14:35:20 [INFO](ContentInfoCollector:76 ) get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:123 ) get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoCollector:12) get content name : SPORTS
2015-04-04 14:35:20 [INFO](ContentInfoCollector:25 ) get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:56 ) get content name : NATIONAL
2015-04-04 14:35:20 [INFO](ContentInfoCollector:34 ) get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoService:55 ) check authorization of user
2015-04-04 14:35:20 [INFO](ContentInfoService:14 ) get title of content
2015-04-04 14:35:21 [INFO](ContentDAOImpl:14 ) execute query ...
2015-04-04 14:35:21 [INFO](ContentDAOImpl:114 ) execute query ...    
2015-04-04 14:35:20 [INFO](ContentInfoService:74 ) get top linking for content
2015-04-04 14:35:21 [INFO](ContentDAOImpl:14 ) execute query ...
2015-04-04 14:35:21 [INFO](ContentDAOImpl:114 ) execute query ...
2015-04-04 14:35:22 [INFO](ContentDAOImpl:186 ) execute query ...
2015-04-04 14:35:22 [ERROR]ContentDAOImpl:158 )
     com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
          at example.ContentDAO.executequery(ContentDAOImpl.java:152)
          ...
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
          ...
     Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
     Communications link failure The last packet sent successfully to the server was 0 milliseconds ago.
     The driver has not received any packets from the server.    
          at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
          ... 12 more
     Caused by: java.net.ConnectException: Connection refused
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
          at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)   
          at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)   
          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)   
          at java.net.Socket.connect(Socket.java:529)    
          ...13 more
2015-04-04 14:35:22 [INFO](ContentDAO:145 ) execute query ...
2015-04-04 14:35:20 [INFO](ContentInfoService:38 ) update hits for content
2015-04-04 14:35:20 [INFO](ContentInfoService:89 ) check of user
2015-04-04 14:35:24 [INFO](ContentDAO:146 ) execute query ...
2015-04-04 14:35:25 [INFO](ContentDAO:123 ) execute query ...
```

Pinpoint classifies logs by requests by storing additional information\(transactionId, spanId\) in MDC of each request. ex\) With Pinpoint

```text
2015-04-04 14:35:20 [INFO](ContentInfoCollector:76) [txId : agent^14252^17 spanId : 1224] get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:123) [txId : agent^142533^18 spanId : 1231] get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoCollector:12) [txId : agent^142533^19 spanId : 1246] get content name : SPORTS
2015-04-04 14:35:20 [INFO](ContentInfoCollector:25) [txId : agent^142533^20 spanId : 1263] get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:56) [txId : agent^142533^21 spanId : 1265] get content name : NATIONAL
2015-04-04 14:35:20 [INFO](ContentInfoCollector:34) [txId : agent^142533^22 spanId : 1278] get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoService:55) [txId : agent^14252^18 spanId : 1231] check authorization of user
2015-04-04 14:35:20 [INFO](ContentInfoService:14) [txId : agent^14252^17 spanId : 1224] get title of content
2015-04-04 14:35:21 [INFO](ContentDAOImpl:14) [txId : agent^14252^17 spanId : 1224] execute query ...
2015-04-04 14:35:21 [INFO](ContentDAOImpl:114) [txId : agent^142533^19 spanId : 1246] execute query ...    
2015-04-04 14:35:20 [INFO](ContentInfoService:74) [txId : agent^14252^17 spanId : 1224] get top linking for content
2015-04-04 14:35:21 [INFO](ContentDAOImpl:14) [txId : agent^142533^18 spanId : 1231] execute query ...
2015-04-04 14:35:21 [INFO](ContentDAOImpl:114) [txId : agent^142533^21 spanId : 1265] execute query ...
2015-04-04 14:35:22 [INFO](ContentDAOImpl:186) [txId : agent^142533^22 spanId : 1278] execute query ...
2015-04-04 14:35:22 [ERROR](ContentDAOImpl:158) [txId : agent^142533^18 spanId : 1231]
     com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
          at com.pinpoint.example.dao.ContentDAO.executequery(ContentDAOImpl.java:152)
          ...
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)   
          ...
     Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
     Communications link failure The last packet sent successfully to the server was 0 milliseconds ago.
     The driver has not received any packets from the server.
          ...
          at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
          ... 12 more
     Caused by: java.net.ConnectException: Connection refused
          at java.net.PlainSocketImpl.socketConnect(Native Method)   
          at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
          at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
          at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
          at java.net.Socket.connect(Socket.java:529)
          ... 13 more
2015-04-04 14:35:22 [INFO](ContentDAO:145) [txId : agent^14252^17 spanId : 1224] execute query ...
2015-04-04 14:35:20 [INFO](ContentInfoService:38) [txId : agent^142533^19 spanId : 1246] update hits for content
2015-04-04 14:35:20 [INFO](ContentInfoService:89) [txId : agent^142533^21 spanId : 1265] check of user
2015-04-04 14:35:24 [INFO](ContentDAO:146) [txId : agent^142533^22 spanId : 1278] execute query ...
2015-04-04 14:35:25 [INFO](ContentDAO:123) [txId : agent^14252^17 spanId : 1224] execute query ...
```

The transactionId printed in the log message is the same as the transactionId in Pinpoint Web’s Transaction List view. 

#### 2. How to configure

**2-1 Pinpoint agent configuration**

To enable this feature, set the logging property corresponding to the logging library in use to true in _pinpoint.config_. For example,

ex\) pinpoint.config when using log4j

```text
###########################################################
# log4j
###########################################################
profiler.log4j.logging.transactioninfo=true
```

ex\) pinpoint.config when using log4j2

```text
###########################################################
# log4j2 
###########################################################
profiler.log4j2.logging.transactioninfo=true
```

ex\) pinpoint.config when using logback

```text
###########################################################
# logback
###########################################################
profiler.logback.logging.transactioninfo=true
```

**2-2 log4j, log4j2, logback configuration**

Change the log message format to print the transactionId, and spanId saved in MDC.

ex\) log4j : log4j.xml

```markup
Before
<appender name = "console" class= "org.apache.log4j.ConsoleAppender" >
     <layout class = "org.apache.log4j.EnhancedPatternLayout">
          <param name = "ConversionPattern" value= "%d{yyyy-MM-dd HH:mm:ss} [%-5p](%-30c{1}) %m%n" />
     </layout >
</appender >

After
<appender name = "console" class= "org.apache.log4j.ConsoleAppender" >
     <layout class = "org.apache.log4j.EnhancedPatternLayout">
          <param name = "ConversionPattern" value= "%d{yyyy-MM-dd HH:mm:ss} [%-5p](%-30c{1}) [TxId : %X{PtxId} , SpanId : %X{PspanId}] %m%n" />
        </layout >
</appender >
```

ex\) log4j2 - log4j2.xml

```markup
Before
<appender>
     <console name="STDOUT" target="SYSTEM_OUT">
          <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%-5p](%-30c{1}) %m%n""/>
     </console>
<appender>

After
<appender>
     <console name="STDOUT" target="SYSTEM_OUT">
          <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%-5p](%-30c{1}) [TxId : %X{PtxId} , SpanId : %X{PspanId}] %m%n""/>
     </console>
<appender>
```

ex\) logback : logback.xml

```markup
Before
<appender name = "STDOUT" class= "ch.qos.logback.core.ConsoleAppender" >
     <layout class = "ch.qos.logback.classic.PatternLayout">
          <Pattern >%d{HH:mm} %-5level %logger{36} - %msg%n</Pattern >
     </layout >
</appender >

After
<appender name = "STDOUT" class= "ch.qos.logback.core.ConsoleAppender" >
     <layout class = "ch.qos.logback.classic.PatternLayout">
          <Pattern >%d{HH:mm} %-5level %logger{36} - [TxId : %X{PtxId} , SpanId : %X{PspanId}] %msg%n</Pattern >
     </layout >
</appender >
```

**2-3 Checking log message**

If the per-request logging is correctly configured, the transactionId, and spanId are printed in the log file.

```text
2015-04-04 14:35:20 [INFO](ContentInfoCollector:76 ) [txId : agent^14252^17 spanId : 1224] get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:123 ) [txId : agent^142533^18 spanId : 1231] get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoCollector:12) [txId : agent^142533^19 spanId : 1246] get content name : SPORTS
```

#### 3. expose log in Pinpoint web

If you want to add links to the logs in the transaction list view, you should configure and implement the logic as below. Pinpoint Web only adds link buttons - you should implement the logic to retrieve the log message.

If you want to expose your agent’s log messages, please follow the steps below.

**step 1** You should implement a controller that receives transactionId, spanId, transaction\_start\_time as parameters and retrieve the logs yourself. We do not yet provide a way to retrieve the logs.

example\)

```java
@RestController
public class Nelo2LogController {

    @RequestMapping(value = "/????")
    public String NeloLogForTransactionId(@RequestParam (value= "transactionId", required=true) String transactionId,
                                            @RequestParam(value= "spanId" , required=false) String spanId,
                                            @RequestParam(value="time" , required=true) long time ) {

          // you should implement the logic to retrieve your agent’s logs.
    }
```

**step 2** In _pinpoint-web.properties_ file, set `log.enable` to true, and `log.page.url` to the url of the controller above. The value set in `log.button.name` will show up as the button text in the Web UI.

```text
log.enable= true
log.page.url=XXXX.pinpoint
log.button.name= log
```

**step 3** Pinpoint 1.5.0 or later, we improve button to decided enable/disable depending on whether or not being logged. You should implement interceptor for using logging appender to add logic whether or not being logged. you also should create plugin for logging appender internally. Please refer to Pinpoint Profiler Plugin Sample\([Link](https://github.com/pinpoint-apm/pinpoint-plugin-sample)\). Location added logic of interceptor is method to log for data of LoggingEvent in appender class. you should review your appender class and find method. This is interceptor example.

```text
public class AppenderInterceptor implements AroundInterceptor0 {

    private final TraceContext traceContext;

    public AppenderInterceptor(TraceContext traceContext) {
        this.traceContext = traceContext;
    }

    @Override
    public void before(Object target) {
        Trace trace = traceContext.currentTraceObject();

        if (trace != null) {
            SpanRecorder recorder = trace.getSpanRecorder();
            recorder.recordLogging(LoggingInfo.LOGGED);
        }
    }

    @IgnoreMethod
    @Override
    public void after(Object target, Object result, Throwable throwable) {

    }
}
```

If those are correctly configured, the buttons are added in the transaction list view. 

For details in how the log buttons are generated, please refer to Pinpoint Web’s BusinessTransactionController and ScatterChartController.

## 한국어 가이드

### Per-request logging

#### 1. 기능 설명

Pinpoint에서는 log message를 request 단위로 구분할 수 있도록 log message 에 추가정보를 저장해준다.

다수의 요청을 처리하는 tomcat을 사용할 경우 로그 파일을 보면 시간순으로 출력된 로그를 확인할 수 있다. 그러나 동시에 요청된 다수의 request 각각에 대한 로그를 구분 해서 볼 수 없다. 예를 들어 로그에서 exception message가 출력됐을 때 그 exception이 발생한 request의 모든 log를 확인하기 힘들다.

Pinpoint는 log message 마다 request와 연관된 정보\(transactionId, spanId\)를 MDC에 넣어줘서 request 단위로 log message를 구분할 수 있도록 해준다. 로그에 출력된 transactionId는 pinpoint web의 transaction List 화면에 출력된 transactionId와 일치한다.

구체적으로 예를 들어보자. Pinpoint를 사용하지 않았을 때 exception이 발생했을 경우 로그 메시지를 살펴 보자. 요청된 다수의 request 각각을 구분하여 로그를 확인할 수가 없다.

ex\) Without Pinpoint

```text
2015-04-04 14:35:20 [INFO](ContentInfoCollector:76 ) get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:123 ) get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoCollector:12) get content name : SPORTS
2015-04-04 14:35:20 [INFO](ContentInfoCollector:25 ) get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:56 ) get content name : NATIONAL
2015-04-04 14:35:20 [INFO](ContentInfoCollector:34 ) get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoService:55 ) check authorization of user
2015-04-04 14:35:20 [INFO](ContentInfoService:14 ) get title of content
2015-04-04 14:35:21 [INFO](ContentDAOImpl:14 ) execute query ...
2015-04-04 14:35:21 [INFO](ContentDAOImpl:114 ) execute query ...
2015-04-04 14:35:20 [INFO](ContentInfoService:74 ) get top linking for content
2015-04-04 14:35:21 [INFO](ContentDAOImpl:14 ) execute query ...
2015-04-04 14:35:21 [INFO](ContentDAOImpl:114 ) execute query ...
2015-04-04 14:35:22 [INFO](ContentDAOImpl:186 ) execute query ...
2015-04-04 14:35:22 [ERROR]ContentDAOImpl:158 )
     com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
          at example.ContentDAO.executequery(ContentDAOImpl.java:152)
          ...
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
          ...
     Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
     Communications link failure The last packet sent successfully to the server was 0 milliseconds ago.
     The driver has not received any packets from the server.
          at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
          ... 12 more
     Caused by: java.net.ConnectException: Connection refused
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
          at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
          at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
          at java.net.Socket.connect(Socket.java:529)
          ...13 more
2015-04-04 14:35:22 [INFO](ContentDAO:145 ) execute query ...
2015-04-04 14:35:20 [INFO](ContentInfoService:38 ) update hits for content
2015-04-04 14:35:20 [INFO](ContentInfoService:89 ) check of user
2015-04-04 14:35:24 [INFO](ContentDAO:146 ) execute query ...
2015-04-04 14:35:25 [INFO](ContentDAO:123 ) execute query ...
```

Pinpoint는 로그 메세지 마다 request와 연관된 정보\(transactionId, spanId\)를 MDC에 넣어줘서 request 단위로 log message를 구분시켜 준다.

ex\) With Pinpoint

```text
2015-04-04 14:35:20 [INFO](ContentInfoCollector:76) [txId : agent^14252^17 spanId : 1224] get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:123) [txId : agent^142533^18 spanId : 1231] get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoCollector:12) [txId : agent^142533^19 spanId : 1246] get content name : SPORTS
2015-04-04 14:35:20 [INFO](ContentInfoCollector:25) [txId : agent^142533^20 spanId : 1263] get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:56) [txId : agent^142533^21 spanId : 1265] get content name : NATIONAL
2015-04-04 14:35:20 [INFO](ContentInfoCollector:34) [txId : agent^142533^22 spanId : 1278] get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoService:55) [txId : agent^14252^18 spanId : 1231] check authorization of user
2015-04-04 14:35:20 [INFO](ContentInfoService:14) [txId : agent^14252^17 spanId : 1224] get title of content
2015-04-04 14:35:21 [INFO](ContentDAOImpl:14) [txId : agent^14252^17 spanId : 1224] execute query ...
2015-04-04 14:35:21 [INFO](ContentDAOImpl:114) [txId : agent^142533^19 spanId : 1246] execute query ...
2015-04-04 14:35:20 [INFO](ContentInfoService:74) [txId : agent^14252^17 spanId : 1224] get top linking for content
2015-04-04 14:35:21 [INFO](ContentDAOImpl:14) [txId : agent^142533^18 spanId : 1231] execute query ...
2015-04-04 14:35:21 [INFO](ContentDAOImpl:114) [txId : agent^142533^21 spanId : 1265] execute query ...
2015-04-04 14:35:22 [INFO](ContentDAOImpl:186) [txId : agent^142533^22 spanId : 1278] execute query ...
2015-04-04 14:35:22 [ERROR](ContentDAOImpl:158) [txId : agent^142533^18 spanId : 1231]
     com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
          at com.pinpoint.example.dao.ContentDAO.executequery(ContentDAOImpl.java:152)
          ...
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
          ...
     Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
     Communications link failure The last packet sent successfully to the server was 0 milliseconds ago.
     The driver has not received any packets from the server.
          ...
          at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
          ... 12 more
     Caused by: java.net.ConnectException: Connection refused
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
          at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
          at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
          at java.net.Socket.connect(Socket.java:529)
          ... 13 more
2015-04-04 14:35:22 [INFO](ContentDAO:145) [txId : agent^14252^17 spanId : 1224] execute query ...
2015-04-04 14:35:20 [INFO](ContentInfoService:38) [txId : agent^142533^19 spanId : 1246] update hits for content
2015-04-04 14:35:20 [INFO](ContentInfoService:89) [txId : agent^142533^21 spanId : 1265] check of user
2015-04-04 14:35:24 [INFO](ContentDAO:146) [txId : agent^142533^22 spanId : 1278] execute query ...
2015-04-04 14:35:25 [INFO](ContentDAO:123) [txId : agent^14252^17 spanId : 1224] execute query ...
```

로그메시지에 출력된 transactionId는 Pinpoint web의 transactionlist의 transactionId와 일치한다. 

#### 2. 설정 방법

**2-1 Pinpoint agent 설정**

Pinpoint를 사용하려면 Pinpoint agent 설정파일\(Pinpoint.config\)의 logging 설정 값을 true로 변경해야 한다. 사용하는 logging 라이브러리에 해당하는 설정값만 true로 변경하면 된다. 아래 설정에 대한 예시가 있다.

ex\) Pinpoint.config - log4j 를 사용할 경우

```text
###########################################################
# log4j
###########################################################
profiler.log4j.logging.transactioninfo=true
```

ex\) Pinpoint.config - log4j2 를 사용할 경우

```text
###########################################################
# log4j2 
###########################################################
profiler.log4j2.logging.transactioninfo=true
```

ex\) Pinpoint.config - logback 를 사용할 경우

```text
###########################################################
# logback
###########################################################
profiler.logback.logging.transactioninfo=true
```

**2-2 log4j, log4j2, logback 설정 파일 설정**

logging 설정 파일의 log message pattern 설정에 Pinpoint에서 MDC에 저장한 transactionId, spanId값이 출력될수 있도록 설정을 추가하자.

ex\) log4j - log4j.xml

```markup
변경 전
<appender name = "console" class= "org.apache.log4j.ConsoleAppender" >
     <layout class = "org.apache.log4j.EnhancedPatternLayout">
          <param name = "ConversionPattern" value= "%d{yyyy-MM-dd HH:mm:ss} [%-5p](%-30c{1}) %m%n" />
     </layout >
</appender >

변경 후
<appender name = "console" class= "org.apache.log4j.ConsoleAppender" >
     <layout class = "org.apache.log4j.EnhancedPatternLayout">
          <param name = "ConversionPattern" value= "%d{yyyy-MM-dd HH:mm:ss} [%-5p](%-30c{1}) [TxId : %X{PtxId} , SpanId : %X{PspanId}] %m%n" />
        </layout >
</appender >
```

ex\) log4j2 - log4j2.xml

```markup
변경 전
<appender>
     <console name="STDOUT" target="SYSTEM_OUT">
          <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%-5p](%-30c{1}) %m%n""/>
     </console>
<appender>

변경 후
<appender>
     <console name="STDOUT" target="SYSTEM_OUT">
          <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%-5p](%-30c{1}) [TxId : %X{PtxId} , SpanId : %X{PspanId}] %m%n""/>
     </console>
<appender>
```

ex\) logback - logback.xml

```markup
변경 전
<appender name = "STDOUT" class= "ch.qos.logback.core.ConsoleAppender" >
     <layout class = "ch.qos.logback.classic.PatternLayout">
          <Pattern >%d{HH:mm} %-5level %logger{36} - %msg%n</Pattern >
     </layout >
</appender >

변경 후
<appender name = "STDOUT" class= "ch.qos.logback.core.ConsoleAppender" >
     <layout class = "ch.qos.logback.classic.PatternLayout">
          <Pattern >%d{HH:mm} %-5level %logger{36} - [TxId : %X{PtxId} , SpanId : %X{PspanId}] %msg%n</Pattern >
     </layout >
</appender >
```

**2-3 로그 출력 확인**

Pinpoint agent가 적용된 서비스를 동작하여 log message에 아래와 같이 transactionId, spanId 정보가 출력되는것을 확인하면 된다.

```text
2015-04-04 14:35:20 [INFO](ContentInfoCollector:76 ) [txId : agent^14252^17 spanId : 1224] get content name : TECH
2015-04-04 14:35:20 [INFO](ContentInfoCollector:123 ) [txId : agent^142533^18 spanId : 1231] get content name : OPINION
2015-04-04 14:35:20 [INFO](ContentInfoCollector:12) [txId : agent^142533^19 spanId : 1246] get content name : SPORTS
```

#### 3. Pinpoint web에서 로그 확인

Pinpoint web의 transaction list 화면에서 log를 출력하는 링크를 제공하고 싶다면 아래와 같이 설정 및 구현을 추가하면 된다. Pinpoint web에서는 버튼 을 추가해주기만 하고 로그를 가져오는 로직은 직접 구현을 해야한다.

로그 메시지를 Pinpoint web에서 보여주기 위해서는 아래와 같이 2가지 step을 따라야 한다.

**step 1** transactionId와 spanId, transaction 시작 시간을 파라미터로 받아서 로그 메시지를 가져오는 controller을 구현해야한다.

example\)

```java
@RestController
public class Nelo2LogController {

    @RequestMapping(value = "/XXXX")
    public String NeloLogForTransactionId(@RequestParam (value= "transactionId", required=true) String transactionId,
                                            @RequestParam(value= "spanId" , required=false) String spanId,
                                            @RequestParam(value="time" , required=true) long time ) {

          // you should implement the logic to retrieve your agent’s logs.
    }
```

**step 2** Pinpoint-web.properties 파일에서 버튼을 추가해주는 기능을 활성화 하기 위해서 log.enable의 값을 true로 설정하고 위에서 구현한 controller의 url과 button의 이름을 추가해주자.

```text
log.enable=true
log.page.url=XXXX.Pinpoint
log.button.name=log
```

**step 3** pinpoint 1.5 이후 버전부터 log 기록 여부에 따라 log 버튼의 활성화가 결정되도록 개선 됐기 때문에 당신이 사용하는 logging appender의 로깅 메소드에 logging 여부를 저장하는 interceptor를 추가하는 플러그인을 개발해야 한다. 플러그인 개발 방법은 다음 링크를 참고하면 된다\([Link](https://github.com/pinpoint-apm/pinpoint-plugin-sample)\). interceptor 로직이 추가돼야 하는 위치는 appender class 내에 LoggingEvent 객체의 데이터를 이용하여 로깅을 하는 메소드다. 아래는 interceptor 예제이다.

```text
public class AppenderInterceptor implements AroundInterceptor0 {

    private final TraceContext traceContext;

    public AppenderInterceptor(TraceContext traceContext) {
        this.traceContext = traceContext;
    }

    @Override
    public void before(Object target) {
        Trace trace = traceContext.currentTraceObject();

        if (trace != null) {
            SpanRecorder recorder = trace.getSpanRecorder();
            recorder.recordLogging(LoggingInfo.LOGGED);
        }
    }

    @IgnoreMethod
    @Override
    public void after(Object target, Object result, Throwable throwable) {

    }
}
```

위와 같이 설정 및 구현을 추가하고 pinpoint web을 동작시키면 아래와 같이 버튼이 추가 된다.  로그 버튼을 생성해주는 과정을 보시려면, Pinpoint Web의 BusinessTransactionController 와 ScatterChartController class를 참고하세요.

---

## File: documents/plugin-dev-guide.md

---
title: Plugin Developer Guide
keywords: 'plugin, plug-in, plug'
last_updated: 'Jan 21, 2019'
sidebar: mydoc_sidebar
permalink: plugindevguide.html
disqus: false
---

# Plugin Developer Guide

You can write Pinpoint profiler plugins to extend profiling target coverage. It is highly advisable to look into the trace data recorded by pinpoint plugins before jumping into plugin development.

* There is a [fast auto pinpoint agent plugin generate tool](https://github.com/bbossgroups/pinpoint-plugin-generate) from a 3rd party for creating a simple plug-in, if you'd like to check out.

## I. Trace Data

In Pinpoint, a transaction consists of a group of `Spans`. Each `Span` represents a trace of a single logical node where the transaction has gone through.

To aid in visualization, let's suppose that there is a system like below. The _FrontEnd_ server receives requests from users, then sends request to the _BackEnd_ server, which queries a DB. Among these nodes, let's assume only the _FrontEnd_ and _BackEnd_ servers are profiled by the Pinpoint Agent.



When a request arrives at the _FrontEnd_ server, Pinpoint Agent generates a new transaction id and creates a `Span` with it. To handle the request, the _FrontEnd_ server then invokes the _BackEnd_ server. At this point, Pinpoint Agent injects the transaction id \(plus a few other values for propagation\) into the invocation message. When the _BackEnd_ server receives this message, it extracts the transaction id \(and the other values\) from the message and creates a new `Span` with them. Resulting, all `Spans` in a single transaction share the same transaction id.

A `Span` records important method invocations and their related data\(arguments, return value, etc\) before encapsulating them as `SpanEvents` in a call stack like representation. The `Span` itself and each of its `SpanEvents` represents a method invocation.

`Span` and `SpanEvent` have many fields, but most of them are handled internally by Pinpoint Agent and most plugin developers won't need to worry about them. But the fields and data that must be handled by plugin developers will be listed throughout this guide.

## II. Pinpoint Plugin Structure

Pinpoint plugin consists of _type-provider.yml_ and `ProfilerPlugin` implementations. _type-provider.yml_ defines the `ServiceTypes` and `AnnotationKeys` that will be provided by the plugin, and provides them to Pinpoint Agent, Web and Collector. `ProfilerPlugin` implementations are used by Pinpoint Agent to transform target classes to record trace data.

Plugins are deployed as jar files. These jar files are packaged under the _plugin_ directory for the agent, while the collector and web have them deployed under _WEB-INF/lib_. On start up, Pinpoint Agent, Collector, and Web iterates through each of these plugins; parses _type-provider.yml_, and loads `ProfilerPlugin` implementations using `ServiceLoader` from the following locations:

* META-INF/pinpoint/type-provider.yml
* META-INF/services/com.navercorp.pinpoint.bootstrap.plugin.ProfilerPlugin

Here is a [template plugin project](https://github.com/pinpoint-apm/pinpoint-plugin-template) you can use to start creating your own plugin.

### 1. type-provider.yml

_type-provider.yml_ defines the `ServiceTypes` and `AnnotationKeys` that will be used by the plugin and provided to the agent, collector and web; the format of which is outlined below.

```yaml
serviceTypes:
    - code: <short>
      name: <String>
      desc: <String>   # May be omitted, defaulting to the same value as name.
      property:        # May be omitted, all properties defaulting to false.
          terminal: <boolean>               # May be omitted, defaulting to false.
          queue: <boolean>                  # May be omitted, defaulting to false.
          recordStatistics: <boolean>       # May be omitted, defaulting to false.
          includeDestinationId: <boolean>   # May be omitted, defaulting to false.
          alias: <boolean>                  # May be omitted, defaulting to false.          
      matcher:         # May be omitted
          type: <String>   # Any one of 'args', 'exact', 'none'
          code: <int>      # Annotation key code - required only if type is 'exact'

annotationKeys:
    - code: <int>
      name: <String>
      property:        # May be omitted, all properties defaulting to false.
          viewInRecordSet: <boolean>
```

`ServiceType` and `AnnotationKey` defined here are instantiated when the agent loads, and can be obtained using `ServiceTypeProvider` and `AnnotationKeyProvider` like below.

```java
// ServiceType
ServiceType serviceType = ServiceTypeProvider.getByCode(1000);    // by ServiceType code
ServiceType serviceType = ServiceTypeProvider.getByName("NAME");  // by ServiceType name
// AnnotationKey
AnnotationKey annotationKey = AnnotationKeyProvider.getByCode("100");
```

#### 1.1 ServiceType

Every `Span` and `SpanEvent` contains a `ServiceType`. The `ServiceType` represents which library the traced method belongs to, as well as how the `Span` and `SpanEvent` should be handled.

The table below shows the `ServiceType`'s properties.

| property | description |
| :--- | :--- |
| name | name of the `ServiceType`. Must be unique |
| code | short type code value of the `ServiceType`. Must be unique |
| desc | description |
| properties | properties |

`ServiceType` code must use a value from its appropriate category. The table below shows these categories and their range of codes.

| category | range |
| :--- | :--- |
| Internal Use | 0 ~ 999 |
| Server | 1000 ~ 1999 |
| DB Client | 2000 ~ 2999 |
| Cache Client | 8000 ~ 8999 |
| RPC Client | 9000 ~ 9999 |
| Others | 5000 ~ 7999 |

`ServiceType` code must be unique. Therefore, if you are writing a plugin that will be shared publicly, **you must** contact Pinpoint dev. team to get a `ServiceType` code assigned. If your plugin is for private use, you may freely pick a value for `ServiceType` code from the table below.

| category | range |
| :--- | :--- |
| Server | 1900 ~ 1999 |
| DB client | 2900 ~ 2999 |
| Cache client | 8900 ~ 8999 |
| RPC client | 9900 ~ 9999 |
| Others | 7500 ~ 7999 |

`ServiceTypes` can have the following properties.

| property | description |
| :--- | :--- |
| TERMINAL | This `Span` or `SpanEvent` invokes a remote node but the target node is not traceable with Pinpoint |
| QUEUE | This `Span` or `SpanEvent` consumes/produces a message from/to a message queue. |
| INCLUDE\_DESTINATION\_ID | This `Span` or `SpanEvent` records a `destination id` and remote server is not a traceable type. |
| RECORD\_STATISTICS | Pinpoint Collector should collect execution time statistics of this `Span` or `SpanEvent` |
| ALIAS | The service may or may not have Pinpoint-Agent attached at the following service but regardlessly have knowledge what will follow. \(Ex. Elasticsearch client\) |

#### 1.2 AnnotationKey

You can annotate spans and span events with more information. An **Annotation** is a key-value pair where the key is an `AnnotationKey` type and the value is a primitive type, String or a byte\[\]. There are pre-defined `AnnotationKeys` for commonly used annotation types, but you can define your own keys in _type-provider.yml_ if these are not enough.

| property | description |
| :--- | :--- |
| name | Name of the `AnnotationKey` |
| code | int type code value of the `AnnotationKey`. Must be unique. |
| properties | properties |

If you are writing a plugin for public use, and are looking to add a new `AnnotationKey`, you must contact the Pinpoint dev. team to get an `AnnotationKey` code assigned. If your plugin is for private use, you may pick a value between 900 to 999 safely to use as `AnnotationKey` code.

The table below shows the `AnnotationKey` properties.

| property | description |
| :--- | :--- |
| VIEW\_IN\_RECORD\_SET | Show this annotation in transaction call tree. |
| ERROR\_API\_METADATA | This property is not for plugins. |

#### Example

You can find _type-provider.yml_ sample [here](https://github.com/pinpoint-apm/pinpoint-plugin-sample/blob/master/plugins/sample/src/main/resources/META-INF/pinpoint/type-provider.yml).

You may also define and attach an `AnnotationKeyMatcher` with a `ServiceType` \(`matcher` element in the sample _type-provider_ code above\). If you attach an `AnnotationKeyMatcher` this way, matching annotations will be displayed as representative annotation when the `ServiceType`'s `Span` or `SpanEvent` is displayed in the transaction call tree.

### 2. ProfilerPlugin

`ProfilerPlugin` modifies target library classes to collect trace data.

`ProfilerPlugin` works in the order of following steps:

1. Pinpoint Agent is started when the JVM starts.
2. Pinpoint Agent loads all plugins under `plugin` directory.
3. Pinpoint Agent invokes `ProfilerPlugin.setup(ProfilerPluginSetupContext)` for each loaded plugin.
4. In the `setup` method, the plugin registers a `TransformerCallback` to all classes that are going to be transformed.
5. Target application starts.
6. Every time a class is loaded, Pinpoint Agent looks for the `TransformerCallback` registered to the class.
7. If a `TransformerCallback` is registered, the Agent invokes it's `doInTransform` method.
8. `TransformerCallback` modifies the target class' byte code. \(e.g. add interceptors, add fields, etc.\)
9. The modified byte code is returned to the JVM, and the class is loaded with the returned byte code.
10. Application continues running.
11. When a modified method is invoked, the injected interceptor's `before` and `after` methods are invoked.
12. The interceptor records the trace data.

The most important points to consider when writing a plugin are 1\) figuring out which methods are interesting enough to warrant tracing, and 2\) injecting interceptors to actually trace these methods. These interceptors are used to extract, store, and pass trace data around before they are sent off to the Collector. Interceptors may even cooperate with each other, sharing context between them. Plugins may also aid in tracing by adding getters or even custom fields to the target class so that the interceptors may access them during execution. [Pinpoint plugin sample](https://github.com/pinpoint-apm/pinpoint-plugin-sample) shows you how the `TransformerCallback` modifies classes and what the injected interceptors do to trace a method.

We will now describe what interceptors must do to trace different kinds of methods.

#### 2.1 Plain method

_Plain method_ refers to anything that is not a top-level method of a node, or is not related to remote or asynchronous invocation. [Sample 2](https://github.com/pinpoint-apm/pinpoint-plugin-sample/tree/master/plugins/sample/src/main/java/com/navercorp/pinpoint/plugin/sample/_02_Injecting_Custom_Interceptor) shows you how to trace these plain methods.

#### 2.2 Top level method of a node

_Top level method of a node_ is a method in which its interceptor begins a new trace in a node. These methods are typically acceptors for RPCs, and the trace is recorded as a `Span` with `ServiceType` categorized as a server.

How the `Span` is recorded depends on whether the transaction has already begun at any previous nodes.

**2.2.1 New transaction**

If the current node is the first one that is recording the transaction, you must issue a new transaction id and record it. `TraceContext.newTraceObject()` will handle this task automatically, so you will simply need to invoke it.

**2.2.2 Continue Transaction**

If the request came from another node traced by a Pinpoint Agent, then the transaction will already have a transaction id issued; and you will have to record the data below to the `Span`. \(Most of these data are sent from the previous node, usually packed in the request message\)

| name | description |
| :--- | :--- |
| transactionId | Transaction ID |
| parentSpanId | Span ID of the previous node |
| parentApplicationName | Application name of the previous node |
| parentApplicationType | Application type of the previous node |
| rpc | Procedure name \(Optional\) |
| endPoint | Server\(current node\) address |
| remoteAddr | Client address |
| acceptorHost | Server address that the client used |

Pinpoint finds caller-callee relation between nodes using _acceptorHost_. In most cases, _acceptorHost_ is identical to _endPoint_. However, the address which client sent the request to may sometimes be different from the address the server received the request \(proxy\). To handle such cases, you have to record the actual address the client used to send the request to as _acceptorHost_. Normally, the client plugin will have added this address into the request message along with the transaction data.

Moreover, you must also use the span id issued and sent by the previous node.

Sometimes, the previous node marks the transaction to not be traced. In this case, you must not trace the transaction.

As you can see, the client plugin must be able pass trace data to the server plugin, and how to do this is protocol dependent.

You can find an example of top-level method server interceptor [here](https://github.com/pinpoint-apm/pinpoint-plugin-sample/tree/master/plugins/sample/src/main/java/com/navercorp/pinpoint/plugin/sample/_14_RPC_Server).

#### 2.3 Methods invoking a remote node

An interceptor of a method that invokes a remote node has to record the following data:

| name | description |
| :--- | :--- |
| endPoint | Target server address |
| destinationId | Logical name of the target |
| rpc | Invoking target procedure name \(optional\) |
| nextSpanId | Span id that will be used by next node's span \(If next node is traceable by Pinpoint\) |

Whether or not the next node is traceable by Pinpoint affects how the interceptor is implemented. The term "traceable" here is about possibility. For example, a HTTP client's next node is a HTTP server. Pinpoint does not trace all HTTP servers, but it is possible to trace them \(and there already are HTTP server plugins\). In this case, the HTTP client's next node is traceable. On the other hand, MySQL JDBC's next node, a MySQL database server, is not traceable.

**2.3.1 If the next node is traceable**

If the next node is traceable, the interceptor must propagate the following data to the next node. How to pass them is protocol dependent, and in worst cases may be impossible to pass them at all.

| name | description |
| :--- | :--- |
| transactionId | Transaction ID |
| parentApplicationName | Application name of current node |
| parentApplicationType | Application type of current node |
| parentSpanId | Span id of trace at current node |
| nextSpanId | Span id that will be used by the next node's span \(same value with nextSpanId of above table\) |

Pinpoint finds out caller-callee relation by matching _destinationId_ of client trace and _acceptorHost_ of server trace. Therefore the client plugin has to record _destinationId_ and the server plugin has to record _acceptorHost_ with the same value. If server cannot acquire the value by itself, client plugin has to pass it to server.

The interceptor's recorded `ServiceType` must be from the RPC client category.

You can find an example for these interceptors [here](https://github.com/pinpoint-apm/pinpoint-plugin-sample/tree/master/plugins/sample/src/main/java/com/navercorp/pinpoint/plugin/sample/_13_RPC_Client).

**2.3.2 If the next node is not traceable**

If the next node is not traceable, your `ServiceType` must have the `TERMINAL` property.

If you want to record the _destinationId_, it must also have the `INCLUDE_DESTINATION_ID` property. If you record _destinationId_, server map will show a node per destinationId even if they have same _endPoint_.

Also, the `ServiceType` must be a DB client or Cache client category. Note that you do not need to concern yourself about the terms "DB" or "Cache", as any plugin tracing a client library with non-traceable target server may use them. The only difference between "DB" and "Cache" is the time range of the response time histogram \("Cache" having smaller intervals for the histogram\).

#### 2.4 Asynchronous task

Trace objects are bound to the thread that first created them via **ThreadLocal** and whenever the execution crosses a thread boundary, trace objects are _lost_ to the new thread. Therefore, in order to trace tasks across thread boundaries, you must take care of passing the current trace context over to the new thread. This is done by injecting an **AsyncContext** into an object shared by both the invocation thread and the execution thread.  
The invocation thread creates an **AsyncContext** from the current trace, and injects it into an object that will be passed over to the execution thread. The execution thread then retrieves the **AsyncContext** from the object, creates a new trace out of it and binds it to it's own **ThreadLocal**.  
You must therefore create interceptors for two methods : i\) one that initiates the task \(invocation thread\), and ii\) the other that actually handles the task \(execution thread\).

The initiating method's interceptor has to issue an **AsyncContext** and pass it to the handling method. How to pass this value depends on the target library. In worst cases, you may not be able to pass it at all.

The handling method's interceptor must then continue the trace using the propagated **AsyncContext** and bind it to it's own thread. However, it is very strongly recommended that you simply extend the **AsyncContextSpanEventSimpleAroundInterceptor** so that you do not have to handle this manually.

Keep in mind that since the shared object must be able have **AsyncContext** injected into it, you have to add a field using `AsyncContextAccessor` during it's class transformation. You can find an example for tracing asynchronous tasks [here](https://github.com/pinpoint-apm/pinpoint-plugin-sample/tree/master/plugins/sample/src/main/java/com/navercorp/pinpoint/plugin/sample/_12_Asynchronous_Trace).

#### 2.5 Case Study: HTTP

HTTP client is an example of _a method invoking a remote node_ \(client\), and HTTP server is an example of a _top level method of a node_ \(server\). As mentioned before, client plugins must have a way to pass transaction data to server plugins to continue the trace. Note that the implementation is protocol dependent, and [HttpMethodBaseExecuteMethodInterceptor](https://github.com/pinpoint-apm/pinpoint/blob/master/plugins/httpclient3/src/main/java/com/navercorp/pinpoint/plugin/httpclient3/interceptor/HttpMethodBaseExecuteMethodInterceptor.java) of [HttpClient3 plugin](https://github.com/pinpoint-apm/pinpoint/tree/master/plugins/httpclient3) and [StandardHostValveInvokeInterceptor](https://github.com/pinpoint-apm/pinpoint/blob/master/plugins/tomcat/src/main/java/com/navercorp/pinpoint/plugin/tomcat/interceptor/StandardHostValveInvokeInterceptor.java) of [Tomcat plugin](https://github.com/pinpoint-apm/pinpoint/tree/master/plugins/tomcat) show a working example of this for HTTP:

1. Pass transaction data as HTTP headers. You can find header names [here](https://github.com/pinpoint-apm/pinpoint/blob/master/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/context/Header.java)
2. Client plugin records `IP:PORT` of the server as `destinationId`.
3. Client plugin passes `destinationId` value to server as `Header.HTTP_HOST` header.
4. Server plugin records `Header.HTTP_HOST` header value as `acceptorHost`.

One more thing you have to remember is that all the clients and servers using the same protocol must pass the transaction data in the same way to ensure compatibility. So if you are writing a plugin of some other HTTP client or server, your plugin has to record and pass transaction data as described above.

### 3. Plugin Integration Test

You can run plugin integration tests \(`mvn integration-test`\) with [PinointPluginTestSuite](https://github.com/pinpoint-apm/pinpoint/blob/master/test/src/main/java/com/navercorp/pinpoint/test/plugin/PinpointPluginTestSuite.java), which is a _JUnit Runner_. It downloads all the required dependencies from maven repositories and launches a new JVM with the Pinpoint Agent and the aforementioned dependencies. The JUnit tests are executed in this JVM.

To run the plugin integration test, it needs a complete agent distribution - which is why integration tests are in the _plugin-sample-agent_ module and why they are run in **integration-test phase**.

For the actual integration test, you will want to first invoke the method you are tracing, and then use [PluginTestVerifier](https://github.com/pinpoint-apm/pinpoint/blob/master/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/test/PluginTestVerifier.java) to check if the trace data is correctly recorded.

#### 3.1 Test Dependency

`PinointPluginTestSuite` doesn't use the project's dependencies \(configured in pom.xml\). It uses the dependencies that are listed by `@Dependency` annotation. This way, you may test multiple versions of the target library using the same test class.

Dependencies are declared as following. You may specify versions or version ranges for a dependency library.

```text
@Dependency({"some.group:some-artifact:1.0", "another.group:another-artifact:2.1-RELEASE"})
@Dependency({"some.group:some-artifact:[1.0,)"})
@Dependency({"some.group:some-artifact:[1.0,1.9]"})
@Dependency({"some.group:some-artifact:[1.0],[2.1],[3.2])"})
```

`PinointPluginTestSuite` by default searches the local repository and maven central repository. You may also add your own repositories by using the `@Repository` annotation.

#### 3.2 Jvm Version

You can specify the JVM version for a test using `@JvmVersion`. If `@JvmVersion` is not present, JVM at `java.home property` will be used.

#### 3.3 Application Test

`PinpointPluginTestSuite` is not for applications that has to be launched by its own main class. You can extend [AbstractPinpointPluginTestSuite](https://github.com/pinpoint-apm/pinpoint/blob/master/test/src/main/java/com/navercorp/pinpoint/test/plugin/AbstractPinpointPluginTestSuite.java) and related types to test such applications.

### 4. Adding Images

If you're developing a plugin for applications, you need to add images so the server map can render the corresponding node. The plugin jar itself cannot provide these image files and for now, you will have to add the image files to the web module manually.

First, put the PNG files to following directories:

* web/src/main/webapp/images/icons \(25x25\)
* web/src/main/webapp/images/servermap \(80x40\)

Then, add `ServiceType` name and the image file name to `htIcons` in _web/src/main/webapp/components/server-map2/jquery.ServerMap2.js_.

---

## File: documents/proxy-http-header.md

---
title: Monitoring Proxy Server
keywords: 'proxy, http, header'
last_updated: 'Feb 1, 2018'
sidebar: mydoc_sidebar
permalink: proxyhttpheader.html
disqus: false
---

# Monitoring Proxy Server

## Proxy monitoring using HTTP headers <a id="proxy-monitoring-using-http-headers"></a>

It is used to know the elapsed time between proxy and WAS.



## Pinpoint Configuration

pinpoint.config

```text
profiler.proxy.http.header.enable=true
```

## Proxy Configuration

### Apache HTTP Server

* [http://httpd.apache.org/docs/2.4/en/mod/mod\_headers.html](http://httpd.apache.org/docs/2.4/en/mod/mod_headers.html)

Add HTTP header.

```text
Pinpoint-ProxyApache: t=991424704447256 D=3775428 i=51 b=49
```

e.g.

httpd.conf

```text
<IfModule mod_jk.c>
...
RequestHeader set Pinpoint-ProxyApache "%t %D %i %b"
...
</IfModule>
```

**%t is required value.**

### Nginx

* [http://nginx.org/en/docs/http/ngx\_http\_core\_module.html](http://nginx.org/en/docs/http/ngx_http_core_module.html)
* [http://nginx.org/en/docs/http/ngx\_http\_proxy\_module.html\#proxy\_set\_header](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header)

Add HTTP header.

```text
Pinpoint-ProxyNginx: t=1504248328.423 D=0.123
```

e.g.

nginx.conf

```text
...
  server {
        listen       9080;
        server_name  localhost;

        location / {
            ...
            set $pinpoint_proxy_header "t=$msec D=$request_time";
            proxy_set_header Pinpoint-ProxyNginx $pinpoint_proxy_header;
        }
  }
...
```

or

```text
http {
...

    proxy_set_header Pinpoint-ProxyNginx t=$msec;

...
}
```

**t=$msec is required value.**

### App

Milliseconds since epoch \(13 digits\) and app information.

Add HTTP header.

```text
Pinpoint-ProxyApp: t=1594316309407 app=foo-bar
```

**t=epoch is required value.**

---

## File: documents/realtime.md

# Real-time active request monitoring

The collection of request information can sometimes be so resource intensive that it can have a serious impact on the target system. Pinpoint provides a number of features that allow this expensive information to be monitored in real time only when the user really needs it.

## Features

The realtime monitor consists of 2 features: recording the number of active requests, thread-dumping the thread handling the active request

### Active request - realtime graph

In the datetime range picker there is a `REAL TIME` button which is focused on automatically augmenting the current data with the just generated realtime data.



REAL TIME also activates the Active Requests window. This shows the number of active requests at the moment.



### Active request thread dump

Pressing the icon in the green square above navigates to the thread dump view



The above list view contains brief information about the threads that were handling requests at the time the page was loaded. When the item is selected, the thread dump is collected and displayed in the UI as shown below.



The thread dump only works if the request is still active, but can be replaced with `There is no message( may be completed)` if the request session is already closed by the time the user selects the item in the list.

## Requirements and installation

These features are **disabled by default** and can be enabled with the property `pinpoint.modules.realtime.enabled=true` at the web, collector module.

### Required properties

Once the feature is enabled, the [Redis](https://redis.io) connection must be provided, which can be configured by adjusting the properties below in `redis/src/main/resources/redis/profiles'.

Most of the properties below follow, but are not exactly the same as, those defined in the [spring-data-redis](https://spring.io/projects/spring-data-redis) library.

```yaml
spring.data.redis.lettuce.client.io-thread-pool-size=8
spring.data.redis.lettuce.client.computation-thread-pool-size=8
spring.data.redis.lettuce.client.request-queue-size=1024

spring.data.redis.username=default
spring.data.redis.password=

# Standalone mode
spring.data.redis.host=localhost
spring.data.redis.port=6379

# Cluster mode: Cluster mode is prior to standalone
spring.data.redis.cluster.nodes=localhost.1:6379,localhost.2:6379,localhost.3:6379
```

If `spring.data.redis.cluster.nodes` is not empty, `spring.data.redis.host` is ignored.

## Architecture

Real-time information is not collected on a 24-hour basis, but is triggered by some kind of signal from a collector listening to a specific channel for broadcasting the event that a user has accessed that web page (demand). The collected information (supply) is immediately sent to the corresponding channel in Redis and can be read by the web server that sent the demand event.



### Case: the number of active requests

Most of the specifications for this section are described in `ATCServiceProtocolConfig.java`.

```java
@Bean
FluxChannelServiceProtocol<ATCDemand, ATCSupply> atcProtocol(ObjectMapper objectMapper) {
    return ChannelServiceProtocol.<ATCDemand, ATCSupply>builder()
      ...
            .setDemandPubChannelURIProvider(demand -> URI.create(RedisPubSubConstants.SCHEME + ":demand:atc-2"))
            .setDemandSubChannelURI(URI.create(RedisPubSubConstants.SCHEME + ":demand:atc-2"))
            .setSupplyChannelURIProvider(demand -> URI.create(RedisPubSubConstants.SCHEME + ":supply:atc-2:" + demand.getApplicationName() + ':' + demand.getAgentId() + ':' + demand.getStartTimestamp()))
            .buildFlux();
}
```

As described in the code above, the demand for the number of active requests is communicated over the redis pubsub channel using the key `demand:atc-2`. If real-time is enabled, all collectors should listen to this channel from the start.

A collector can ignore a demand event if it determines that it cannot respond to that event on its own, but you should design your demands carefully so that there is exactly one collector that can respond to the demand.

The appropriate collector with the appropriate connection triggers the agent to gather the required information, which is then passed in real time to the redis pubsub supply channel with the key 'supply:atc-2:{applicationName}:{agentId}:{startTimestamp}'.

---

## File: documents/service.md

[English](service.md#service) | [한국어](service.md#service-ko)


# Pinpoint Service Guide <a id="service"></a>

Pinpoint has released the Service feature.  
You can group multiple applications into a single service and check the call relationships between services on the Service Map.
On screens that support the Service feature, you can view only the data of the applications that belong to the selected service.

This lets you focus on the data of the service you are responsible for and analyze the cause of problems faster.
Even as applications increase, you can clearly separate monitoring targets by service.



This document provides content for both Pinpoint users who use services and Pinpoint operators who deploy and operate the Service feature. Check the guide below that matches your role.

| Audience | What to check in this document |
|---|---|
| Pinpoint users | User Guide, chapters 1 to 5: the Service concept, creating and selecting a service, agent settings, using the Service Map, and FAQ |
| Pinpoint operators | Operator Guide, chapters 6 to 7: components and settings, schema changes in 4.0.0 |

# User Guide

This part explains how to create a service, connect agents, and then view monitoring data by service.

## 1. What Is a Service?

**A Service is a higher-level monitoring unit that represents one service made up of multiple applications.**

Pinpoint's monitoring targets consist of three levels: `Service → Application → Agent`.
Decide which applications to treat as one service according to your organization's service structure and operational boundaries.

| Level | Meaning | Example |
|---|---|---|
| Service | A higher-level monitoring unit that contains multiple applications | `demo-shop-commerce` |
| Application | A monitoring unit with a specific role within a service | `Shopping-Order` |
| Agent | An individual instance of an application running on a server or in a container | `shop-order-01` |

A simplified view of the `demo-shop-commerce` service in the demo shopping mall is as follows. To explain the relationship between service, application, and agent, this example assumes that each application runs as two agent instances.

```text
Service: demo-shop-commerce                  product and order domain
├─ Application: Shopping-Order               order processing
│  ├─ Agent: shop-order-01
│  └─ Agent: shop-order-02
└─ Application: Shopping-Product             product lookup
   ├─ Agent: shop-product-01
   └─ Agent: shop-product-02
```

### 1-1. What Changes with the Service Feature

With the Service feature, an application is identified by the `Service + Application` combination, not by its name alone.

| Change | Description |
|---|---|
| Separate query scope | Only the data of the applications in the selected service is viewed. |
| Duplicate application names allowed | The same application name can be used in different services. |
| Call relationships | Calls with other services are checked on the Service Map. |

### 1-2. Selecting a Service



Click the **Service** menu at the bottom left, and select the service to view from the **Select Service** list on the right.

Selecting a service takes you to that service's Service Map.
The currently selected service is marked with a check. The list shows the current service first, then `DEFAULT`, then the remaining services sorted by name.

The service selection is kept independently per browser tab. In a new tab, the last selected service is used as the default.

When you select `demo-shop-commerce`, you can view only the applications and monitoring data that belong to that service.
The application list and the queried data also change based on the selected service.

### 1-3. Service Map



The Service Map shows, on one screen, the application calls inside the selected service and the call relationships with directly connected services.

| Target | How it is shown |
|---|---|
| Selected service | Its applications are expanded into individual nodes. |
| Other services with call relationships | Multiple applications are shown as one group node. |
| Number on a group node | The number of applications in that service. |

When `demo-shop-commerce` is selected in the demo shopping mall, the call relationships are shown as follows.

```text
[Service: demo-shop-front]
             │
             ▼
[Service: demo-shop-commerce]
Shopping-Order ─────→ Shopping-Product
      │                       │
      ├────────→ MySQL ←──────┘
      ▼
[Service: demo-shop-payment]
```

`Shopping-Order` (application), `Shopping-Product` (application), and `MySQL` (database), which belong to the selected `demo-shop-commerce` service, are shown as individual nodes. The connected `demo-shop-front` and `demo-shop-payment` services are each shown as a single service group node.

See chapter 4 for the display range and the limitations of group nodes.

### 1-4. Role of the DEFAULT Service and Data Handling

`DEFAULT` is the default service name where data from agents without a specified service is collected.

| Case | Handling |
|---|---|
| Data collected without a specified service | Viewed under the default service, `DEFAULT`. |
| Data collected after a service is set on the agent and the agent is restarted | Viewed under the configured service. |
| Existing data collected before a service was specified | Stays in `DEFAULT` and does not move to the new service. |

Creating a new service by itself does not move existing applications and data.

See chapter 3 for how to configure agents.

## 2. Getting Started with Services

**Turn on the Service feature, create a service, and apply the agent settings in order.**

The following order is recommended for the first setup.

```text
Turn on the Service feature
→ Create a service
→ Set the service on the agents
→ Verify the data
```

### 2-1. Turning On the Service Feature



1. Click **Configuration** at the bottom left.
2. Select **Experimental**.
3. Turn on **Enable service-based application map grouping.**
4. Check that **Service** and **Servicemap** appear in the left menu.

This setting is saved per browser.

You need to set it again in other browsers or devices.

If the option or the menus are not visible, contact your Pinpoint operator.

### 2-2. Creating a Service





1. Click **Service** at the bottom left.
2. Click **Service Setting**.
3. Click **New Service**.
4. Enter the service name and click **Save**.
5. Check that the created service is selected as the current service.

The service name is used as-is for the agent's `pinpoint.serviceName`.

Enter the name according to the following rules so that it can be linked with agents.

| Item | Rule |
|---|---|
| Length | 3 to 254 characters |
| Allowed characters | Uppercase and lowercase letters, digits, period (`.`), underscore (`_`), hyphen (`-`) |
| Not allowed | Spaces, Korean characters, slashes |
| Duplicate names | A name that differs from an existing service only in letter case cannot be used |
| Reserved names | `DEFAULT`, `ERROR`, `UNKNOWN`, `NULL`, `TEST` |

Examples of usable names are `demo-shop-commerce`, `member-platform`, and `finance-platform`.

Right after a service is created, it has no applications.

Applications are displayed once you finish the agent settings in chapter 3 and data is collected.

### 2-3. Selecting a Service

You can select a service in the following two places.

- The **Service** menu at the bottom left
- **Switch To** in the **Service Setting** list

Check the selected service in the Service menu at the bottom left.

### 2-4. Deleting a Service

**When a service is deleted, existing data is not recovered.**

Deleting a service has the following effects.

| Item | State after deletion |
|---|---|
| Service registration | Deleted. |
| Existing monitoring data | Remains, but does not move to another service. |
| A service re-created with the same name | Registered as a new service and not linked to the existing data. |

If the agents of a deleted service are restarted, registration may fail and new data may not be collected.

If you need to delete a service, follow this order.

1. Stop the agents that use the service, or change them to another service.
2. Check that new data is collected under the changed service.

It may take some time for a deleted service to disappear from the list.

`DEFAULT` cannot be deleted.

## 3. Setting the Service on Agents

**The Service feature is available in Pinpoint Agent 4.0.0 or later.**

When you set the service, application, and agent names in the agent startup options, Pinpoint builds the membership relationships.

### 3-1. Before You Start

Decide the service, application, and agent names according to the structure and operational standards of each environment.

This chapter assumes that the product and order domain is configured as one service with the following names.

| Level | Example name |
|---|---|
| Service | `demo-shop-commerce` |
| Application | `Shopping-Order` |
| Agent | `shop-order-01` |

Create the `demo-shop-commerce` service in Pinpoint Web before starting the agent. In a real environment, replace the names above with the names decided for each environment.

If the Pinpoint Agent is older than 4.0.0, upgrade it and then set the service. The service and application names must match the values shown in Pinpoint Web, including letter case.

### 3-2. JVM Options

Set the example names decided in 3-1 as JVM options as follows.

| Setting | Example value | Meaning |
|---|---|---|
| `pinpoint.serviceName` | `demo-shop-commerce` | The service the agent belongs to. It must be registered in Pinpoint Web first. |
| `pinpoint.applicationName` | `Shopping-Order` | The application the agent belongs to. |
| `pinpoint.agentName` | `shop-order-01` | A name that identifies the running instance. Optional. |

```bash
-Dpinpoint.serviceName=demo-shop-commerce
-Dpinpoint.applicationName=Shopping-Order
-Dpinpoint.agentName=shop-order-01
```

`pinpoint.serviceName` and `pinpoint.applicationName` must be set.

If `pinpoint.agentName` is omitted, the agent generates an instance name automatically.

To easily tell apart instances before and after a restart, specifying the name directly is recommended.

### 3-3. Applying and Verifying the Settings

1. Apply the settings and restart the agent.
2. Check in the agent log whether registration succeeded.
3. Select the registered service in Pinpoint Web.
4. Check that the configured application appears in the application list and on the Service Map.
5. Check transactions and agent status in a recent time range.

## 4. Supported Scope and Current Limitations

**On screens that support the Service feature, data is viewed based on the selected service.**

### 4-1. Main Features with Service Support

| Area | Service support |
|---|---|
| Applications and agents | View only the applications and agents that belong to the selected service |
| Service Map | View the call relationships between the applications of the selected service and other servicesRefresh the Service Map, Heatmap, and Scatter in real time, and view the Active Requests of the selected application |
| Transaction analysis | View Heatmap, Scatter, Histogram, Apdex, and the transaction list and details |
| Statistics and analysis | View Inspector, URL Statistic, and Exception Trace |

### 4-2. Current Limitations

| Feature | Current limitation | Notes |
|---|---|---|
| Service Map | Inbound and outbound calls are each viewed up to one hop from the selected service | Services two or more hops away may not be displayed |
| Group nodes | Not every application call inside a collapsed service may be represented | Use group nodes to check the connections between services |
| Infrastructure | Service scope is not applied | Data from multiple services may be shown together |
| OpenTelemetry Metric | Service scope is not applied | Data may be shown together regardless of the selected service |

## 5. FAQ

### 5-1. Where do I see the data if I turn the Service feature off?

When the Service feature is off, the `DEFAULT` data is viewed in the legacy `Servermap`.

Data stored under a specific service does not move to `DEFAULT` and is not shown in the legacy `Servermap`.

To see that data, turn the Service feature back on and select the correct service.

### 5-2. I created a service, but no application appears

Check the following in order.

1. The Pinpoint Agent is 4.0.0 or later.
2. The service was created before the agent.
3. `pinpoint.serviceName` satisfies the allowed characters and the length limit (3 to 254 characters), and `pinpoint.applicationName` satisfies the allowed characters and the 254-character limit.
4. `pinpoint.serviceName` matches the registered service, including letter case.
5. If the service was created after the agent, wait up to 10 minutes and restart the agent.
6. The agent registration log shows no errors.
7. The correct service and a recent time range are selected in Pinpoint Web.

### 5-3. Can I use the same application name in several services?

Yes, you can.

`commerce-service / order-api` and `partner-service / order-api` are treated as different applications.

### 5-4. Can I rename a service?

Service names cannot be changed.

Create a new service, change the agent's `pinpoint.serviceName`, and restart the agent.

Only data collected after the change is stored in the new service.

Existing data is not copied to the new service.

### 5-5. If I re-create a deleted service with the same name, is the data restored?

Monitoring data is not restored.

Even if you re-create it with the same name, it is registered as a new service, and the monitoring data from before the deletion is not linked.

### 5-6. After applying 4.0.0, a called Application appears as `host:port (UNKNOWN)`



On the Service Map of a selected Service, the called Application appears as an UNKNOWN node (cloud icon) named `host:port`. In the transaction call tree, the two Applications may still appear together normally.

**Cause**

The Agent version of the called Application is lower than 3.1.0.

| Calling Application | Agent of the called Application | Service Map link | Transaction call tree |
|---|---|---|---|
| 4.0.0, belongs to a Service | **3.0.x or lower** | **Broken** | Normal |
| 4.0.0, belongs to a Service | 4.0.0 or 3.1.x | Normal | Normal |

An Application that belongs to a Service sends its Service information along with each request. The Agent on the receiving side must read this information and report it to Pinpoint so that the link between the two Applications is drawn by Service. Reading this information is supported from Agent 3.1.0, so if the receiving Agent is 3.0.x or lower, the link appears broken.

**Resolution**

If the Agent version of the called Application is lower than 3.1.0, upgrade it to 3.1.0 or later. Upgrading to the latest 4.0.0 version is most recommended.

# Operator Guide

This part explains how to prepare Pinpoint Web and Collector and apply the Service feature.

## 6. Architecture and Default Settings

### 6-1. Components

The Service feature works with the following components together.

| Component | Role |
|---|---|
| Pinpoint Agent | Sends the configured service, application, and agent information to the Collector. |
| Pinpoint Collector | Looks up the service name sent by the agent in the Service Registry and links the collected data to that service. |
| Pinpoint Web | Provides the APIs and screens for creating and deleting services and for querying by service. |
| MySQL | Stores the Service Registry, which manages service names and service UIDs. |
| HBase | Stores the data used for the Service Map, transactions, and application and agent lookups. |
| Pinot | Stores Heatmap, Inspector, URL Stat, Exception Stat, Infrastructure, and OpenTelemetry Metric data. |

Pinpoint Web and Collector must look up the same Service Registry. If the two components use the `service` table in different MySQL databases, the Collector cannot find a service created in Web.

The flow in which service information is stored and looked up is as follows.



The MySQL Service Registry stores service names and UIDs. Monitoring data is stored in HBase and Pinot without passing through MySQL.

The service name created in Web and the service name set on the agent must be the same for the collected data to be viewed under the correct service.

### 6-2. Checking the Default Settings

In Pinpoint 4.0.0, the Service feature is enabled by default. The related settings are as follows.

| Layer | Setting | 4.0.0 default | Source file |
|---|---|---|---|
| Collector | `pinpoint.collector.service.lookup.enabled` | `true` | `collector/src/main/resources/pinpoint-collector-root.properties` |
| Service Map API | `pinpoint.modules.web.servicemap.enabled` | `true` | `web/src/main/resources/pinpoint-web-root.properties` |
| Browser UI initial value | `experimental.enableServiceMap.value` | `true` | `web/src/main/resources/pinpoint-web-root.properties` |

## 7. Schema Changes in 4.0.0

Upgrading to Pinpoint 4.0.0 requires schema changes.

### 7-1. Pinot

- `exceptionTrace` table: column added
  - Change: `serviceName` column added (STRING, default `DEFAULT`)
  - Schema: [pinot-exceptionTrace-schema.json](https://github.com/pinpoint-apm/pinpoint/blob/master/exceptiontrace/exceptiontrace-common/src/main/pinot/pinot-exceptionTrace-schema.json)

### 7-2. MySQL

- Create the `service` table
  - Schema: [Service-Schema.sql](https://github.com/pinpoint-apm/pinpoint/blob/master/service-module/src/main/resources/sql/Service-Schema.sql)
- Create the alarm tables
  - Tables: `alarm_template`, `alarm_template_item`, `alarm_rule_v2`, `alarm_rule_local_config`, `alarm_notification_channel`, `alarm_channel_binding`, `alarm_state`, `alarm_history_v2`, `alarm_notification_outbox`
  - Requirements: MySQL 8.4 or later is recommended. The configuration columns use the JSON type.
  - Schema: [CreateTableStatement-mysql.sql](https://github.com/pinpoint-apm/pinpoint/blob/master/alarm/alarm-common/src/main/resources/sql/alarm/CreateTableStatement-mysql.sql)

### 7-3. HBase

- The service-related tables were already added in version 3.1.0.
- If you upgrade to 4.0.0 from a version earlier than 3.1.0, add the HBase tables by referring to the guide below.
- https://pinpoint-apm.gitbook.io/pinpoint/documents/hbase-table-changes#id-3.1.0

---

# Pinpoint Service 가이드 <a id="service-ko"></a>

Pinpoint에서 Service 기능을 출시했습니다.  
여러 Application을 하나의 Service로 구성하고, Service 간 호출 관계를 Service Map에서 확인할 수 있습니다.
Service 기능을 지원하는 화면에서는 선택한 Service에 속한 Application의 데이터만 조회할 수 있습니다.

이를 통해 담당 Service의 데이터에 집중하고, 문제 원인을 더 빠르게 분석할 수 있습니다.
Application이 늘어나도 모니터링 대상을 Service 단위로 명확하게 구분할 수 있습니다.



이 문서는 Service를 사용하는 Pinpoint 사용자와 Service 기능을 배포·운영하는 Pinpoint 운영자를 위한 내용을 함께 제공합니다. 역할에 따라 아래 가이드를 확인합니다.

| 대상 | 이 문서에서 확인할 내용 |
|---|---|
| Pinpoint 사용자 | 사용자 가이드 1장부터 5장: Service 개념, 생성과 선택, Agent 설정, Service Map 사용과 FAQ |
| Pinpoint 운영자 | 운영자 가이드 6장부터 7장: 구성 요소와 설정, 4.0.0 스키마 변경사항 |

# 사용자 가이드

Service를 생성하고 Agent를 연결한 뒤, Service 단위로 모니터링 데이터를 조회하는 방법을 설명합니다.

## 1. Service란

**Service는 여러 Application으로 구성된 하나의 서비스를 나타내는 상위 모니터링 단위입니다.**

Pinpoint의 모니터링 대상은 `Service → Application → Agent`의 세 단계로 구성됩니다.
어떤 Application을 하나의 Service로 볼지는 조직의 서비스 구성과 운영 경계에 맞게 정합니다.

| 구분 | 의미 | 예시 |
|---|---|---|
| Service | 여러 Application을 포함하는 상위 모니터링 단위 | `demo-shop-commerce` |
| Application | Service 안에서 특정 역할을 담당하는 모니터링 단위 | `Shopping-Order` |
| Agent | 서버나 컨테이너에서 실행 중인 Application의 개별 인스턴스 | `shop-order-01` |

데모 쇼핑몰의 `demo-shop-commerce` Service를 단순화하면 다음과 같습니다. Service, Application, Agent의 관계를 설명하기 위해 각 Application이 두 Agent 인스턴스로 실행된다고 가정합니다.

```text
Service: demo-shop-commerce                  상품·주문 영역
├─ Application: Shopping-Order               주문 처리
│  ├─ Agent: shop-order-01
│  └─ Agent: shop-order-02
└─ Application: Shopping-Product             상품 조회
   ├─ Agent: shop-product-01
   └─ Agent: shop-product-02
```

### 1-1. Service 기능으로 달라지는 점

Service 기능을 사용하면 Application은 이름만이 아니라 `Service + Application` 조합으로 구분됩니다.

| 변화 | 설명 |
|---|---|
| 조회 범위 분리 | 선택한 Service에 속한 Application의 데이터만 조회합니다. |
| Application 이름 중복 허용 | Service가 다르면 같은 Application 이름을 사용할 수 있습니다. |
| 호출 관계 확인 | 다른 Service와의 호출을 Service Map에서 확인합니다. |

### 1-2. Service 선택



왼쪽 아래 **Service** 메뉴를 누르고, 오른쪽 **Select Service** 목록에서 조회할 Service를 선택합니다.

Service를 선택하면 해당 Service의 Service Map으로 이동합니다.
현재 선택한 Service에는 체크 표시가 나타납니다. 목록은 현재 Service, `DEFAULT`, 나머지 Service 이름순으로 표시됩니다.

Service 선택은 브라우저 탭마다 독립적으로 유지됩니다. 새 탭에서는 마지막으로 선택한 Service가 기본값으로 사용됩니다.

`demo-shop-commerce`를 선택하면 해당 Service에 속한 Application과 모니터링 데이터만 조회할 수 있습니다.
Application 목록과 조회 데이터도 선택한 Service를 기준으로 바뀝니다.

### 1-3. Service Map



Service Map은 선택한 Service 내부의 Application 호출과 직접 연결된 Service 간 호출 관계를 한 화면에 보여줍니다.

| 표시 대상 | 표시 방식 |
|---|---|
| 선택한 Service | 소속 Application을 개별 노드로 펼쳐서 표시합니다. |
| 호출 관계가 있는 다른 Service | 여러 Application을 하나의 그룹 노드로 표시합니다. |
| 그룹 노드의 숫자 | 해당 Service에 포함된 Application 수를 표시합니다. |

데모 쇼핑몰에서 `demo-shop-commerce`를 선택하면 호출 관계는 다음과 같이 표시됩니다.

```text
[Service: demo-shop-front]
             │
             ▼
[Service: demo-shop-commerce]
Shopping-Order ─────→ Shopping-Product
      │                       │
      ├────────→ MySQL ←──────┘
      ▼
[Service: demo-shop-payment]
```

선택한 `demo-shop-commerce`(Service)에 속한 `Shopping-Order`(Application), `Shopping-Product`(Application), `MySQL`(Database)은 개별 노드로 표시됩니다. 연결된 `demo-shop-front`(Service)와 `demo-shop-payment`(Service)는 각각 하나의 Service 그룹 노드로 표시됩니다.

표시 범위와 그룹 노드의 제한 사항은 4장을 참고합니다.

### 1-4. DEFAULT Service의 역할과 데이터 처리

`DEFAULT`는 Service를 지정하지 않은 Agent의 데이터가 모이는 기본 Service 이름입니다.

| 구분 | 처리 방식 |
|---|---|
| Service를 지정하지 않고 수집한 데이터 | 기본 Service인 `DEFAULT`에서 조회합니다. |
| Agent에 Service를 설정하고 재기동한 뒤 수집한 데이터 | 설정한 Service에서 조회합니다. |
| Service를 지정하기 전에 수집한 기존 데이터 | `DEFAULT`에 남고 새 Service로 이동하지 않습니다. |

새 Service를 만드는 것만으로 기존 Application과 데이터가 이동하지는 않습니다.

Agent 설정 방법은 3장을 참고합니다.

## 2. Service 시작하기

**Service 기능을 켠 뒤 Service를 만들고 Agent 설정을 순서대로 적용합니다.**

처음 설정할 때는 다음 순서를 권장합니다.

```text
Service 기능 켜기
→ Service 생성
→ Agent에 Service 지정
→ 데이터 확인
```

### 2-1. Service 기능 켜기



1. 왼쪽 아래 **Configuration**을 누릅니다.
2. **Experimental**을 선택합니다.
3. **Enable service-based application map grouping.**을 켭니다.
4. 왼쪽 메뉴에 **Service**와 **Servicemap**이 표시되는지 확인합니다.

이 설정은 브라우저별로 저장됩니다.

다른 브라우저나 기기에서는 다시 설정해야 합니다.

옵션이나 메뉴가 보이지 않으면 Pinpoint 운영자에게 문의합니다.

### 2-2. Service 생성





1. 왼쪽 아래 **Service**를 누릅니다.
2. **Service Setting**을 누릅니다.
3. **New Service**를 누릅니다.
4. Service 이름을 입력하고 **Save**를 누릅니다.
5. 생성한 Service가 현재 Service로 선택됐는지 확인합니다.

Service 이름은 Agent의 `pinpoint.serviceName`에 그대로 사용합니다.

Agent와 연결할 수 있도록 다음 규칙에 맞춰 입력합니다.

| 항목 | 규칙 |
|---|---|
| 길이 | 3~254자 |
| 허용 문자 | 영문 대소문자, 숫자, 마침표(`.`), 밑줄(`_`), 하이픈(`-`) |
| 사용할 수 없는 문자 | 공백, 한글, 슬래시 |
| 중복 이름 | 기존 Service와 대소문자만 다른 이름도 사용 불가 |
| 예약 이름 | `DEFAULT`, `ERROR`, `UNKNOWN`, `NULL`, `TEST` |

사용 가능한 이름의 예는 `demo-shop-commerce`, `member-platform`, `finance-platform`입니다.

Service를 만든 직후에는 소속 Application이 없습니다.

3장의 Agent 설정을 마치고 데이터가 수집되면 Application이 표시됩니다.

### 2-3. Service 선택

다음 두 위치에서 Service를 선택할 수 있습니다.

- 왼쪽 아래 **Service** 메뉴
- **Service Setting** 목록의 **Switch To**

선택한 Service는 왼쪽 아래 Service 메뉴에서 확인합니다.

### 2-4. Service 삭제

**Service 삭제 시 기존 데이터는 복구되지 않습니다.**

Service 삭제가 미치는 영향은 다음과 같습니다.

| 항목 | 삭제 후 상태 |
|---|---|
| Service 등록 정보 | 삭제됩니다. |
| 기존 모니터링 데이터 | 남아 있지만 다른 Service로 이동하지 않습니다. |
| 같은 이름으로 다시 만든 Service | 새로운 Service로 등록되며 기존 데이터와 연결되지 않습니다. |

Service를 삭제한 뒤 해당 Service의 Agent를 재기동하면 등록이 실패하고 신규 데이터가 수집되지 않을 수 있습니다.

삭제가 필요한 경우 다음 순서를 따릅니다.

1. 해당 Service를 사용하는 Agent를 중지하거나 다른 Service로 변경합니다.
2. 변경한 Service에서 신규 데이터가 수집되는지 확인합니다.

삭제한 Service가 목록에서 사라지는 데 시간이 걸릴 수 있습니다.

`DEFAULT`는 삭제할 수 없습니다.

## 3. Agent에 Service 설정

**Service 기능은 Pinpoint Agent 4.0.0 이상에서 사용할 수 있습니다.**

Agent 시작 옵션에 Service, Application, Agent 이름을 설정하면 Pinpoint가 소속 관계를 구성합니다.

### 3-1. 설정 전 확인

Service, Application, Agent 이름은 각 환경의 구성과 운영 기준에 맞게 정합니다.

이 장에서는 상품·주문 영역을 하나의 Service로 구성하고, 다음과 같이 이름을 정했다고 가정합니다.

| 구분 | 예시 이름 |
|---|---|
| Service | `demo-shop-commerce` |
| Application | `Shopping-Order` |
| Agent | `shop-order-01` |

Agent를 기동하기 전에 Pinpoint Web에서 `demo-shop-commerce` Service를 먼저 만듭니다. 실제 환경에서는 위 이름을 각 환경에서 정한 이름으로 바꿔서 설정합니다.

Pinpoint Agent가 4.0.0보다 낮다면 업그레이드한 뒤 Service를 설정합니다. Service와 Application 이름은 Pinpoint Web에 표시된 값과 대소문자까지 같아야 합니다.

### 3-2. JVM 옵션 설정

3-1에서 정한 예시 이름을 JVM 옵션에 다음과 같이 설정합니다.

| 설정 | 예시 값 | 의미 |
|---|---|---|
| `pinpoint.serviceName` | `demo-shop-commerce` | Agent가 속할 Service입니다. Pinpoint Web에 먼저 등록돼 있어야 합니다. |
| `pinpoint.applicationName` | `Shopping-Order` | Agent가 속할 Application입니다. |
| `pinpoint.agentName` | `shop-order-01` | 실행 중인 인스턴스를 구분하는 이름입니다. 선택 항목입니다. |

```bash
-Dpinpoint.serviceName=demo-shop-commerce
-Dpinpoint.applicationName=Shopping-Order
-Dpinpoint.agentName=shop-order-01
```

`pinpoint.serviceName`과 `pinpoint.applicationName`은 반드시 설정합니다.

`pinpoint.agentName`을 생략하면 Agent가 인스턴스 이름을 자동으로 생성합니다.

재기동 전후의 인스턴스를 쉽게 구분하려면 이름을 직접 지정하는 것을 권장합니다.

### 3-3. 설정 적용과 확인

1. 설정을 반영한 뒤 Agent를 재기동합니다.
2. Agent 로그에서 등록 성공 여부를 확인합니다.
3. Pinpoint Web에서 등록한 Service를 선택합니다.
4. Application 목록과 Service Map에서 설정한 Application이 표시되는지 확인합니다.
5. 최근 시간 범위에서 Transaction과 Agent 상태를 확인합니다.

## 4. 현재 지원 범위와 제한 사항

**Service 기능을 지원하는 화면에서는 선택한 Service를 기준으로 데이터를 조회합니다.**

### 4-1. Service가 적용된 주요 기능

| 영역 | Service 적용 내용 |
|---|---|
| Application과 Agent | 선택한 Service에 속한 Application과 Agent만 조회 |
| Service Map | 선택한 Service의 Application과 다른 Service의 호출 관계 조회Service Map, Heatmap, Scatter를 실시간으로 갱신하고 선택한 Application의 Active Request 조회 |
| Transaction 분석 | Heatmap, Scatter, Histogram, Apdex, Transaction 목록과 상세 조회 |
| 통계와 분석 | Inspector, URL Statistic, Exception Trace 조회 |

### 4-2. 현재 제한 사항

| 기능 | 현재 제한 | 사용 시 주의사항 |
|---|---|---|
| Service Map | 선택한 Service를 기준으로 들어오는 호출과 나가는 호출을 각각 한 단계까지 조회 | 두 단계 이상 떨어진 Service는 표시되지 않을 수 있음 |
| 그룹 노드 | 접힌 Service 내부의 Application 호출을 모두 표현하지 못할 수 있음 | 그룹 노드는 Service 간 연결을 확인하는 용도로 사용 |
| Infrastructure | Service 범위가 적용되지 않음 | 여러 Service의 데이터가 함께 보일 수 있음 |
| OpenTelemetry Metric | Service 범위가 적용되지 않음 | 선택한 Service와 관계없이 데이터가 함께 보일 수 있음 |

## 5. FAQ

### 5-1. Service 기능을 끄면 데이터는 어디에서 보나요?

Service 기능을 끄면 기존 `Servermap`에서 `DEFAULT` 데이터를 조회합니다.

특정 Service에 저장된 데이터는 `DEFAULT`로 이동하지 않으며 기존 `Servermap`에도 표시되지 않습니다.

해당 데이터를 보려면 Service 기능을 다시 켜고 올바른 Service를 선택합니다.

### 5-2. Service를 만들었는데 Application이 보이지 않습니다

다음을 순서대로 확인합니다.

1. Pinpoint Agent가 4.0.0 이상인지 확인합니다.
2. Agent보다 먼저 Service를 만들었는지 확인합니다.
3. `pinpoint.serviceName`이 허용 문자와 길이(3~254자) 제한을, `pinpoint.applicationName`이 허용 문자와 254자 제한을 만족하는지 확인합니다.
4. `pinpoint.serviceName`이 등록한 Service와 대소문자까지 같은지 확인합니다.
5. Service를 Agent보다 늦게 만들었다면 최대 10분 기다린 뒤 Agent를 재기동합니다.
6. Agent 등록 로그에서 오류가 없는지 확인합니다.
7. Pinpoint Web에서 올바른 Service와 최근 시간 범위를 선택합니다.

### 5-3. 같은 Application 이름을 여러 Service에서 써도 되나요?

사용할 수 있습니다.

`commerce-service / order-api`와 `partner-service / order-api`는 서로 다른 Application으로 구분됩니다.

### 5-4. Service 이름을 바꿀 수 있나요?

Service 이름은 변경할 수 없습니다.

새 Service를 만든 뒤 Agent의 `pinpoint.serviceName`을 변경하고 재기동해야 합니다.

변경 이후에 수집한 데이터만 새 Service에 저장됩니다.

기존 데이터는 새 Service로 복사되지 않습니다.

### 5-5. 삭제한 Service를 같은 이름으로 만들면 복구되나요?

모니터링 데이터는 복구되지 않습니다.

같은 이름으로 다시 만들어도 새로운 Service로 등록되며, 삭제 전 모니터링 데이터는 연결되지 않습니다.

### 5-6. 4.0.0 적용 후 호출 대상 Application이 `호스트:포트 (UNKNOWN)`으로 보입니다



Service를 선택한 Service Map에서 호출 대상 Application이 `호스트:포트` 이름의 UNKNOWN 노드(구름 아이콘)로 표시됩니다. 트랜잭션 콜트리에서는 두 Application이 정상적으로 함께 보일 수 있습니다.

**원인**

호출받는 Application의 Agent 버전이 3.1.0 미만이기 때문입니다.

| 호출하는 Application | 호출받는 Application의 Agent | Service Map 연결 | 트랜잭션 콜트리 |
|---|---|---|---|
| 4.0.0, Service에 속함 | **3.0.x 이하** | **끊김** | 정상 |
| 4.0.0, Service에 속함 | 4.0.0 또는 3.1.x | 정상 | 정상 |

Service에 속한 Application은 요청을 보낼 때 자신이 속한 Service 정보를 함께 전달합니다. 요청을 받는 쪽의 Agent가 이 정보를 읽어 Pinpoint에 보고해야 두 Application 사이의 연결이 Service 기준으로 그려집니다. 이 정보를 읽는 기능은 Agent 3.1.0부터 지원하므로, 받는 쪽 Agent가 3.0.x 이하이면 연결이 끊겨 보입니다.

**조치 방법**

대상 Application의 Agent 버전이 3.1.0 미만이면 3.1.0 이상으로 업그레이드합니다. 4.0.0 최신 버전으로 업그레이드하는 것을 가장 추천합니다.

# 운영자 가이드

Pinpoint Web과 Collector를 준비하고 Service 기능을 적용하는 방법을 설명합니다.

## 6. 구조와 기본 설정

### 6-1. 구성 요소

Service 기능은 다음 구성 요소가 함께 동작합니다.

| 구성 요소 | 역할 |
|---|---|
| Pinpoint Agent | 설정한 Service, Application, Agent 정보를 Collector로 전송합니다. |
| Pinpoint Collector | Agent가 보낸 Service 이름을 Service Registry에서 확인하고 수집 데이터를 해당 Service와 연결합니다. |
| Pinpoint Web | Service 생성·삭제와 Service 단위 조회 API 및 화면을 제공합니다. |
| MySQL | Service 이름과 Service UID를 관리하는 Service Registry를 저장합니다. |
| HBase | Service Map, Transaction, Application과 Agent 조회에 사용하는 데이터를 저장합니다. |
| Pinot | Heatmap, Inspector, URL Stat, Exception Stat, Infrastructure, OpenTelemetry Metric 데이터를 저장합니다. |

Pinpoint Web과 Collector는 동일한 Service Registry를 조회해야 합니다. 두 구성 요소가 서로 다른 MySQL의 `service` 테이블을 사용하면 Web에서 생성한 Service를 Collector가 찾을 수 없습니다.

Service 정보가 저장되고 조회되는 흐름은 다음과 같습니다.



MySQL Service Registry에는 Service 이름과 UID를 저장합니다. 모니터링 데이터는 MySQL을 거치지 않고 HBase와 Pinot에 저장됩니다.

Web에 생성한 Service 이름과 Agent에 설정한 Service 이름이 같아야 수집 데이터를 올바른 Service에서 조회할 수 있습니다.

### 6-2. 기본 설정 확인

Pinpoint 4.0.0에서는 Service 기능이 기본으로 활성화됩니다. 관련 설정은 다음과 같습니다.

| 계층 | 설정 | 4.0.0 기본값 | 기준 파일 |
|---|---|---|---|
| Collector | `pinpoint.collector.service.lookup.enabled` | `true` | `collector/src/main/resources/pinpoint-collector-root.properties` |
| Service Map API | `pinpoint.modules.web.servicemap.enabled` | `true` | `web/src/main/resources/pinpoint-web-root.properties` |
| 브라우저 UI 초기값 | `experimental.enableServiceMap.value` | `true` | `web/src/main/resources/pinpoint-web-root.properties` |

## 7. 4.0.0 스키마 변경사항

Pinpoint 4.0.0 버전 업그레이드 시 스키마 변경이 필요합니다.

### 7-1. Pinot

- `exceptionTrace` 테이블 컬럼 추가
  - 변경 내용: `serviceName` 컬럼 추가 (STRING, 기본값 `DEFAULT`)
  - 스키마: [pinot-exceptionTrace-schema.json](https://github.com/pinpoint-apm/pinpoint/blob/master/exceptiontrace/exceptiontrace-common/src/main/pinot/pinot-exceptionTrace-schema.json)

### 7-2. MySQL

- `service` 테이블 생성
  - 스키마: [Service-Schema.sql](https://github.com/pinpoint-apm/pinpoint/blob/master/service-module/src/main/resources/sql/Service-Schema.sql)
- 알람 관련 테이블 생성
  - 테이블: `alarm_template`, `alarm_template_item`, `alarm_rule_v2`, `alarm_rule_local_config`, `alarm_notification_channel`, `alarm_channel_binding`, `alarm_state`, `alarm_history_v2`, `alarm_notification_outbox`
  - 요구 사항: MySQL 8.4 이상을 권장합니다. 설정 컬럼이 JSON 타입입니다.
  - 스키마: [CreateTableStatement-mysql.sql](https://github.com/pinpoint-apm/pinpoint/blob/master/alarm/alarm-common/src/main/resources/sql/alarm/CreateTableStatement-mysql.sql)

### 7-3. HBase

- 3.1.0 버전에서 service에 관련된 테이블이 이미 추가되었습니다.
- 만약 3.1.0 미만 버전에서 4.0.0으로 업그레이드하는 경우 아래 가이드를 참고하여 HBase 테이블을 추가해주세요.
- https://pinpoint-apm.gitbook.io/pinpoint/documents/hbase-table-changes#id-3.1.0

---

## File: documents/system_metric.md

[English](system_metric.md#system-metrics) | [한국어](system_metric.md#system-metrics-ko)


# 1 System Metrics <a id="system-metrics"></a>
System metrics menu is newly added to Pinpoint in v2.5.0.
Pinpoint uses [telegraf agent](https://portal.influxdata.com/downloads/) to collect system metrics data to Pinpoint Collector in which the data are saved in Pinot.
Saved system metrics data are accessible via Pinpoint web.



Pinot is a real-time distributed OLAP datastore. For further information please refer to [their official documents](https://docs.pinot.apache.org).

# 2 Architecture


1. Telegraf agent sends system metrics data to Pinpoint collector.
2. Pinpoint collector saves data to Pinot through Kafka.
  - Kafka is necessary to stream data to Pinot.
3. Pinpoint web accesses Pinot to display collected metrics data.

# 3 Installation and Configuration

## 3.1 Pinot and Kafka Setup

If Pinot and Kafka are already installed, you can skip this setup step. Otherwise, set them up by following the [Pinot installation guide](../getting-started/installation.md#pinot) before creating System Metric topics and tables.

## 3.2 Create Kafka Topics for Pinpoint System Metrics
Create 3 topics with the names below:

- `system-metric-data-type`
- `system-metric-tag`
- `system-metric-double`

## 3.3 Create Pinot Tables
- Pinot table schemas for Pinpoint system metrics is provided in [our github repository](https://github.com/pinpoint-apm/pinpoint/tree/master/metric-module/metric/src/main/pinot).
- Please refer to [Pinot documents](https://docs.pinot.apache.org/basics/components/table#streaming-table-creation) to create necessary tables in your Pinot cluster.
- Total 3 tables should be created.
  - systemMetricDataType: this table saves type informations on collected data.
  - systemMetricTag: this table saves metadata (i.e., host, tags) for collected data.
  - systemMetricDouble: this table saves metric data in double. In order to use the hybrid table feature, create both REALTIME and OFFLINE tables.


## 3.4 Configure and Run Pinpoint Collector and Web with System Metrics

Configure and run the [collector starter](../getting-started/installation.md#collector-starter) with `METRIC` or `ALL` type.
Configure and run the [web starter](../getting-started/installation.md#web-starter) to display System Metric data stored in Pinot.

To show the System Metric menu, enable the following option in [pinpoint-web-metric.properties](https://github.com/pinpoint-apm/pinpoint/tree/master/metric-module/metric/src/main/resources/pinot-web/profiles):

```
config.show.systemMetric=true
```

## 3.5 Install and Configure Telegraf Agent <a id="install-and-configure-telegraf-agent"></a>
Telegraf collects below metrics information on the host machine:

- cpu
- disk usage
- disk usage (percent)
- inode usage
- memory usage
- memory usage(percent)
- swap
- system load
- nginx
- apache

---

- Install Telegraf according to this [installation guide](https://docs.influxdata.com/telegraf/v1.21/introduction/installation/).
- Add below configuration to `telegraf.conf` file to send collected metrics to Pinpoint collector via http.
  - **Note**: Starting from Pinpoint v3.0.2, the metric port has been changed from `15200` to `9995`.
  - ```
              [[outputs.http]]
                url = "http://{PINPOINT_COLLECTOR_IP}:9995/telegraf"
                 
                 [outputs.http.headers]
                 hostGroupName = {applicationName}
                 Content-Type = "application/json"  
    ```
  - `url`: substitute `{PINPOINT_COLLECTOR_IP}` to your Pinpoint collector address so that telegraf can send collected metrics to Pinpoint collector
  - `hostGroupName`: this value will be used as the key in Pinpoint web when querying the metrics details. It is recommended to use your applicationName already used in Pinpoint.


## 4 View Collected System Metrics Data
1. Click `Infrastructure` on the side bar menu in Pinpoint web.
2. Search for the hostGroupName you have configured for Telegraf agents as described [in 3.5](#install-and-configure-telegraf-agent).
3. A list of hosts will be displayed on the left, and you can view the system metrics data by clicking each of them.



## 5 Notes
- Other metrics and statistics data will be stored in Pinot to enhance Pinpoint experience in near future.
- Currently this system metrics versions are in beta. It will be officially released when when we can make sure that everything works as we intended.
- If you have been using the system metric feature in version 2.5.0 or lower and are upgrading, please refer to [guide](https://github.com/pinpoint-apm/pinpoint/issues/9791#issuecomment-1491486262) for instructions.

------------------------------------------


# 1 system metrics 기능이란? <a id="system-metrics-ko"></a>
system metrics 기능은 v2.5.0에 핀포인트에 새로 추가되었다.
[telegraf agent](https://portal.influxdata.com/downloads/) 를 사용하여 system metric 데이터를 collector에 전달하고 pinot에 데이터를 저장한다.
pinpoint web에서 저장된 system metric 데이터를 확인할 수 있다.




pinot는 실시간 분산 OLAP 데이터 저장소이다. 자세한 사항은 [pinot 사이트](https://docs.pinot.apache.org)를 참고하도록 하자.


# 2 구조



- ① telgegraf agent에서 system metric 데이터를 collector에 전달한다.
- ② collector는 kafka에 데이터를 전송하여 pinot에 데이터를 저장한다.
  - 참고로 pinot는 stream 데이터 전송을 위해서 kafka를 반드시 필요로 한다.
- ③ web은 pinot에서 데이터를 조회하여 화면으로 데이터를 보여준다.

# 3 설치/설정 방법

## 3.1 Pinot와 Kafka 준비

Pinot와 Kafka가 이미 설치되어 있다면 이 준비 단계는 건너뛰어도 된다. 아직 설치하지 않았다면 System Metric용 topic과 table을 생성하기 전에 [Pinot 설치 가이드](../getting-started/installation.md#pinot)를 참고하여 Pinot와 Kafka를 준비한다.

## 3.2 Kafka topic 생성

- 아래 3개 topic을 생성하자.
  -`system-metric-data-type`, `system-metric-tag`, `system-metric-double`


## 3.3 Pinot table 생성

- [테이블 생성 스키마 파일](https://github.com/pinpoint-apm/pinpoint/tree/master/metric-module/metric/src/main/pinot)에 테이블 정보가 있다.
- 테이블 생성 방법은 [pinot가이드](https://docs.pinot.apache.org/basics/components/table#streaming-table-creation)를 참고하여 pinot 실행 환경 맞게 테이블을 생성하면 된다.
- 생성하는 테이블은 총 3개이다.
  - systemMetricDataType : 수집되는 데이터의 type 정보를 저장하는 테이블이다.
  - systemMetricTag : 수집되는 데이터의 metadata(host 정보, 데이터의 tag 정보)를 저장하는 테이블이다.
  - systemMetricDouble : double 데이터를 저장하는 테이블이다. hybrid table 기능 사용을 위해서 REALTIME, OFFLINE 테이블 둘다 생성하자.
  
## 3.4 collector와 web 설정 및 실행

System Metric 데이터를 수집하려면 [collector starter](../getting-started/installation.md#collector-starter)를 `METRIC` 또는 `ALL` 타입으로 실행한다.
Pinot에 저장된 System Metric 데이터를 확인하려면 [web starter](../getting-started/installation.md#web-starter)를 실행한다.

System Metric 메뉴를 표시하려면 [pinpoint-web-metric.properties](https://github.com/pinpoint-apm/pinpoint/tree/master/metric-module/metric/src/main/resources/pinot-web/profiles)에 아래 설정값을 추가한다:

```
config.show.systemMetric=true
```

## 3.5 telegraf agent 설치 및 설정
telegraf agent를 통해 수집된 시스템 메트릭은 다음과 같다.
- cpu
- disk usage
- disk usage(percent)
- inode usage
- memory usage
- memory usage(percent)
- swap
- system load
- nginx
- apache

---

- 시스템 메트릭 데이터를 수집하는 telegraf agent를 설치하자.
  - [telegraf agent 설치 가이드](https://docs.influxdata.com/telegraf/v1.21/introduction/installation/)
- telegraf agent가 http 프로토콜로 collector에 데이터를 전달할 수 있도록 설정파일을 수정 해야한다.
  - telegraf.conf 설정 방법
    - http 프로토콜로 데이터를 전달수 있도록 output http plugin 아래 설정을 추가한다.
      - **참고**: Pinpoint v3.0.2부터 메트릭 포트가 `15200`에서 `9995`로 변경되었습니다.
      - ```
                [[outputs.http]]
                  url = "http://{PINPOINT_COLLECTOR_IP}:9995/telegraf"
                   
                   [outputs.http.headers]
                   hostGroupName = {applicationName}
                   Content-Type = "application/json"
        ```
    - `url`: {PINPOINT_COLLECTOR_IP} 자리에 데이터를 수집하는 collector의 주소를 설정한다.
    - `outputs.http.headers`은 서버 그룹의 key와 Content-Type을 설정한다.
      -  `hostGroupName`: {applicationName}에 설정한 값을 key로 pinpoint-web에서 데이터를 조회할 수 있다. 핀포인트를 이미 사용 중이라면 application을 추적할 때 agent 설정 값으로 사용했던 applicationName을 사용하는 것을 추천한다.

# 4 데이터 조회

- pinpoint-web에서 왼쪽 `Infrastructure` 메뉴를 선택하여 system metric 화면으로 이동한다.
- 상단의 select box에서 telegraf.conf 파일에 설정한 hostGroupName 값을 찾아서 선택한다.
- 아래와 같이 왼쪽에 호스트 목록이 나오고, 호스트를 선택해서 system metric 데이터를 확인할 수 있다.



# 5 기타
- pinot에는 system metric 뿐만아니라 pinpoint의 다양한 메트릭 데이터와 통계 데이터를 저장할 예정이다. 즉 pinot는 다양한 데이터를 저장하는 목적으로 사용될 것이다.
- system metric의 경우 당분간은 beta 기능으로 제공할것이고 안정적으로 기능이 운영되는 경험이 쌓이면 공식적으로 기능을 제공할 것이다.
- 2.5.0 이하 버전에서 system metric 기능을 사용하다가 버전을 업그레이드 하는 경우 [guide](https://github.com/pinpoint-apm/pinpoint/issues/9791#issuecomment-1491486262) 설명을 참고하자.

---

## File: documents/uri_statistics.md

[English](uri_statistics.md#uri-statistics) | [한국어](uri_statistics.md#uri-statistics-ko)

# URI Statistics <a id="uri-statistics"></a>
URI statistics menu is newly added to Pinpoint in v2.5.0.
Pinpoint Agent aggregates URI templates and send them to Pinpoint collector via GRPC.
Pinpoint Collector saves the data to Pinot via Apache Kafka.
Pinpoint Web accesses Pinot to display the data.



## 1. Installation and Configuration
### 1.1 Pinot and Kafka Setup
If Pinot and Kafka are already installed, you can skip this setup step. Otherwise, set them up by following the [Pinot installation guide](../getting-started/installation.md#pinot) before creating URI Statistics topics and tables.

### 1.2 Create Kafka Topics for Pinpoint URI Statistics
Create the `url-stat` Kafka topic with 64 partitions. This matches the `numPartitions` value in Pinpoint's default Pinot table configuration, which uses `segmentPartitionConfig`.

```
$ bin/kafka-topics.sh --create --topic url-stat --partitions 64 --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
```

### 1.3 Create Pinot Tables

- Pinot table schema for Pinpoint URI statistics is provided in [our github repository](https://github.com/pinpoint-apm/pinpoint/tree/master/uristat/uristat-common/src/main/pinot).
- Please refer to [Pinot documents](https://docs.pinot.apache.org/basics/components/table#streaming-table-creation) to create necessary tables in your Pinot cluster.
- Let's create the uriStat table by referencing the schema file and table settings from the provided path. To enable hybrid table functionality, let's create both REALTIME and OFFLINE tables for the 'uriStat' table.

### 1.4 Configure and Attach Pinpoint Agent
This section describes the URI stat configuration values added for URI statistics.

#### 1.4.1 Configuration values for URI Statistics
Below are default agent configuration values for URI statistics.

```
###########################################################
# URI Stat
###########################################################
profiler.uri.stat.enable=true
profiler.uri.stat.spring.webmvc.enable=true
profiler.uri.stat.spring.webmvc.useuserinput=false
profiler.uri.stat.spring.webflux.enable=true
profiler.uri.stat.spring.webflux.useuserinput=false
profiler.uri.stat.vertx.enable=true
profiler.uri.stat.vertx.useuserinput=false
profiler.uri.stat.tomcat.useuserinput=false
profiler.uri.stat.jetty.useuserinput=false
```
- profiler.uri.stat.enable: whether Pinpoint Agent collects URI statistics or not.
  - `true`: collects URI statistics
  - `false`: doesn't collect URI statistics
- profiler.uri.stat.spring.webmvc.enable: whether Pinpoint Agent collects URI statistics from Spring Web MVC applications.
  - `true`: collects URI statistics from Spring Web MVC applications.
  - `false`: doesn't collect URI statistics from Spring Web MVC applications.
- profiler.uri.stat.spring.webmvc.useuserinput: whether Pinpoint Agent uses user-input request attribute values for URI templates when available.
  - `true`: uses user-input request attribute values.
  - `false`: ignores user-input request attribute values.
  
  Set attribute `pinpoint.metric.uri-template` to your Spring web request as shown below to override default URI template provided by Pinpoint. 
  
  ```
    @RequestMapping("/testUserInputRequestAttribute")
    public Map<String, Object> testUserInputAttribute(HttpServletRequest request) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("message", "test user input attribute");
        request.setAttribute("pinpoint.metric.uri-template", "/userInput");
        return map;
    }
  ```
- profiler.uri.stat.spring.webflux.enable: whether Pinpoint Agent collects URI statistics from Spring Webflux applications.
  - `true`: collects URI statistics from Spring Webflux applications.
  - `false`: doesn't collect URI statistics from Spring Webflux applications.
- profiler.uri.stat.spring.webflux.useuserinput: whether Pinpoint Agent uses user-input request attribute values for URI templates when available.
  - `true`: uses user-input request attribute values.
  - `false`: ignores user-input request attribute values.
  
  Set attribute `pinpoint.metric.uri-template` to your Spring web request as shown below to override default URI template provided by Pinpoint. 
  
  ```
    @GetMapping("/server/welcome/**")
    public Mono<String> welcome(ServerWebExchange exchange) {
        exchange.getAttributes().put("pinpoint.metric.uri-template", "/test");
        return Mono.just("Welcome Home");
    }
  ```
  
- profiler.uri.stat.vertx.enable: whether Pinpoint Agent collects URI statistics from Vert.x applications.
  - `true`: collects URI statistics from Vert.x applications.
  - `false`: doesn't collect URI statistics from Vert.x applications.
- profiler.uri.stat.vertx.useuserinput: whether Pinpoint Agent uses user-input routing context attribute values for URI templates when available.
  - `true`: uses user-input routing context attribute values.
  - `false`: ignores user-input routing context attribute values.
    
  Set attribute `pinpoint.metric.uri-template` to your Vert.x routing context as shown below to override default URI template provided by Pinpoint. 
  
  ```
    router.get("/routinContextAttributeAdded").handler(routingContext -> {
        routingContext.put("pinpoint.metric.uri-template", "/test");
        routingContext.response().end("pinpoint.metric.uri-tempate = /test");
    });
  ```

- profiler.uri.stat.tomcat.useuserinput: (Added in v2.5.3) whether Pinpoint Agent uses user-input attribute values from Tomcat for URI templates when available.
  - `true`: collects URI statics from Tomcat user-input attribute values.
  - `false`: doesn't check Tomcat request attributes for URI statistics.
  
  This is provided to collect URI statistics information in Tomcat applications without supported frameworks(Spring WebMVC, Spring Webflux, VertX).
  If you are using supported frameworks, it is recommended to use framework-specific options and disable this option.
  Since there is no default URI template provided by tomcat, users need to set attribute `pinpoint.metric.uri-template` to your Tomcat request to start collecting URI statistics information.

- profiler.uri.stat.jetty.useuserinput: (Added in v4.0.1) whether Pinpoint Agent uses user-input attribute values from Jetty for URI templates when available.
  - `true`: collects URI statistics from Jetty user-input attribute values.
  - `false`: doesn't check Jetty request attributes for URI statistics.

  This option works like the Tomcat option above, for Jetty applications without supported frameworks (e.g. JAX-RS on Jetty).
  It applies to both the Jetty plugin and the Jetty 12 plugin.
  Jetty does not provide a default URI template. Set attribute `pinpoint.metric.uri-template` on your Jetty request to start collecting URI statistics information.
  Set the attribute before the request handling returns. For asynchronous requests, an attribute set after the initial dispatch returns is not used.

  ```
    @GET
    @Path("/orders/{orderId}")
    public Response getOrder(@PathParam("orderId") String orderId, @Context HttpServletRequest request) {
        request.setAttribute("pinpoint.metric.uri-template", "/orders/{orderId}");
        return Response.ok().build();
    }
  ```

To change the configuration values described above, update `pinpoint.config` under [each profile directory](https://github.com/pinpoint-apm/pinpoint/tree/master/agent/src/main/resources/profiles) and rebuild the project.
Or, you can simply pass these properties when starting your application with Pinpoint Agent (e.g. `-Dprofiler.uri.stat.enable=false`).

### 1.5 Configure and Run Pinpoint Collector & Web with URI Statistics
Configure and run the [collector starter](../getting-started/installation.md#collector-starter) with `BASIC` or `ALL` type.
Configure and run the [web starter](../getting-started/installation.md#web-starter) to display URI Statistics data.

- Enable URI statistics collection by adding the below line at [pinpoint-collector.properties](https://github.com/pinpoint-apm/pinpoint/tree/master/metric-module/collector-starter/src/main/resources/profiles):

	```
	collector.stat.uri=true
	```

- Show the URI Statistics menu by adding the below line at [pinpoint-web-uristat.properties](https://github.com/pinpoint-apm/pinpoint/tree/master/uristat/uristat-web/src/main/resources/profiles):

	```
	config.show.urlStat=true
	```
	
## 2. View Collected URI Statistics Data

1. Click `URL Statistic` on the side bar menu in Pinpoint web.
2. Search for the application name you used to configure Pinpoint Agent.
3. Top 50 URIs used in your application will be displayed below the empty chart.
4. Click each URI to load the chart.


# URI 통계 <a id="uri-statistics-ko"></a>
URI 통계 기능은 핀포인트 v2.5.0에 신규로 추가되었다.
핀포인트 에이전트에서 URI 템플릿 정보를 수집하여 GRPC를 사용해 핀포인트 콜렉터에 전달하고, 핀포인트 콜렉터는 아파치 카프카를 통해 아파치 피노에 값을 저장한다.
핀포인트 웹에서 저장된 URI 통계 데이터를 확인할 수 있다.



## 1. 설치 및 설정 방법
### 1.1 Pinot와 Kafka 준비
Pinot와 Kafka가 이미 설치되어 있다면 이 준비 단계는 건너뛰어도 됩니다. 아직 설치하지 않았다면 URI Statistics용 topic과 table을 생성하기 전에 [Pinot 설치 가이드](../getting-started/installation.md#pinot)를 참고하여 Pinot와 Kafka를 준비합니다.

### 1.2 Kafka topic 생성
`url-stat` Kafka topic을 64 partitions로 생성한다. 이 값은 `segmentPartitionConfig`를 사용하는 Pinpoint 기본 Pinot table 설정의 `numPartitions` 값과 일치한다.

```
$ bin/kafka-topics.sh --create --topic url-stat --partitions 64 --bootstrap-server ${YOUR_KAFKA_SERVER_ADDRESS}
```

### 1.3 Pinot table 생성

- [핀포인트 깃헙 저장소](https://github.com/pinpoint-apm/pinpoint/tree/master/uristat/uristat-common/src/main/pinot)에 URI 통계를 위한 피노 테이블 스키마와 테이블 정보가 있다.
- 위 경로에서 스키마 파일과 테이블 설정을 참고해서 `uriStat` 테이블을 생성한다. hybrid table 기능 사용을 위해서 REALTIME, OFFLINE 테이블 둘다 생성하자.
- 피노에 필요한 테이블을 구성하는 방법은 [피노 공식 문서](https://docs.pinot.apache.org/basics/components/table#streaming-table-creation)를 참고하자.

### 1.4 핀포인트 에이전트 설정
URI 통계 수집을 위해 핀포인트 에이전트에 설정해야 하는 값들을 안내한다.

#### 1.4.1 URI 통계 수집을 위한 설정 값
URI 통계 수집과 관련된 핀포인트 에이전트의 설정 기본값들은 아래와 같다.

```
###########################################################
# URI Stat
###########################################################
profiler.uri.stat.enable=true
profiler.uri.stat.spring.webmvc.enable=true
profiler.uri.stat.spring.webmvc.useuserinput=false
profiler.uri.stat.spring.webflux.enable=true
profiler.uri.stat.spring.webflux.useuserinput=false
profiler.uri.stat.vertx.enable=true
profiler.uri.stat.vertx.useuserinput=false
profiler.uri.stat.tomcat.useuserinput=false
profiler.uri.stat.jetty.useuserinput=false
```
- profiler.uri.stat.enable: 핀포인트 에이전트가 URI 통계를 수집하는지 여부.
  - `true`: URI 통계를 수집한다.
  - `false`: URI 통계를 수집하지 않는다.
- profiler.uri.stat.spring.webmvc.enable: 핀포인트 에이전트가 스프링 웹 MVC 어플리케이션에서 URI 통계를 수집하는지 여부.
  - `true`: 스프링 웹 MVC 어플리케이션에서 URI 통계를 수집힌다.
  - `false`: 스프링 웹 MVC 어플리케이션에서 URI 통계를 수집하지 않는다.
- profiler.uri.stat.spring.webmvc.useuserinput: 핀포인트 에이전트가 스프링 웹 어플리케이션에서 사용자 정의 URI 템플릿을 우선적으로 사용하는지 여부.
  - `true`: 스프링 웹 어플리케이션에서 사용자 정의 URI 템플릿을 우선적으로 사용한다.
  - `false`: 스프링 웹 어플리케이션에서 사용자 정의 URI 템플릿을 확인하지 않고 핀포인트가 수집한 템플릿만 사용한다.
  
  핀포인트에서 수집하는 URI 템플릿을 사용하지 않고 사용자 정의 URI 템플릿을 사용하고 싶다면, 아래 예제와 같이 스프링 웹 리퀘스트 객체 attribute에 `pinpoint.metric.uri-template`를 key 값으로 하는 속성 값을 설정해야 한다. 
  
  ```
    @RequestMapping("/testUserInputRequestAttribute")
    public Map<String, Object> testUserInputAttribute(HttpServletRequest request) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("message", "test user input attribute");
        request.setAttribute("pinpoint.metric.uri-template", "/userInput");
        return map;
    }
  ```
- profiler.uri.stat.spring.webflux.enable: 핀포인트 에이전트가 스프링 웹플럭스 어플리케이션에서 URI 통계를 수집하는지 여부.
  - `true`: 스프링 웹플럭스 어플리케이션에서 URI 통계를 수집힌다.
  - `false`: 스프링 웹플럭스 어플리케이션에서 URI 통계를 수집하지 않는다.
- profiler.uri.stat.spring.webflux.useuserinput: 핀포인트 에이전트가 스프링 웹플럭스 어플리케이션에서 사용자 정의 URI 템플릿을 우선적으로 사용하는지 여부.
  - `true`: 스프링 웹플럭스 어플리케이션에서 사용자 정의 URI 템플릿을 우선적으로 사용한다.
  - `false`: 스프링 웹플럭스 어플리케이션에서 사용자 정의 URI 템플릿을 확인하지 않고 핀포인트가 수집한 템플릿만 사용한다.
  
  핀포인트에서 수집하는 URI 템플릿을 사용하지 않고 사용자 정의 URI 템플릿을 사용하고 싶다면, 아래 예제와 같이 스프링 웹 리퀘스트 객체 attribute에 `pinpoint.metric.uri-template`를 key 값으로 하는 속성 값을 설정해야 한다. 
  
  ```
    @GetMapping("/server/welcome/**")
    public Mono<String> welcome(ServerWebExchange exchange) {
        exchange.getAttributes().put("pinpoint.metric.uri-template", "/test");
        return Mono.just("Welcome Home");
    }
  ```
  
- profiler.uri.stat.vertx.enable: 핀포인트 에이전트가 Vert.x 어플리케이션에서 URI 통계를 수집하는지 여부.
  - `true`: Vert.x 어플리케이션에서 URI 통계를 수집힌다.
  - `false`: Vert.x 어플리케이션에서 URI 통계를 수집하지 않는다.
- profiler.uri.stat.vertx.useuserinput: 핀포인트 에이전트가 Vert.x 어플리케이션에서 사용자 정의 URI 템플릿을 우선적으로 사용하는지 여부.
  - `true`: Vert.x 어플리케이션에서 사용자 정의 URI 템플릿을 우선적으로 사용한다.
  - `false`: Vert.x 어플리케이션에서 사용자 정의 URI 템플릿을 확인하지 않고 핀포인트가 수집한 템플릿만 사용한다.
    
  핀포인트에서 수집하는 URI 템플릿을 사용하지 않고 사용자 정의 URI 템플릿을 사용하고 싶다면, 아래 예제와 같이 Vert.x RoutingContext 객체에  `pinpoint.metric.uri-template` 를 key 값으로 하는 속성 값을 설정해야 한다.
    
  ```
    router.get("/routinContextAttributeAdded").handler(routingContext -> {
        routingContext.put("pinpoint.metric.uri-template", "/test");
        routingContext.response().end("pinpoint.metric.uri-tempate = /test");
    });
  ```
- profiler.uri.stat.tomcat.useuserinput: (v2.5.3에 추가 됨) 핀포인트 에이전트가 Tomcat 어플리케이션에서 사용자 정의 URI 템플릿을 사용하여 통계를 수집하는지 여부.
  - `true`: Tomcat 어플리케이션에서 사용자 정의 URI 템플릿을 사용하여 URI 통계를 수집한다.
  - `false`: URI 통계 수집을 할 때 Tomcat 리퀘스트 attribute를 확인하지 않는다.
  
  이 옵션은 지원하는 프레임워크(Spring WebMVC, Spring Webflux, VertX)를 사용하지 않는 Tomcat 어플리케이션에서 URI 통계를 수집하기 위해 추가되었습니다.
  만약 지원하는 프레임워크를 사용하고 있다면, 해당 프레임워크 관련 URI 통계 옵션을 사용하고 이 옵션은 false로 사용하는 것을 권장합니다.
  지원하는 프레임워크에서와는 다르게 Tomcat 자체적으로 URI 템플릿을 제공하지 않기 때문에, 이 옵션을 사용할 경우, 사용자가 직접 Tomcat request attribute에 `pinpoint.metric.uri-template`를 추가하여야만 URI 통계가 수집됩니다.

- profiler.uri.stat.jetty.useuserinput: (v4.0.1에 추가 됨) 핀포인트 에이전트가 Jetty 어플리케이션에서 사용자 정의 URI 템플릿을 사용하여 통계를 수집하는지 여부.
  - `true`: Jetty 어플리케이션에서 사용자 정의 URI 템플릿을 사용하여 URI 통계를 수집한다.
  - `false`: URI 통계 수집을 할 때 Jetty 리퀘스트 attribute를 확인하지 않는다.

  이 옵션은 위 Tomcat 옵션과 같은 방식으로, 지원하는 프레임워크를 사용하지 않는 Jetty 어플리케이션(예: Jetty 위의 JAX-RS)에서 URI 통계를 수집하기 위해 추가되었습니다.
  Jetty 플러그인과 Jetty 12 플러그인 모두에 적용됩니다.
  Jetty 자체적으로 URI 템플릿을 제공하지 않기 때문에, 사용자가 직접 Jetty request attribute에 `pinpoint.metric.uri-template`를 추가하여야만 URI 통계가 수집됩니다.
  attribute는 요청 처리가 끝나기 전에 설정해야 합니다. 비동기 요청에서 최초 dispatch가 반환된 뒤에 설정한 attribute는 사용되지 않습니다.

  ```
    @GET
    @Path("/orders/{orderId}")
    public Response getOrder(@PathParam("orderId") String orderId, @Context HttpServletRequest request) {
        request.setAttribute("pinpoint.metric.uri-template", "/orders/{orderId}");
        return Response.ok().build();
    }
  ```

위 설정 값들을 변경하려면 원하는 [핀포인트 프로파일 경로](https://github.com/pinpoint-apm/pinpoint/tree/master/agent/src/main/resources/profiles)의 `pinpoint.config` 파일에서 값을 변경하여 핀포인트를 재빌드한다. 파일을 수정하지 않고, 핀포인트 에이전트를 붙힐 어플리케이션을 실행할 때 `-Dprofiler.uri.stat.enable=false`와 같이 값을 넣어도 된다.

### 1.5 핀포인트 콜렉터와 핀포인트 웹 설정 및 실행
URI 통계를 수집하려면 [collector starter](../getting-started/installation.md#collector-starter)를 `BASIC` 또는 `ALL` 타입으로 실행한다.
URI 통계 데이터를 확인하려면 [web starter](../getting-started/installation.md#web-starter)를 실행한다.

- URI 통계 수집을 활성화하려면 [pinpoint.collector.properties](https://github.com/pinpoint-apm/pinpoint/tree/master/metric-module/collector-starter/src/main/resources/profiles)에 아래 설정값을 추가한다:

	```
	collector.stat.uri=true
	```

- URI Statistics 메뉴를 표시하려면 [pinpoint-web-uristat.properties](https://github.com/pinpoint-apm/pinpoint/tree/master/uristat/uristat-web/src/main/resources/profiles)에 아래 설정값을 추가한다:

	```
	config.show.urlStat=true
	```
	

## 2. URI 통계 데이터 조회

1. 핀포인트 웹을 실행하여 왼쪽 `URL Statistic` 메뉴를 선택한다.
2. 상단의 select box에서 핀포인트 에이전트에 설정한 어플리케이션 이름을 조회한다.
3. 초기 화면에서는 선택한 어플리케이션에서 가장 많이 사용한 상위 50개 URI가 빈 차트 밑에 표시된다.
4. 원하는 URI를 클릭하면 차트에 데이터가 표시된다.

---

## File: documents/uri_statistics_alarm.md

# URI Statistics Alarms
Alarms for URI statistics will be introduced to Pinpoint in v3.0.0.
Similar to the existing [alarms in Pinpoint](https://pinpoint-apm.gitbook.io/pinpoint/documents/alarm), pinpoint-batch server checks every 3 minutes if configured alarm rules are triggered with data in the last 5 minutes.

## 1. Alarm Rules
Alarms rules can be created for each URI, using data collected with [URI Statistics](https://pinpoint-apm.gitbook.io/pinpoint/documents/uri_statistics).

### Alarm Data
- APDEX: The APDEX score of the specified URI for the past 5 minutes (0.00 ~ 1.00)
- Average Response Time: The avgerage response time of the specified URI for the past 5 minutes (ms)
- Maximum Response Time: The maximum response time of the specified URI for the past 5 minutes (ms)
- Total Request Count: The total number of requests made to the specified URI in the past 5 minutes
- Failed Request Count: The number of failed requests to the specified URI in the past 5 minutes

### Alarm Condition
When setting up a new alarm, the conditions for triggering the alarm need to be specified.
You can choose from the following comparison operators:

- (collected value) `>` (threshold value)
- (collected value) `>=` (threshold value)
- (collected value) `==` (threshold value)
- (collected value) `<` (threshold value)
- (collected value) `<=` (threshold value)

## 2. Configuration and Implementation
To use URI Statistics Alarms, MYSQL table `pinot_alarm_history`, `pinot_alarm_rule`, and `pinot_webhook_send` need to be added.

```
CREATE TABLE `pinot_alarm_history` (
  `history_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `rule_id` int(10) unsigned NOT NULL,
  `timestamp` datetime NOT NULL,
  PRIMARY KEY (`history_id`)
);
```

```
CREATE TABLE `pinot_alarm_rule` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `service_name` varchar(30) NOT NULL,
  `application_name` varchar(30) NOT NULL,
  `category_name` varchar(30) NOT NULL,
  `checker_name` varchar(30) NOT NULL,
  `target` varchar(256) NOT NULL,
  `condition` varchar(30) NOT NULL,
  `threshold` decimal(10,2) DEFAULT NULL,
  `baseline` varchar(30) DEFAULT NULL,
  `user_group_id` varchar(30) NOT NULL,
  `sms_send` char(1) DEFAULT NULL,
  `email_send` char(1) DEFAULT NULL,
  `webhook_send` char(1) DEFAULT NULL,
  `notes` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
);
```

```
CREATE TABLE `pinot_webhook_send` (
  `webhook_send_info_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `webhook_id` int(10) unsigned NOT NULL,
  `rule_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`webhook_send_info_id`),
  UNIQUE KEY `webhook_send_info_id_UNIQUE` (`webhook_send_info_id`)
);
```

## 3. How to add alarms on Web UI
(TO BE UPDATED)


# URI 통계 알람
[URI 통계](https://pinpoint-apm.gitbook.io/pinpoint/documents/uri_statistics)를 이용한 알람 기능은 핀포인트 2.6.0에 추가되었습니다.
기존 [핀포인트 알람](https://pinpoint-apm.gitbook.io/pinpoint/documents/alarm)에서와 동일하게 pinpoint-batch 서버가 매 3분동안 지난 5분간의 데이터가 알람 조건을 만족하는 지 체크합니다.

## 1. 설정 가능한 알람
[URI 통계](https://pinpoint-apm.gitbook.io/pinpoint/documents/uri_statistics) 기능으로 수집한 통계값을 사용하여 특정 URI에 대해 아래와 같은 조건으로 알람을 설정할 수 있습니다.

### 알람 대상 데이터
- APDEX: 해당 URI의 과거 5분 동안의 APDEX 점수 (0.00 ~ 1.00)
- 평균 응답 속도: 해당 URI의 과거 5분 동안의 평균 응답 속도 (ms)
- 최대 응답 속도: 해당 URI의 과거 5분 동안의 최대 응답 속도 (ms)
- 전체 요청 수: 해당 URI의 과거 5분 동안의 전체 request 개수
- 실패 요청 수: 해당 URI의 과거 5분 동안 실패한 request의 개수

### 알람 조건
새로운 알람을 등록할 때 수집한 값이 지정한 임계값과 비교해서 어떤 조건일 때 알람이 울리는 지 설정하게 됩니다.
다음 비교 연산자 중에서 선택할 수 있고 아래 조건이 만족하면 알람이 울립니다.

- (수집한 값) `>` (설정한 값)
- (수집한 값) `>=` (설정한 값)
-  (수집한 값) `==` (설정한 값)
-  (수집한 값) `<` (설정한 값)
-  (수집한 값) `<=` (설정한 값) 


## 2. 설치 및 설정 방법
URI 통계 알람을 사용하기 위해서는 MYSQL table 세 개( `pinot_alarm_history`, `pinot_alarm_rule`, `pinot_webhook_send`)를 추가해야 합니다.

```
CREATE TABLE `pinot_alarm_history` (
  `history_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `rule_id` int(10) unsigned NOT NULL,
  `timestamp` datetime NOT NULL,
  PRIMARY KEY (`history_id`)
);
```

```
CREATE TABLE `pinot_alarm_rule` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `service_name` varchar(30) NOT NULL,
  `application_name` varchar(30) NOT NULL,
  `category_name` varchar(30) NOT NULL,
  `checker_name` varchar(30) NOT NULL,
  `target` varchar(256) NOT NULL,
  `condition` varchar(30) NOT NULL,
  `threshold` decimal(10,2) DEFAULT NULL,
  `baseline` varchar(30) DEFAULT NULL,
  `user_group_id` varchar(30) NOT NULL,
  `sms_send` char(1) DEFAULT NULL,
  `email_send` char(1) DEFAULT NULL,
  `webhook_send` char(1) DEFAULT NULL,
  `notes` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
);
```

```
CREATE TABLE `pinot_webhook_send` (
  `webhook_send_info_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `webhook_id` int(10) unsigned NOT NULL,
  `rule_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`webhook_send_info_id`),
  UNIQUE KEY `webhook_send_info_id_UNIQUE` (`webhook_send_info_id`)
);
```

## 3. 알람 추가하는 법
[ Web 구현 후 추가 예정]

---

## File: getting-started/docker.md

---
title: Pinpoint on Docker
keywords: 'docker pinpoint, pinpoint install'
last_updated: 'May 14, 2018'
sidebar: mydoc_sidebar
permalink: docker.html
disqus: false
---

# Install with Docker

We've create docker files to support docker.  
Installing Pinpoint with these docker files will take approximately 10min. to check out the features of Pinpoint.

Visit [Official Pinpoint-Docker repository](https://github.com/pinpoint-apm/pinpoint-docker) for more information.