Skip to content

Commit

Permalink
Support multiple sample events
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Aug 30, 2023
1 parent 037631b commit 333f997
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/input/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spec:
$ref: "../integration/data_stream/fields/spec.yml"
- description: Sample event file
type: file
name: "sample_event.json"
pattern: "^sample_event(_[a-z0-9]+)?.json$"
contentMediaType: "application/json"
required: false
- description: Folder containing development resources
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/data_stream/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ spec:
required: false
- description: Sample event file
type: file
name: "sample_event.json"
pattern: "^sample_event(_[a-z0-9]+)?.json$"
contentMediaType: "application/json"
required: false
- description: Folder containing testing related files and sub-folders
Expand Down
63 changes: 63 additions & 0 deletions test/packages/good_input/sample_event_other.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"@timestamp": "2022-11-16T19:00:58.919Z",
"agent": {
"ephemeral_id": "1f2789fe-4041-4b4d-aac2-076a34c5d24f",
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"name": "docker-fleet-agent",
"type": "metricbeat",
"version": "8.5.0"
},
"data_stream": {
"dataset": "good_input.sql_query",
"namespace": "ep",
"type": "metrics"
},
"ecs": {
"version": "8.0.0"
},
"elastic_agent": {
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"snapshot": true,
"version": "8.5.0"
},
"event": {
"dataset": "good_input.sql_query",
"duration": 1326395,
"module": "sql"
},
"host": {
"architecture": "x86_64",
"containerized": false,
"hostname": "docker-fleet-agent",
"id": "0addaca3101a43f4a52be882837fb33d",
"ip": [
"192.168.192.7"
],
"mac": [
"02-42-C0-A8-C0-07"
],
"name": "docker-fleet-agent",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "5.15.0-50-generic",
"name": "Ubuntu",
"platform": "ubuntu",
"type": "linux",
"version": "20.04.5 LTS (Focal Fossa)"
}
},
"metricset": {
"name": "query",
"period": 10000
},
"service": {
"address": "elastic-package-service-good_input-1:3306",
"type": "sql"
},
"sql": {
"driver": "mysql",
"metrics": {},
"query": "SHOW GLOBAL STATUS LIKE 'Innodb_system%'"
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
wait_for_data_timeout: 10m
vars: ~
vars: ~

samples:
- name: "one"
condition:
key: "sql.driver"
value: "mysql"
- name: "two"
condition:
key: "sql.driver"
63 changes: 63 additions & 0 deletions test/packages/good_v2/data_stream/foo/sample_event_one.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"@timestamp": "2022-11-16T19:00:58.919Z",
"agent": {
"ephemeral_id": "1f2789fe-4041-4b4d-aac2-076a34c5d24f",
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"name": "docker-fleet-agent",
"type": "metricbeat",
"version": "8.5.0"
},
"data_stream": {
"dataset": "sql_input.sql_query",
"namespace": "ep",
"type": "metrics"
},
"ecs": {
"version": "8.0.0"
},
"elastic_agent": {
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"snapshot": true,
"version": "8.5.0"
},
"event": {
"dataset": "sql_input.sql_query",
"duration": 1326395,
"module": "sql"
},
"host": {
"architecture": "x86_64",
"containerized": false,
"hostname": "docker-fleet-agent",
"id": "0addaca3101a43f4a52be882837fb33d",
"ip": [
"192.168.192.7"
],
"mac": [
"02-42-C0-A8-C0-07"
],
"name": "docker-fleet-agent",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "5.15.0-50-generic",
"name": "Ubuntu",
"platform": "ubuntu",
"type": "linux",
"version": "20.04.5 LTS (Focal Fossa)"
}
},
"metricset": {
"name": "query",
"period": 10000
},
"service": {
"address": "elastic-package-service-sql_input-1:3306",
"type": "sql"
},
"sql": {
"driver": "mysql",
"metrics": {},
"query": "SHOW GLOBAL STATUS LIKE 'Innodb_system%'"
}
}
63 changes: 63 additions & 0 deletions test/packages/good_v2/data_stream/foo/sample_event_two.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"@timestamp": "2022-11-16T19:00:58.919Z",
"agent": {
"ephemeral_id": "1f2789fe-4041-4b4d-aac2-076a34c5d24f",
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"name": "docker-fleet-agent",
"type": "metricbeat",
"version": "8.5.0"
},
"data_stream": {
"dataset": "sql_input.sql_query",
"namespace": "ep",
"type": "metrics"
},
"ecs": {
"version": "8.0.0"
},
"elastic_agent": {
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"snapshot": true,
"version": "8.5.0"
},
"event": {
"dataset": "sql_input.sql_query",
"duration": 1326395,
"module": "sql"
},
"host": {
"architecture": "x86_64",
"containerized": false,
"hostname": "docker-fleet-agent",
"id": "0addaca3101a43f4a52be882837fb33d",
"ip": [
"192.168.192.7"
],
"mac": [
"02-42-C0-A8-C0-07"
],
"name": "docker-fleet-agent",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "5.15.0-50-generic",
"name": "Ubuntu",
"platform": "ubuntu",
"type": "linux",
"version": "20.04.5 LTS (Focal Fossa)"
}
},
"metricset": {
"name": "query",
"period": 10000
},
"service": {
"address": "elastic-package-service-sql_input-1:3306",
"type": "sql"
},
"sql": {
"driver": "mysql",
"metrics": {},
"query": "SHOW GLOBAL STATUS LIKE 'Innodb_system%'"
}
}

0 comments on commit 333f997

Please sign in to comment.