エージェントのインストール
OpenTelemetryエージェントのインストール方法を案内します。
エージェントダウンロード
次のコマンドを実行してOpenTelemetry Collectorがインストールされているインスタンスにエージェントをダウンロードします。
- Red Hat/Centos
- Debian/Ubuntu
- Amazon Linux
- Alpine Linux
- Alpine Linux Docker
# Register package repository
$ sudo rpm -Uvh https://repo.whatap.io/centos/5/noarch/whatap-repo-1.0-1.noarch.rpm
# Install package
$ sudo yum install whatap-otel
# Register package repository
$ wget https://repo.whatap.io/debian/release.gpg -O -|sudo apt-key add -
$ wget https://repo.whatap.io/debian/whatap-repo_1.0_all.deb
$ sudo dpkg -i whatap-repo_1.0_all.deb
$ sudo apt-get update
# Install package
$ sudo apt-get install whatap-otel
# Register package repository
$ sudo rpm --import https://repo.whatap.io/centos/release.gpg
$ echo "[whatap]" | sudo tee /etc/yum.repos.d/whatap.repo > /dev/null
$ echo "name=whatap packages for enterprise linux" | sudo tee -a /etc/yum.repos.d/whatap.repo > /dev/null
$ echo "baseurl=https://repo.whatap.io/centos/latest/\$basearch" | sudo tee -a /etc/yum.repos.d/whatap.repo > /dev/null
$ echo "enabled=1" | sudo tee -a /etc/yum.repos.d/whatap.repo > /dev/null
$ echo "gpgcheck=0" | sudo tee -a /etc/yum.repos.d/whatap.repo > /dev/null
# Install package
$ sudo yum install whatap-otel
$ wget https://s3.ap-northeast-2.amazonaws.com/repo.whatap.io/alpine/x86_64/whatap-otel.tar.gz
$ tar -xvzf whatap-otel.tar.gz -C /
FROM alpine
RUN apk update && apk upgrade
# Install WhaTap Go monitoring agent
RUN wget https://s3.ap-northeast-2.amazonaws.com/repo.whatap.io/alpine/x86_64/whatap-otel.tar.gz
RUN tar -xvzf whatap-otel.tar.gz -C /
エージェントのデフォルト設定
エージェント設定には、WhaTapプロジェクトのアクセスキーと収集サーバーのIPアドレスが必要です。 WhaTapモニタリングサービスでアプリケーション(Application)商品のプロジェクトに移動します。 管理 > エージェントインストール メニューでアクセス キーと収集サーバーのIPアドレスを確認して準備します。
whatap.confファイルを設定する
エージェント設定(whatap.conf) ファイルへのアクセスキーと収集サーバーのIPアドレスを設定します。
echo "accesskey={ACCESS_KEY}" >> /usr/whatap/otel/whatap.conf
echo "whatap.server.host={COLLECTOR_SERVER_IP_ADDRESS}" >> /usr/whatap/otel/whatap.conf
環境変数で設定する
環境変数(Environment)でアクセスキーと 収集サーバーのIP アドレスを設定できます。
WHATAP_ACCESSKEY={ACCESS_KEY}
WHATAP_SERVER_HOST={COLLECTOR_SERVER_IP_ADDRESS}
WHATAP_OTEL_GRPC_SERVER_PORT={gRPC_SERVER_LISTENING_PORT}
WHATAP_OTEL_HTTP_SERVER_PORT={HTTP_SERVER_LISTENING_PORT}
環境変数とwhatap.confファイルをすべて設定した場合、whatap.confファイルの設定値が優先されます。
エージェントの起動
設定が完了したらエージェントを起動します。新規インストールの場合、エージェントは自動的に起動しません。
- Red Hat/Centos, Debian/Ubuntu, Amazon Linux
- Alpine Linux
$ sudo systemctl start whatap-otel
$ sudo systemctl status whatap-otel
$ /usr/whatap/otel/whatap-otel start
whatap.confファイルまたは環境変数を変更した後は、エージェントを再起動すると変更内容が適用されます。
Dockerインストール
Opentelemetry Collectorがインストールされていれば、Docker containerでwhatap-otelを実行してCollectorのデータをgRPC 6600ポートまたはHTTP 6601ポートで受け取ることができます。
docker pull whatap/whatap-otel
version: '3.7'
services:
whatap_otel:
image: whatap/whatap-otel:latest
environment:
WHATAP_ACCESSKEY: x605111111111-z11111111-x1111111111m
WHATAP_SERVER_HOST: 1.1.1.1/2.2.2.2
WHATAP_OTEL_GRPC_SERVER_PORT: 6600
otel_metric_server_enabled: true
otel_log_server_enabled: true
log_stdout_enabled: true
#debug_otel_grpc_server_enabled: true
ports:
- 6600:6600
- 6601:6601
Kubernatesインストール
Opentelemetry Collectorとwhatap-otelを一つのPODの中に一緒に生成するdeploymentの例で す。
metadata:
name: otel-collector-deploy
spec:
replicas: 1
selector:
matchLabels:
app: otel-collector
template:
metadata:
name: otel-collector-pod
labels:
app: otel-collector
spec:
containers:
- name: otel-collector
image: otel/opentelemetry-collector-contrib:0.106.0
ports:
- containerPort: 4317 # OTLP gRPC
- containerPort: 4318 # OTLP HTTP
volumeMounts:
- name: config-volume-otelcol
mountPath: /etc/otel/config.yaml
subPath: otel-collector-config.yaml
args: ["--config", "/etc/otel/config.yaml"]
- name: whatap-otel-agent
image: whatap/whatap-otel:latest
ports:
- containerPort: 6600
env:
- name: "WHATAP_ACCESSKEY"
value: "x605111111111-z11111111-x1111111111m"
- name: "WHATAP_SERVER_HOST"
value: "1.1.1.1/2.2.2.2"
- name: "otel_metric_server_enabled"
value: "true"
- name: "otel_log_server_enabled"
value: "true"
- name: "log_stdout_enabled"
value: "true"
- name: NODE_IP
valueFrom: {fieldRef: {fieldPath: status.hostIP}}
- name: NODE_NAME
valueFrom: {fieldRef: {fieldPath: spec.nodeName}}
- name: POD_NAME
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: whatap.micro.enabled
value: "true"
volumes:
- name: config-volume-otelcol
configMap:
name: otelcol-config
apiVersion: v1
kind: ConfigMap
metadata:
name: otelcol-config
data:
otel-collector-config.yaml: |
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
exporters:
otlp:
endpoint: "127.0.0.1:6600"
tls:
insecure: true
logging:
loglevel: debug
processors:
batch:
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp, logging]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlp, logging]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp, logging]
Opentelemetry Collectorの設定
whatap-otelでデータを伝達するようにOTLP Exporterを設定します。
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
processors:
batch:
exporters:
logging:
# otlp exporterにwhatap-otelを対象として設定します。
otlp:
endpoint: 127.0.0.1:6600
tls:
insecure: true
service:
pipelines:
traces:
receivers:
- otlp
processors:
- batch
exporters:
- logging
- otlp
telemetry:
logs:
level: debug #activate debug mode
-
エンドポイント(
endpoint)設定:127.0.0.1:6600ローカルにインストールしたエージェントが使用するデフォルトのポートは 6600です。
-
tls.secure設定:insecure: true -
gzip圧縮設定をデフォルトで使用します。 (gzip使用)
HTTPでの転送
whatap-otelはgRPC(6600)とともにHTTP(6601)でもデータを受信します。CollectorからHTTPで送信するには、otlphttp Exporterを使用します。
exporters:
# otlphttp exporterにwhatap-otelを対象として設定します。
otlphttp:
endpoint: http://127.0.0.1:6601
tls:
insecure: true
service:
pipelines:
traces:
receivers:
- otlp
processors:
- batch
exporters:
- otlphttp
データタイプ別のパスはCollectorがエンドポイントの後ろに追加します。
| Path | Description |
|---|---|
/v1/traces | Traceデータの受信 |
/v1/metrics | Metricデータの受信 |
/v1/logs | Logデータの受信 |
HTTP受信を使用するには、エージェントでotel_http_server_enabledオプションを有効にする必要があります。詳細はエージェント設定ドキュメントを参照してください。
OpenTelemetry Collectorインストールの詳細については、次のリンクを参考にしてください。
その他のプラットフォーム
Tyk Gateway
Tyk GatewayのOpenTelemetry機能を活性化した上でOpenTelemetry Collecotrを通じてトランザクション情報を確認することができます。
- OpenTelemetry CollectorをTyk Gatewayに接続します。
{
"log_level": "debug" ,
"listen_port": 8081,
...
"opentelemetry": {
"enabled": true,
"endpoint": "111.222.333.444:4317",
}
}
- 接続されたOpenTelemetry Collectorにwhatap-otelエージェントが接続されたら、トレース情報を収集します。
Kong Gateway
Kong Gatewayの内蔵OpenTelemetryプラグインを設定すると、OpenTelemetry Collectorを通じてトランザクション情報を確認できます。
OpenTelemetryプラグインで、OpenTelemetry Collectorのエンドポイントを指定します。 CollectorにWhatap-otelエージェントが接続されると、トレース情報が収集されます。
-
kong.conf
trace設定を有効化します。
tracing_instrumentations = all
tracing_sampling_rate = 1 -
OpenTelemetryプラグインの設定
OpenTelemetry CollectorのエンドポイントURLを登録します 。
CollectorのOTLPレシーバーのデフォルト設定は以下のとおりです。
-
Protocol : http
-
Port : 4318
-
URL :
- Trace : /v1/traces
- Log : /v1/logs
-
基本設定の例
traces_endpoint: http://otelcollector:4318/v1/traces
logs_endpoint: http://otelcollector:4318/v1/logs -
kong.yaml の設定例
plugins:
- name: opentelemetry
config:
traces_endpoint: http://otelcollector:4318/v1/traces
logs_endpoint: http://otelcollector:4318/v1/logs
resource_attributes:
service.name: kong-otel -
Admin APIによるプラグイン設定の例
curl -X POST http://localhost:8001/services/plugins \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "opentelemetry",
"config": {
"traces_endpoint": "http://otelcollector:4318/v1/traces",
"logs_endpoint": "http://otelcollector:4318/v1/logs",
"resource_attributes": {
"service.name": "kong-dev"
}
}
}
'
-
- 対応バージョン:Kong Gateway 3.3.x 以上
設定の詳細については、以下のリンクを参照してください。
モニタリングの開始
-
すべての設定を完了した後、アプリケーションサーバーを再起動すると、エージェントが情報を収集します。 ダッシュボード > アプリケーションダッシュボードメニューに移動して、収集されたデータをリアルタイムでモニタリングしてください。
-
エージェント設定の詳細については、次の文書を確認してください。