Glowroot を Liferay で使用する
Liferay DXP 2023.Q4+/ポータル GA100+
Liferay には、オープンソースの Java アプリケーション監視ツールである Glowrootがバンドルされています。 このツールは、最小限のオーバーヘッドで、システムに関する役立つ統計情報 (サーバー要求、エラーなど) を表示します。 Glowroot を使用して、問題のトラブルシューティングを行い、パフォーマンスの問題を分析します。
Liferay DXP の複数のノードを持つクラスター環境で作業している場合、Glowroot データが誤解を招く可能性があります。
Glowroot を有効にする
セルフホストのみ
Liferay PaaS で Glowroot を有効にするには、「 PaaS で Glowroot を有効にする」を参照してください。
GLOWROOT_ENABLED 環境変数を trueに設定して、Glowroot を有効にします。 例:
docker run -e GLOWROOT_ENABLED=true -it -m 8g -p 8080:8080 liferay/dxp:latest
Tomcat バンドルを使用する場合は、コマンド ラインから Glowroot を実行します。 バンドルの $CATALINA_HOME/bin フォルダに移動します。 次に、 ./catalina.sh glowroot run (または Windows の場合は catalina.bat glowroot run ) を実行します。
Glowrootへのアクセス
Glowroot にアクセスするには、まず 管理者アカウントを使用して Liferay インスタンスにログインします。 Glowroot にアクセスできるのは、管理者ロールを持つユーザーのみです。
ダッシュボードにアクセスするには、 http://localhost:8080/o/glowroot に移動します。

中央コレクターを構成する
デフォルトでは、Glowroot は、JVM クラッシュの際にデータを保持しない埋め込みコレクターで構成されています。 glowroot.properties ファイルを $LIFERAY_HOME/glowroot フォルダに作成して、中央コレクターを構成します。
agent.id=liferay
collector.address=http://<collector_host>:8181
または、 docker で中央コレクターを設定します。
Glowroot によるアップグレードの監視
Glowroot は、Liferay のアップグレードを監視するように設定できます。 config.json ファイルを作成し、 $LIFERAY_HOME/glowroot/ フォルダーに配置します。 以下のサンプル構成をコピーして JSON ファイルに貼り付けます。
{
"advanced":
{
"immediatePartialStoreThresholdSeconds": 60,
"maxProfileSamplesPerTransaction": 50000,
"maxQueryAggregates": 500,
"maxServiceCallAggregates": 500,
"maxTraceEntriesPerTransaction": 2000,
"maxTransactionAggregates": 500,
"mbeanGaugeNotFoundDelaySeconds": 60
},
"gauges":
[
{
"mbeanAttributes":
[
{
"name": "HeapMemoryUsage.used"
}
],
"mbeanObjectName": "java.lang:type=Memory"
},
{
"mbeanAttributes":
[
{
"counter": true,
"name": "CollectionCount"
},
{
"counter": true,
"name": "CollectionTime"
}
],
"mbeanObjectName": "java.lang:type=GarbageCollector,name=*"
},
{
"mbeanAttributes":
[
{
"name": "Usage.used"
}
],
"mbeanObjectName": "java.lang:type=MemoryPool,name=*"
},
{
"mbeanAttributes":
[
{
"name": "FreePhysicalMemorySize"
},
{
"name": "ProcessCpuLoad"
},
{
"name": "SystemCpuLoad"
}
],
"mbeanObjectName": "java.lang:type=OperatingSystem"
}
],
"instrumentation":
[
{
"alreadyInTransactionBehavior": "capture-new-transaction",
"captureKind": "transaction",
"className": "com.liferay.portal.kernel.upgrade.UpgradeStep",
"methodName": "upgrade",
"methodParameterTypes":
[],
"order": 0,
"timerName": "Upgrade Step Timer",
"traceEntryMessageTemplate": "Upgrade Step {{this.class.name}}",
"transactionNameTemplate": "Upgrade Step {{this.class.name}}",
"transactionType": "Upgrade"
},
{
"alreadyInTransactionBehavior": "capture-new-transaction",
"captureKind": "transaction",
"className": "com.liferay.portal.kernel.upgrade.UpgradeProcess",
"methodName": "upgrade",
"methodParameterTypes":
[],
"order": 0,
"timerName": "Upgrade Process Timer",
"traceEntryMessageTemplate": "Upgrade Process {{this.class.name}}",
"transactionNameTemplate": "Upgrade Process {{this.class.name}}",
"transactionType": "Upgrade"
}
],
"jvm":
{
"maskMBeanAttributes":
[
"*password*"
],
"maskSystemProperties":
[
"*password*"
]
},
"plugins":
[
{
"id": "cassandra",
"properties":
{
"stackTraceThresholdMillis": 1000.0
}
},
{
"id": "elasticsearch",
"properties":
{
"stackTraceThresholdMillis": 1000.0
}
},
{
"id": "java-http-server",
"properties":
{
"captureRequestHeaders":
[],
"captureRequestRemoteAddr": false,
"captureRequestRemoteHost": false,
"captureResponseHeaders":
[],
"maskRequestHeaders":
[
"Authorization"
],
"traceErrorOn4xxResponseCode": false
}
},
{
"id": "jaxrs",
"properties":
{
"useAltTransactionNaming": false
}
},
{
"id": "jdbc",
"properties":
{
"captureBindParametersExcludes":
[],
"captureBindParametersIncludes":
[
".*"
],
"captureConnectionClose": false,
"captureConnectionLifecycleTraceEntries": false,
"captureConnectionPoolLeakDetails": false,
"captureConnectionPoolLeaks": false,
"captureGetConnection": true,
"capturePreparedStatementCreation": false,
"captureResultSetGet": false,
"captureResultSetNavigate": true,
"captureStatementClose": false,
"captureTransactionLifecycleTraceEntries": false,
"stackTraceThresholdMillis": 1000.0
}
},
{
"id": "liferay-freemarker-templates-plugin",
"properties":
{
"instrumentationLevel": "INFO"
}
},
{
"id": "logger",
"properties":
{
"traceErrorOnErrorWithThrowable": true,
"traceErrorOnErrorWithoutThrowable": false,
"traceErrorOnWarningWithThrowable": false,
"traceErrorOnWarningWithoutThrowable": false
}
},
{
"id": "mongodb",
"properties":
{
"stackTraceThresholdMillis": 1000.0
}
},
{
"id": "play",
"properties":
{
"useAltTransactionNaming": false
}
},
{
"id": "servlet",
"properties":
{
"captureRequestHeaders":
[],
"captureRequestLocalAddr": false,
"captureRequestLocalHostname": false,
"captureRequestLocalPort": false,
"captureRequestParameters":
[
"*"
],
"captureRequestRemoteAddr": false,
"captureRequestRemoteHostname": false,
"captureRequestRemotePort": false,
"captureRequestServerHostname": false,
"captureRequestServerPort": false,
"captureResponseHeaders":
[],
"captureSessionAttributes":
[],
"maskRequestParameters":
[
"*password*"
],
"sessionUserAttribute": "",
"traceErrorOn4xxResponseCode": false
}
},
{
"id": "spring",
"properties":
{
"useAltTransactionNaming": false
}
}
],
"transactions":
{
"captureThreadStats": true,
"profilingIntervalMillis": 1000,
"slowThresholdMillis": 2000
},
"uiDefaults":
{
"defaultGaugeNames":
[
"java.lang:type=Memory:HeapMemoryUsage.used"
],
"defaultPercentiles":
[
50.0,
95.0,
99.0
],
"defaultTransactionType": "Web"
}
}
Liferay がアップグレードの監視を開始するときに Glowroot を起動するには、この構成が必要であることに注意してください。 自動アップグレード機能を使用して Liferay のアップグレードをトリガーします。
アップグレードが完了すると、Glowroot のドロップダウン メニューに「アップグレード」という新しいトランザクション タイプが表示されます。 ダッシュボードを表示するには、ドロップダウン メニューから アップグレード を選択します。
