Skip to content

[MySQL] Add replica status data stream #10344

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

Merged
merged 9 commits into from
Jul 26, 2024

Conversation

niraj-elastic
Copy link
Contributor

@niraj-elastic niraj-elastic commented Jul 3, 2024

  • Enhancement

What does this PR do?

  • Added 1 data stream (Replica Status Metrics).
  • Added data collection logic for the data streams.
  • Added the ingest pipeline for the data streams.
  • Mapped fields according to the ECS schema and added Fields metadata in the appropriate yaml files.
  • Added dashboards and visualizations.
  • Added system test cases for the data stream.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

How to test this PR locally

  • Clone integrations repo.
  • Install elastic-package locally.
  • Start elastic stack using elastic-package.
  • Move to integrations/packages/mysql) directory.
  • Run the following command to run tests. elastic-package test

Screenshots

mysql-replica_status-dashboard

issue

@niraj-elastic niraj-elastic requested a review from a team as a code owner July 3, 2024 06:18
@niraj-elastic niraj-elastic changed the title add replica status data stream [MySQL] Add replica status data stream Jul 3, 2024
@ali786XI
Copy link
Contributor

ali786XI commented Jul 4, 2024

/test

@elasticmachine
Copy link

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

multi: false
required: true
show_user: true
default: "SHOW REPLICA STATUS;"
Copy link
Contributor

Choose a reason for hiding this comment

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

As the SHOW SLAVE STATUS is deprecated as mentioned in the mysql document. By default we can use the SHOW REPLICA STATUS; query and the user can change it to SLAVE if the mysql version is prior to 8.0.22. We have to update it in the description. That way we support the replica_status metrics for users who is using the older version of mysql.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, we have added it in readme, we will also add description here.

@muthu-mps
Copy link
Contributor

  • Since the ecs@mapping migration is in progress for this integration, what is the plan to merge this PR? Are we planning to merge after ecs template changes?

@ishleenk17
Copy link
Member

For any new Integration/datastream, we should now follow the ecs@mappings only.
Please take care of that in this new datastream as well.
If this is an urgent PR, you can make the changes to other datastreams of this integration to adopt ecs@mappings.
If not urgent, please wait for the bulk migration effort to be over

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it feasible to display source.port without a comma(shown in SS 3,306)?
Since ports typically don't include separators, having one might appear strange to users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but we are not able to show it with out coma in kibana since it is number.

…ql_replica_status

Conflicts:
	packages/mysql/_dev/build/docs/README.md
	packages/mysql/changelog.yml
	packages/mysql/data_stream/error/_dev/test/pipeline/test-error.log-expected.json
	packages/mysql/data_stream/error/_dev/test/pipeline/test-mariadb-10-4-8.log-expected.json
	packages/mysql/data_stream/error/_dev/test/pipeline/test-mysql-darwin-brew-5-7-10.log-expected.json
	packages/mysql/data_stream/error/_dev/test/pipeline/test-mysql-ubuntu-5-5-53.log-expected.json
	packages/mysql/data_stream/error/_dev/test/pipeline/test-mysql-ubuntu-8-0-15.log-expected.json
	packages/mysql/docs/README.md
Copy link
Contributor

@kush-elastic kush-elastic left a comment

Choose a reason for hiding this comment

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

LGTM!

@muthu-mps
Copy link
Contributor

Documentation Update

  • The compatibility matrix has many versions. Can we make this as a table view?
  • The second section talks about the query that can be used for fetching replica status. Here we can avoid repeating the redundant data. As the newer versions by default use the SHOW REPLICA STATUS query. We can add the older versions of the service should use SHOW SLAVE STATUS query.
replica-status

description: "Current global transaction ID value."
- name: is_auto_position
type: boolean
description: "true if GTID auto-positioning is in use for the channel, otherwise false."
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
description: "true if GTID auto-positioning is in use for the channel, otherwise false."
description: "True if GTID auto-positioning is in use for the channel, otherwise false."

- name: tls_version
type: keyword
description: "The TLS version used on the source."
- name: slave
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these fields only for SLAVE query of the older versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed it to replica.

- name: delay_remaining.sec
type: long
metric_type: gauge
description: "When Replica_SQL_Running_State is Waiting until MASTER_DELAY seconds after source executed event, this field contains the number of delay seconds remaining. At other times, this field is NULL."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: "When Replica_SQL_Running_State is Waiting until MASTER_DELAY seconds after source executed event, this field contains the number of delay seconds remaining. At other times, this field is NULL."
description: "When Replica_SQL_Running_State is waiting until MASTER_DELAY seconds after source executed event, this field contains the number of delay seconds remaining. At other times, this field is NULL."

@andrewkroh andrewkroh added Integration:mysql MySQL Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations] labels Jul 19, 2024
@niraj-elastic
Copy link
Contributor Author

/test

@niraj-elastic niraj-elastic requested a review from muthu-mps July 22, 2024 12:06
@muthu-mps
Copy link
Contributor

Documentation Update

  • The compatibility matrix has many versions. Can we make this as a table view?
  • The second section talks about the query that can be used for fetching replica status. Here we can avoid repeating the redundant data. As the newer versions by default use the SHOW REPLICA STATUS query. We can add the older versions of the service should use SHOW SLAVE STATUS query.
replica-status

Can you please share the screenshot of the updated document that includes the table format?

@niraj-elastic
Copy link
Contributor Author

Documentation Update

  • The compatibility matrix has many versions. Can we make this as a table view?
  • The second section talks about the query that can be used for fetching replica status. Here we can avoid repeating the redundant data. As the newer versions by default use the SHOW REPLICA STATUS query. We can add the older versions of the service should use SHOW SLAVE STATUS query.
replica-status

Can you please share the screenshot of the updated document that includes the table format?

Sure
image

description: "This status variable counts the occurrence of transactional event groups. This is a replica-side counter for optimistic parallel replication."
- name: replicate_do_domain_ids
type: keyword
description: "The do_domain_id option value for change master.(The DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to only apply binary log events if the transaction's GTID is in a specific gtid_domain_id value.)"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
description: "The do_domain_id option value for change master.(The DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to only apply binary log events if the transaction's GTID is in a specific gtid_domain_id value.)"
description: "The do_domain_id option value for change master.(The DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to only apply binary log events if the transaction's GTID is in a specific gtid_domain_id value)."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

description: "The do_domain_id option value for change master.(The DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to only apply binary log events if the transaction's GTID is in a specific gtid_domain_id value.)"
- name: replicate_ignore_domain_ids
type: keyword
description: "The ignore_domain_id option value for change master.(The IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to ignore binary log events if the transaction's GTID is in a specific gtid_domain_id value)"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
description: "The ignore_domain_id option value for change master.(The IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to ignore binary log events if the transaction's GTID is in a specific gtid_domain_id value)"
description: "The ignore_domain_id option value for change master.(The IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica to ignore binary log events if the transaction's GTID is in a specific gtid_domain_id value)."

@niraj-elastic niraj-elastic requested a review from muthu-mps July 24, 2024 09:45
Copy link
Contributor

@muthu-mps muthu-mps left a comment

Choose a reason for hiding this comment

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

Change looks good to me. As @niraj-elastic confirmed the TSDB testing is done as part of E2E testing.

@niraj-elastic
Copy link
Contributor Author

Change looks good to me. As @niraj-elastic confirmed the TSDB testing is done as part of E2E testing.

Yes. @aliabbas-elastic Has done complete E2E testing which includes TSDB as well.

@niraj-elastic
Copy link
Contributor Author

/test

@elasticmachine
Copy link

💚 Build Succeeded

History

Copy link

@niraj-elastic niraj-elastic merged commit 1ddff35 into elastic:main Jul 26, 2024
5 checks passed
harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 4, 2025
* add replica status data stream

* update data stream

* update changelog

* Address review comment

* address review comments

* address review comment

* address review comments
harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 5, 2025
* add replica status data stream

* update data stream

* update changelog

* Address review comment

* address review comments

* address review comment

* address review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration:mysql MySQL Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants