1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = { "telemetry": {
9 "resourceSpans": [{
10 "resource": { "attributes": [
11 {
12 "key": "service.name",
13 "value": { "stringValue": "checkout" },
14 },
15 {
16 "key": "deployment.environment",
17 "value": { "stringValue": "production" },
18 },
19 {
20 "key": "telemetry.sdk.language",
21 "value": { "stringValue": "java" },
22 },
23 ] },
24 "scopeSpans": [{
25 "scope": { "name": "io.opentelemetry.tomcat-10.0" },
26 "spans": [
27 {
28 "traceId": "5b8efff798038103d269b633813fc60c",
29 "spanId": "eee19b7ec3c1b174",
30 "name": "GET /orders/12345",
31 "kind": 2,
32 "startTimeUnixNano": "1760000000000000000",
33 "endTimeUnixNano": "1760000000012000000",
34 "attributes": [
35 {
36 "key": "http.method",
37 "value": { "stringValue": "get" },
38 },
39 {
40 "key": "http.status_code",
41 "value": { "stringValue": "503" },
42 },
43 {
44 "key": "http.target",
45 "value": { "stringValue": "/orders/12345?coupon=SPRING" },
46 },
47 {
48 "key": "http.scheme",
49 "value": { "stringValue": "https" },
50 },
51 {
52 "key": "http.route",
53 "value": { "stringValue": "/orders/{id}" },
54 },
55 ],
56 "status": {},
57 },
58 {
59 "traceId": "5b8efff798038103d269b633813fc60c",
60 "spanId": "aab19b7ec3c1b175",
61 "parentSpanId": "eee19b7ec3c1b174",
62 "name": "SELECT orders",
63 "kind": 3,
64 "startTimeUnixNano": "1760000000001000000",
65 "endTimeUnixNano": "1760000000009000000",
66 "attributes": [
67 {
68 "key": "db.system",
69 "value": { "stringValue": "postgresql" },
70 },
71 {
72 "key": "db.statement",
73 "value": { "stringValue": "SELECT * FROM orders WHERE id = $1" },
74 },
75 {
76 "key": "db.name",
77 "value": { "stringValue": "shop" },
78 },
79 ],
80 },
81 ],
82 }],
83 }],
84 "resourceMetrics": [{
85 "resource": { "attributes": [{
86 "key": "service.name",
87 "value": { "stringValue": "checkout" },
88 }] },
89 "scopeMetrics": [{
90 "scope": { "name": "io.opentelemetry.tomcat-10.0" },
91 "metrics": [{
92 "name": "http.server.request.duration",
93 "unit": "ms",
94 "histogram": {
95 "aggregationTemporality": 2,
96 "dataPoints": [{
97 "attributes": [
98 {
99 "key": "http.request.method",
100 "value": { "stringValue": "GET" },
101 },
102 {
103 "key": "url.scheme",
104 "value": { "stringValue": "https" },
105 },
106 {
107 "key": "url.full",
108 "value": { "stringValue": "https://shop.example.com/orders/12345" },
109 },
110 ],
111 "count": "1",
112 "sum": 12,
113 "bucketCounts": [
114 "0",
115 "1",
116 ],
117 "explicitBounds": [10],
118 }],
119 },
120 }],
121 }],
122 }],
123 } }
124
125
126run = client.actor("michiganpublictech/otel-semconv-validator").call(run_input=run_input)
127
128
129print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
130for item in client.dataset(run.default_dataset_id).iterate_items():
131 print(item)
132
133