Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple sample events #582

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this samples map requires a specific structure, should this be defined/added into the spec of this file ? https://github.com/elastic/package-spec/blob/037631bddaffe6519b61eb41c186fb929675d6e1/spec/integration/data_stream/_dev/test/system/config.spec.yml

- name: "one"
condition:
key: "sql.driver"
value: "mysql"
- name: "two"
condition:
key: "sql.driver"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, with this second sample configuration, would elastic-package (client) look for the first document where that key, in this example sql.driver, exists in the doc?

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%'"
}
}