-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathQueryProductAnalyticsSankey.java
More file actions
55 lines (51 loc) · 2.69 KB
/
QueryProductAnalyticsSankey.java
File metadata and controls
55 lines (51 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Compute Sankey flow analysis returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ProductAnalyticsApi;
import com.datadog.api.client.v2.model.ProductAnalyticsJoinKeys;
import com.datadog.api.client.v2.model.ProductAnalyticsSankeyDefinition;
import com.datadog.api.client.v2.model.ProductAnalyticsSankeyRequest;
import com.datadog.api.client.v2.model.ProductAnalyticsSankeyRequestAttributes;
import com.datadog.api.client.v2.model.ProductAnalyticsSankeyRequestData;
import com.datadog.api.client.v2.model.ProductAnalyticsSankeyRequestType;
import com.datadog.api.client.v2.model.ProductAnalyticsSankeyResponse;
import com.datadog.api.client.v2.model.ProductAnalyticsSankeySearch;
import com.datadog.api.client.v2.model.ProductAnalyticsSankeyTime;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
ProductAnalyticsApi apiInstance = new ProductAnalyticsApi(defaultClient);
ProductAnalyticsSankeyRequest body =
new ProductAnalyticsSankeyRequest()
.data(
new ProductAnalyticsSankeyRequestData()
.attributes(
new ProductAnalyticsSankeyRequestAttributes()
.dataSource("product_analytics")
.definition(
new ProductAnalyticsSankeyDefinition()
.entriesPerStep(5L)
.numberOfSteps(5L)
.source("/logs")
.target(""))
.search(
new ProductAnalyticsSankeySearch()
.joinKeys(new ProductAnalyticsJoinKeys().primary("@session.id"))
.query("@type:view"))
.time(
new ProductAnalyticsSankeyTime()
.from(1771232048460L)
.to(1771836848262L)))
.type(ProductAnalyticsSankeyRequestType.SANKEY_REQUEST));
try {
ProductAnalyticsSankeyResponse result = apiInstance.queryProductAnalyticsSankey(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ProductAnalyticsApi#queryProductAnalyticsSankey");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}