データレイク監視のカスタムソース機能で、APIやSDKを使用してアプリケーションからデータをプッシュできます。これにより様々な環境に合わせたメトリック収集を実現できます。
カスタムソースを使用してデータをプッシュする方法は次の通りです。

SDKまたはAPI経由でデータをプッシュできます。
このオプションを使用して生データ(未集約データ)を送信し、Site24x7で集約を行います。
手順1:アプリケーションへのSDKの追加と設定
ロギングのため、アプリケーション内に「SLF4J」jarファイルが必要です。追加されていない場合は、追加してください。
手順2:SDK MetricProviderのオブジェクト作成
「MetricProviderBuilder」クラスを使用してSite24x7エクスポーターをもつ「MetricProvider」を作成します。このオブジェクトを使用してメトリックデータをプッシュします。
シングルアプリケーションの場合、単一のライセンスキーが適用されます。同一アプリケーション内で新規オブジェクトが作成されても、最初のライセンスキーが使用され続けます。
// Create Metric provider using the following code snippet
MetricProvider provider = new MetricProvider("");
DataLakeProvider dataLake = provider.createDataLake(""); // The app key associated with the Data-lake monitor.
DataLakeResource resource = dataLake.createResource(new HashMap(){{
put("host", "192.168.10.254");
}});// Set of tags to associate with a list of metrics created using the appkey resource
// Push data using different methods like Count, Rate, Gauge, Histogram.
resource.gauge(
"ResponseTime", // The metric name (field name)
180, // The numerical value of the metric
"ms",// Unit of the metric (Default unit will be Count)
new HashMap(){{
put("host", "192.168.10.254");
}}); // Set of tags to be associated with the metric
手順3:生データをSDKに送信
メソッドを指定し、設定した項目の値を集約します。
Count
metricProvider.count(
"<app key>", // The app key associated with the Data-lake monitor
"db_write", // The metric name (field name)
2.0, // Numerical value of the metric
Collections.singletonMap("host", "192.168.10.254") // Set of tags to associate with the metric
);
Rate
metricProvider.rate(
"<app key>",
"disk_free",
16868264.0,
Collections.singletonMap("host", "192.168.10.254")
);
Gauge
metricProvider.gauge(
"<app key>",
"disk_free",
16868264.0,
Collections.singletonMap("host", "192.168.10.254")
);
Histogram
metricProvider.histogram(
"<app key>",
"disk_free",
16868264.0,
Collections.singletonMap("host", "192.168.10.254")
);
補足事項は次の通りです。
このオプションを使用して、集約データをプッシュします。

[
{
"metrics":[
{
"unit":"ms",
"datavalues":[
{
"p0":0,
"p99":16,
"p100":17,
"time_stamp":"1739341985265",
"count":10,
"p50":12,
"value":100,
"p95":15,
"tags":{
"metric_tag_2":"metricTag2Data",
"metric_tag_1":"metricTag1Data"
}
}
],
"name":"MetricName",
"type":"rate",
"description ":"Sample Description"
}
],
"tags":{
"group_tag_1":"groupTag1data",
"group_tag_2":"groupTag2data"
}
}
]
補足事項は次の通りです。
| タイプ | サポートしている単位 | 基本単位 |
|---|---|---|
| サイズ | バイト、KB、MB、GB、TB | バイト |
| 時間 | マイクロ秒、ミリ秒、秒、分、時間、日 | ミリ秒 |
| 数 | 一、千、十万、百万、十億、兆 | 一 |