分析イベント API

Splunk AppDynamics の分析では、分析データをさまざまな種類のソース(エージェントでインストゥルメント化された Java アプリケーション、.NET アプリケーション、ブラウザアプリケーションなど)から収集するために組み込みサポートを提供します。分析イベント API は、カスタムのデータソースとイベントタイプで組み込みの分析データソースを補完します。

アプリケーション エージェントによってパブリッシュされたトランザクションイベントに加えて、分析イベント API によって収集されたカスタムイベントは従量制です。
重要: カスタムイベントのパブリッシュには、トランザクション分析ライセンスが必要です。トランザクション分析ライセンスユニットによって、パブリッシュ可能なカスタムイベントの制限量が決まります。

分析イベント API について

分析では、イベントによって分析データの単位がカプセル化されます。たとえば、APM では、各イベントが、エントリポイントサービスまたはダウンストリームサービスのいずれであるかに関係なく、メソッドまたはサービス呼び出しに対応します。

分析 API を使用して、データストア内の独自のカスタムイベントの構造を定義します。また、カスタムソースで発生するイベントレコードをキャプチャし、それらをイベントサービス(分析用のデータストア)に送信します。データがイベントストアに格納されると、ユーザはコントローラ UI または分析イベント API を使用してデータをクエリできます。

分析イベント API は、共有キーを使用して、クライアントをイベントサービスに認証します。コントローラまたは分析管理者として、コントローラ UI から API キーを生成できます。「API キーの管理」を参照してください。

注: イベントサービス API を使用するには、トランザクション分析ライセンスが必要です。カスタムイベントのビジネストランザクションに適用されるものと同じライセンスモデル(単位/日あたりのイベント数に基づく)が API に適用されます。

イベント サービス データ ストアへの対処

コントローラに表示されるほとんどの Splunk AppDynamics REST API とは異なり、分析イベント API へは Splunk AppDynamics プラットフォームでイベント サービス インスタンスに対処することでアクセスします。

次のいずれかの URL でイベントサービスに対処します。

[SaaS Domains and IP Ranges] ページから分析ドメインの URL を取得できます。

オンプレミス イベント サービスの場合は、イベント サービス インスタンス ホスト(または、イベントサービスクラスタのロードバランサで提示される仮想 IP の場合も多くあります)に対処します。イベントサービスには、プライマリ デフォルト リスニング ポート 9080 を使用します。

分析イベント API へのコールでは、対処するコントローラのアカウントに <global_account_name> と、このクライアントの管理者が生成した <eum_account_name> を指定する必要があります。<api_key> API は、ヘッダーにプロパティと値のペアをコロンで区切った値を想定します。たとえば、cURL 引数には次のように `-H` または `--header ` オプションを使用して curl とともに値が渡されます。

CODE
-H"X-Events-API-AccountName:<global_account_name> OR <eum_account_name>" -H"X-Events-API-Key:<api_key>"

コントローラ UI の [ライセンス(License)] ページ から、使用するグローバルアカウント名を取得できます。API キーについては、「API キーの管理」を参照してください。

また、コンテンツタイプも次のように cURL 引数として指定できます。

CODE
-H"Content-type: application/vnd.appd.events+json;v=2"

Splunk AppDynamics では、API へのアクセスに SSL/HTTPS を使用することを強くお勧めします。SSL/HTTPS 以外を使用する場合は、API キーがプレーンテキスト形式で送信されます。

注: セキュリティ上の理由から、分析イベント API がデフォルトで cross-origin HTTP リクエストを受け入れることはありません。たとえば、Web ページに直接埋め込まれたリンクからのリクエストなどです。

データ形式

分析イベント API は、JSON 形式の名前と値のペアデータとしてイベントを取得します。

カスタムイベントスキーマに準拠したデータを送信する前に、カスタムスキーマのデータ構造を定義する必要があります。イベントサービスは、着信イベントデータを適切なスキーマと照合します。

サポートされるデータ型

  • ブーリアン
  • 日付:サポートされている時刻形式は次のとおりです。
    • ISO 8601 形式:yyyy-MM-dd'T'HH:mm:ss.SSSZZ
    • UNIX エポックの日付形式:13 桁の数字で、UNIX エポック時刻(1970 年 1 月 1 日)以降の秒/ミリ秒時間を表します。たとえば、(GMT): Mon, 17 Apr 2017 23:46:22 GMT は 1492472782000 となります。
  • 浮動小数点数(Float)
  • 整数
  • 文字列

命名制限

カスタムイベント名とフィールド名は、次の条件に従う必要があります。

  • a ~ z、A ~ Z、_(下線)、0 ~ 9 のみを使用します。
  • 名前を数値で始めることはできません。

タイムスタンプフィールド

カスタムスキーマには、次の 2 つの暗黙的なタイムスタンプフィールドが自動的に追加されます。

  • eventTimestamp
  • pickupTimestamp

eventTimestamp フィールドは、イベントが発生した時刻を表します。API クライアントは、イベントを作成するときにタイムスタンプフィールドの値を指定できます。指定できない場合、Analytics Events API は別の暗黙のフィールド pickupTimestamp に使用する値と同じ eventTimestamp の値を使用します。pickupTimestamp フィールドは必ずイベントサービスで入力され、イベントサービスによってイベントが受信された時間が表示されます。

ビジネスジャーニーでマイルストーンを設定する場合は、イベントを登録するために、eventTimestamp フィールドに日付を指定する必要があります。カスタムイベントを使用してビジネスジャーニーを定義するには、カスタムイベントで eventTimestamp フィールドを送信する必要があります。送信しない場合、ビジネスジャーニーは機能しません。

Splunk AppDynamics

ISO 8601 または UNIX エポック時刻(64 ビットミリ秒)形式を使用して、すべてのタイムスタンプフィールドを表すことができます。

API コールフローの例

次の手順に従って、分析イベント API を使用するためのオンプレミス API コールワークフローを実行します。この手順では、スキーマの作成、そのスキーマへのイベントのパブリッシュ、およびイベントのクエリに関する cURL の例を示します。

注: SaaS での展開では、例に挙げた URL およびポートの値(<events_service_endpoint>:9080)を SaaS の URL に置き換えてください。
  1. フィールド名とデータ型を関連付けて、スキーマを定義します。たとえば、次のように購入イベントタイプを定義します。

    JSON
    curl -X POST "<events_service_endpoint>:9080/events/schema/myProducts" -H"X-Events-API-AccountName:customer1_1234-567a-bccc-123" -H"X-Events-API-Key:a123b456-c789-1d23-e456-nnn" -H"Content-type: application/vnd.appd.events+json;v=2" -d '{"schema" : { "id": "string", "productBrand": "string", "userRating": "integer", "price": "float", "productName": "string", "description": "string" } }'
  2. 作成したスキーマに基づいてイベントをパブリッシュします。

    JSON
    curl -X POST "<events_service_endpoint>:9080/events/publish/myProducts" -H"X-Events-API-AccountName:customer1_1234-567a-bccc-123" -H"X-Events-API-Key:a123b456-c789-1d23-e456-nnn" -H"Content-type: application/vnd.appd.events+json;v=2" -d '[{"id": "5653b879ab33a","productBrand": "ACME","userRating": 3,"price": 2006.41,"productName": "Watch","description": "new watch"},{"id": "5653b879700","productBrand": "Widget","userRating": 1,"price": 3800.13,"productName": "Watch","description": "2015 watch"}]'
  3. イベントデータをクエリします。

    CODE
    curl -X POST "http://<events_service_endpoint>:9080/events/query" -H"X-Events-API-AccountName:customer1_7xxx-467a-bccc-xxx" -H"X-Events-API-Key:a123b456-c789-1d23-e456-nnn" -H"Content-type: application/vnd.appd.events+text;v=2" -d 'SELECT * FROM myProducts'

ADQL キーワードが含まれたフィールドを追加する場合は、キーワードを一重引用符で囲みます。これらのキーワードには、betweeninselect などがあります。

クエリ要求が 1 つの場合は、次のコンテンツタイプを使用します。

CODE
-H"Content-type: application/vnd.appd.events+text;v=2"

クエリ要求が複数の場合は、クエリが JSON 本文テキストとして渡されます。この場合は、次のコンテンツタイプヘッダーを使用します。

CODE
-H"Content-type: application/vnd.appd.events+json;v=2"

カスタムイベントの取り込み制限

コントローラによるカスタムイベントの取り込みには、次の制限があります。

  • フィールド:イベントタイプごとに最大 255
  • 文字列属性:最大長 4 KB
  • バッチ総数:コールあたり 10,000 イベント
  • バッチ合計サイズ:コールあたり最大 5 MB
  • アカウントの最大カスタムイベントスキーマ数:20

カスタムイベント制限の追加

注: カスタムイベント制限の追加は、SaaS イベントサービスバージョン 4.5.13 以降で使用できます。オンプレミスのイベントサービスは、カスタムフィールドイベントの最大値 1,500 個を超えることはできません。

イベントサービスでは、デフォルトで最大 1,500 個のカスタムフィールドを作成できます。カスタムフィールドの容量が 80%(1,200 フィールド)に達すると、次のインデックスロールオーバー時に最大フィールド制限が 500 フィールド増加します。

たとえば、1,400 カスタムフィールドに到達すると、最大フィールド制限が 1,500 フィールドから 2,000 フィールドに増加します。その後 1,800 カスタムフィールドに到達すると、最大制限数が 2,500 フィールドに増加します。

作成できるカスタムフィールドの上限は 3,000 個です。最大フィールド数に到達したり、最大フィールド数を超えたりすると、遅延や停止が発生する可能性があります。

イベントのパブリッシュ

Publish Events API コールは、イベントの配列を取得し、イベントサービスストレージに格納します。データは既存のスキーマに準拠している必要があります。1 つの要求を複数のイベントタイプにパブリッシュすることはできません。

イベントデータがイベントスキーマと一致しない場合、イベントサービスは両者が一致するためのベストエフォート型の試みを行い、それでも失敗した場合は「400 Bad Request」を返します。

形式

SaaS
JSON
POST https://analytics.api.example.com/events/publish/{schemaName}
オンプレミス
JSON
POST http://<events_service_endpoint>:9080/events/publish/{schemaName}

クエリパラメータ

N/A

パスパラメータ

Name 説明

accountId

アカウント ID
schemaName

イベントスキーマ名

ヘッダー

Name 説明
X-Events-API-AccountName [License] ページに表示されるグローバルアカウント名または EUM アカウント名。
X-Events-API-Key 分析 API キー。「API キーの管理」を参照してください。
Content-Type 要求本文の Content-Type。デフォルトは、リソース表現(v=2)のバージョンでもある application/vnd.appd.events+json;v=2 です。

SaaS による Publish の例

リクエスト
JSON
POST https://analytics.api.example.com/events/publish/{schemaName}
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
Content-Type: application/vnd.appd.events+json;v=2 Accept: application/vnd.appd.events+json;v=2
[
{
"id": "5653b879ab33a",
"productBrand": "ACME",
"userRating": 3,
"price": 2006.41,
"productName": "Watch",
"description": "new watch"
},
{
"id": "5653b879700",
"productBrand": "Widget",
"userRating": 1,
"price": 3800.13,
"productName": "Watch",
"description": "2015 watch"
}
]
レスポンス
CODE
HTTP/1.1 202 ACCEPTED

エラー コード

エラーコード 説明
400 指定した要求は無効でした。
401 認証ヘッダーで指定した認証情報は無効でした。
404 このアカウントのイベントタイプが見つかりませんでした。
406 Accept ヘッダーは application/vnd.appd.events+json;v=2 ではありませんでした。
413 要求本文のサイズが最大許容値を超えています。
415 Content-Type ヘッダーは application/vnd.appd.events+json;v=2 ではありませんでした。
429 要求が多すぎます。account または event が制限に達した場合に返されます。

イベントスキーマを作成する

独自のイベントスキーマを作成するには、この API を使用します。このスキーマで、フィールドとタイプごとにイベントタイプの全体的な構造を定義します。

この API は、アップロードするイベントが、最初のクラスイベントタイプ(ログやトランザクションなど)の既存のスキーマと一致しない場合にのみ使用する必要があります。既存のスキーマに準拠したイベントは、そのスキーマに自動的に一致します。このトピックより前に記載されている、サポートされるデータ型および命名制限を確認してください。

形式

SaaS
JSON
POST https://analytics.api.example.com/events/schema/{schemaName}
オンプレミス
JSON
POST http://<events_service_endpoint>:9080/events/schema/{schemaName}

パスパラメータ

Name 説明
accountId アカウント ID
schemaName

イベントスキーマ名

クエリパラメータ

N/A

ヘッダー

Name 説明
X-Events-API-AccountName [Controller UI License] ページに表示されるグローバルアカウント名。
X-Events-API-Key 分析 API キー。「API キーの管理」を参照してください。
Accept 応答本文の Content-Type。サポートされる値は、application/vnd.appd.events+json;v=2 です。
Content-type 要求本文の Content-Type。デフォルトは、リソース表現(v=2)のバージョンでもある application/vnd.appd.events+json;v=2 です。

SaaS による Create の例

リクエスト
JSON
POST http://analytics.api.example.com/events/schema/{schemaName} HTTP/1.1
X-Events-API-AccountName:<global_account_name>
X-Events-API-Key:<api_key>
Content-Type: application/vnd.appd.events+json;v=2
Accept: application/vnd.appd.events+json;v=2
{
"schema" : {
"account": "integer",
"amount": "float",
"product": "string"
}
}
レスポンス
CODE
HTTP/1.1 201 CREATED

イベントスキーマを取得する

既存のイベントスキーマを取得するには、この API を使用します。

形式

SaaS
JSON
GET http://analytics.api.example.com/events/schema/{schemaName}
オンプレミス
JSON
GET http://<events_service_endpoint>:9080/events/schema/{schemaName}

パスパラメータ

Name 説明
accountId アカウント ID
schemaName イベントスキーマ名

クエリパラメータ

N/A

ヘッダー

Name 説明
X-Events-API-AccountName [Controller UI License] ページに表示されるグローバルアカウント名。
X-Events-API-Key 分析 API キー。「API キーの管理」を参照してください。
Accept 応答本文の Content-Type。サポートされる値は、application/vnd.appd.events+json;v=2 です。

SaaS による Retrieve の例

リクエスト
JSON
GET http://analytics.api.example.com/events/schema/{schemaName} HTTP/1.1
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
Accept: application/vnd.appd.events+json;v=2
レスポンス
JSON
HTTP/1.1 200 OK
{
"schema" : {
"account": "integer",
"amount": "float",
"product": "string"
}
}

イベントスキーマを更新する

フィールドごとに既存のイベントスキーマを更新するには、この API を使用します。要求本文で、イベントスキーマに適用される更新内容を定義します。

次の例に示すように、各フィールドの更新アクションを要求本文の名前付きセクションとして指定します。アクションは次のフィールドで表されます。

  • 追加フィールド
  • 名前変更フィールド

追加フィールドを定義する場合は、イベントスキーマを作成する場合と同じように、新しいフィールドのデータ形式を指定する必要があります。

このコールへの応答は、変更された完全なイベントスキーマである必要があります。

形式

SaaS
JSON
PATCH http://analytics.api.example.com/events/schema/{schemaName}
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
オンプレミス
JSON
PATCH http://<events_service_endpoint>:9080/events/schema/{schemaName}

パスパラメータ

Name 説明
accountId アカウント ID
schemaName イベントスキーマ名

クエリパラメータ

N/A

ヘッダー

Name 説明
X-Events-API-AccountName [Controller UI License] ページに表示されるグローバルアカウント名。
X-Events-API-Key 分析 API キー。「API キーの管理」を参照してください。
Accept 応答本文の Content-Type。サポートされる値は、application/vnd.appd.events+json;v=2 です。
Content-type 要求本文の Content-Type。デフォルトは、リソース表現(v=2)のバージョンでもある application/vnd.appd.events+json;v=2 です。

SaaS による Update の例

リクエスト
JSON
PATCH http://analytics.api.example.com/events/schema/{schemaName} HTTP/1.1
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
Content-type: application/vnd.appd.events+json;v=2
Accept: application/vnd.appd.events+json;v=2
[
{
"add": {
"newfield": "integer"
},
"rename": {
"oldname": "newname",
"oldname2": "newname2"
}
}
]
レスポンス
CODE
HTTP/1.1 200 OK

イベントスキーマを削除する

既存のイベントスキーマを削除するには、この API を使用します。

形式

SaaS
JSON
DELETE http://<events_service_endpoint>:9080/events/schema/{schemaName}
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
オンプレミス
JSON
DELETE http://<events_service_endpoint>:9080/events/schema/{schemaName}

パスパラメータ

Name 説明
accountId アカウント ID
eventType イベントスキーマ名

クエリパラメータ

N/A

ヘッダー

Name 説明
X-Events-API-AccountName コントローラ UI の [License] ページに表示されるグローバルアカウント名。
X-Events-API-Key 分析 API キー。「API キーの管理」を参照してください。
Accept 応答本文の Content-Type。サポートされている値は次のとおりです。 application/vnd.appd.events+json;v=2

SaaS による Delete 要求の例

JSON
DELETE http://analytics.api.example.com/events/schema/{schemaName} HTTP/1.1
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
Accept: application/vnd.appd.events+json;v=2

Querying Events

When querying analytics events data, the following applies:

  • Every Events Service API has a limit of 200 searches per minute by each account on each event type.

  • The Multi-Query Events API is limited to twenty queries per HTTP request.
  • The Analytics Query API can return a maximum of 10,000 results. If you would like to retrieve and paginate over the data, you can use the scroll mode. Scroll mode is limited to 1,000 results per batch.

    警告: Scroll mode cannot be used in Query Events (Multiple Queries).
  • ADQL sets the rate limits on the following header fields to control large request volumes that may impact system stability:

    • X-Events-API-AccountName: 450 requests per minute.
    • X-Events-API-Key: 145 requests per minute.
  • Limits work differently for aggregation and non-aggregation queries. Because we use the limits specified in the ADQL query as the bucket count limit, it is not possible to also use it as the overall result count limit. Therefore, the URL parametric limit is used for the overall limit. In the case of non-aggregation queries, there is no bucket limit, so the limit specified in the ADQL query is taken as the row count limit and the URL parametric limit becomes the second place to look for it if the ADQL query does not specify a limit.
    • Aggregation queries: the total returned row count is limited by the limit in the URL query parameter, and is not directly related to the limits specified in the ADQL query statement itself. The limits in the ADQL query apply only to bucket counts in aggregations.
    • Non-aggregation queries: If LIMIT is not specified in the SELECT statement, the value specified in the URL query parameter is used. If the limit query parameter is also absent, the default is 100.

Query Events (Single Query)

This API can be used either as a simple text-formatted query or as a JSON-formatted query. The JSON-formatted query can accommodate multiple queries per call and is described in Query Events (Multiple Queries).

An event type might search against multiple event types. Therefore, the event type is not provided in the URL path or as a query parameter, but as part of the ADQL query provided in the request body itself. Your ADQL queries must adhere to the syntax described in the ADQL Reference.

This section describes the single query form for querying events.

Format

SaaS
CODE
POST http://analytics.api.example.com/events/query?limit=20
On-premises
CODE
POST http://<events_service_endpoint>:9080/events/query
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
Content-type: application/vnd.appd.events+text;v=2

Query Params

Name Description
start

Filter results based on the minimum event timestamp, specified in ISO 8601 time (https://en.wikipedia.org/wiki/ISO_8601) or Unix time (http://en.wikipedia.org/wiki/Unix_time). If not specified, then the default is no minimum timestamp filtering. Note that data returned will always be limited by the data retention.

Specify the time in combined UTC date and time format or epoch milliseconds.

Start time is inclusive of limiting timestamps.

end

Filter results based on the maximum event timestamp, specified in ISO 8601 time (https://en.wikipedia.org/wiki/ISO_8601) or Unix time (http://en.wikipedia.org/wiki/Unix_time). If not specified, then the default is no maximum timestamp filtering.

注: Data returned will always be limited by the data retention.

Specify the time in combined UTC date and time format or epoch milliseconds.

End time is inclusive of limiting timestamps.

limit

Limits the number of results returned. The default value is 100. The upper limit on the results that can be fetched is 1,000.

mode

The default mode is none. You can use the scroll mode to fetch bulk data and paginate over 10,000 ADQL results. Unless a limit is specified in the query, the API enables the Events Service to fetch beyond the maximum limit. The default mode supports aggregation but the scroll mode does not support aggregation or math operations. Order by queries is supported in scroll mode.

Scroll queries returns results in batches. Every request response contains results along with a scrollid, which needs to be passed in the next request to fetch the next batch of results.

Headers

Name Description
X-Events-API-AccountName The global account name or the EUM account name, as shown in the Controller UI License page.
X-Events-API-Key The Analytics API key. See Manage API Keys.
Accept The Content-Type of the response body. The supported value is application/vnd.appd.events+json;v=2 .
Content-type The Content-Type of the request body. The default is application/vnd.appd.events+json;v=2 which also versions the resource representation (v=2).

Example SaaS Query

Request
CODE
POST http://analytics.api.example.com/events/query?start=1422823420000&end=1423687476000&limit=20000 HTTP/1.1
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
Content-Type: application/vnd.appd.events+text;v=2
Accept: application/vnd.appd.events+json;v=2
SELECT * FROM county WHERE size>=30 AND population>20000
Response
JSON
HTTP/1.1 200 OK
{
"total": 10000,
"fields": [
{ "label": "eventTimestamp",  "field": "eventTimestamp",  "type": "date",    "aggregation": null },
{ "label": "size",             "field": "size",             "type": "integer", "aggregation": null },
{ "label": "population",          "field": "population",          "type": "integer", "aggregation": null },
{ "label": "pickupTimestamp", "field": "pickupTimestamp", "type": "date",    "aggregation": null }
],
"results": [
[ "2015-01-03T23:55:39.801-08:00", 35, 47500, "2015-02-11T19:52:28.805Z" ],
...
]
}
First Request
JSON
curl -s -X POST "<events_service_endpoint>:<events_service_port>/events/query?start=1422823420000&end=1423687476000" \
-H"X-Events-API-Key:<api_key>" \
-H"X-Events-API-AccountName:<global_account_name> OR <eum_account_name>" \
-H"Content-Type:application/vnd.appd.events+text;v=2" \
-H"Accept:application/vnd.appd.events+json;v=2" \
-d"[{
\"query\": \"SELECT eventTimestamp, pagename FROM browser_records ORDER BY eventTimestamp DESC\",
\"mode\": \"scroll\"
}]"
First Response
JSON
[{"label":"0","fields":[{"label":"agentid".........,[],[],[],[],[]]],"moreData":true,"scrollid":"MCwxMDAwMDAsMTAwMCxEbkYxWlhKNVZHaGxia1psZEdOb0JBQUFBQUFERW1pbUZqZ3RVakpNUkRKVFVVSkxVbkU1ZEROVlpqRkNhVUVBQUFBQUExQkF6QlpJY1hCM1dqVTNWbEp6UTBOaUxUZHlRbkJJZVZoM0FBQUFBQU11Q1dJV1N6VlpUbFZvV1Y5Uk15MUhSbXRSVTFScWRVWkNkd0FBQUFBQzF4TTZGbGRXYW1FMU5HNUVVazk1WVdaUWVXWlRlSEZLZFZFPQ==","schema":"browserrecord"}]
Subsequent Requests
警告: The follow-up requests also rely on the scrollid value returned in the first response and subsequent responses.
JSON
curl -s -X POST "<events_service_endpoint>:<events_service_port>/events/query?start=1422823420000&end=1423687476000" \
-H"X-Events-API-Key:<api_key>" \
-H"X-Events-API-AccountName:<global_account_name> OR <eum_account_name>" \
-H"Content-Type:application/vnd.appd.events+text;v=2" \
-H"Accept:application/vnd.appd.events+json;v=2" \
-d"[{
\"query\": \"SELECT eventTimestamp, pagename FROM browser_records ORDER BY eventTimestamp DESC\",
\"mode\": \"scroll\",
\"scrollid\":\"MCwxMDAwMDAsMTAwMCxEbkYxWlhKNVZHaGxia1psZEdOb0JBQUFBQUFERW1pbUZqZ3RVakpNUkRKVFVVSkxVbkU1ZEROVlpqRkNhVUVBQUFBQUExQkF6QlpJY1hCM1dqVTNWbEp6UTBOaUxUZHlRbkJJZVZoM0FBQUFBQU11Q1dJV1N6VlpUbFZvV1Y5Uk15MUhSbXRSVTFScWRVWkNkd0FBQUFBQzF4TTZGbGRXYW1FMU5HNUVVazk1WVdaUWVXWlRlSEZLZFZFPQ==\"
}]"

Query Events (Multiple Queries)

Use this API to execute multiple queries against a particular account and event type in parallel. A query event that specifies multiple queries does so by including multiple ADQL queries in the body of the request. Your ADQL queries must adhere to the syntax described in the ADQL Reference.

Using queries in this form takes advantage of certain backend optimizations in query performance. Query filter criteria, such as time range and limit, can be overridden by each inner query.

注: The Multi-Query Events API is limited to twenty queries per HTTP request.

Format

SaaS
CODE
POST http://analytics.api.example.com/events/query?limit=20
On-premises
CODE
POST http://<events_service_endpoint>:9080/events/query
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>

Path Params

None

Query Params

Name Description
start

Filter results based on the minimum event timestamp, specified in ISO 8601 time or Unix time. If not specified, then the default is no minimum timestamp filtering.

Specify the time in combined UTC date and time format or epoch milliseconds.

Start time is inclusive of limiting timestamps.

end

Filter results based on the maximum event timestamp, specified in ISO 8601 time or Unix time. If not specified, then the default is no maximum timestamp filtering.

Specify the time in combined UTC date and time format or epoch milliseconds.

End time is inclusive of limiting timestamps.

limit

Limits the number of results returned. The default value is 100. The upper limit on the results that can be fetched is 10,000.

Headers

None Description
X-Events-API-AccountName The global account name or the EUM account name, as shown in the Controller UI License page.
X-Events-API-Key The Analytics API key. See Manage API Keys.
Accept The Content-Type of the response body. The supported value is application/vnd.appd.events+json;v=2 .
Content-type The Content-Type of the request body. The default is application/vnd.appd.events+json;v=2 which also versions the resource representation (v=2).

Payload

Field Description
label (Optional) Friendly name to identify the query.
query ADQL query to execute.
start (Optional) Overrides the start parameter value provided as a query parameter.
end (Optional) Overrides the end parameter value provided as a query parameter.
limit (Optional) Overrides the limit provided as a query parameter.

Example SaaS Multiple Query

Request
JSON
POST http://analytics.api.example.com/events/query?limit=100 HTTP/1.1
X-Events-API-AccountName:<global_account_name> OR <eum_account_name>
X-Events-API-Key:<api_key>
Content-Type: application/vnd.appd.events+json;v=2
Accept: application/vnd.appd.events+json;v=2
[
{
"label": "high_population",
"query": "SELECT * FROM county WHERE population>50000",
"limit": 10,
"start": "2017-02-23T0:0:0Z",
"end": "2017-03-1T0:0:0Z"
},
{
"label": "small_area",
"query": "SELECT * FROM county WHERE size<25",
"start": "2017-02-23T0:0:0Z",
"end": "2017-03-1T0:0:0Z"
},
{
"label": "high_population_density",
"query": "SELECT * FROM county WHERE population>50000 AND size<25",
"limit": 100,
"start": "2017-02-23T0:0:0Z",
"end": "2017-03-1T0:0:0Z"
}
]
Response
JSON
HTTP/1.1 200 OK
[
{
"label": "high_population",
"total": 30,
"fields": [ ... ],
"results": [ ... ]
},
{
"label": "small_area",
"total": 50,
"fields": [ ... ],
"results": [ ... ]
},
{
"label": "high_population_density",
"total": 10,
"fields": [ ... ],
"results": [ ... ]
}
]