Skip to content

mgr/telemetry: add stretch cluster data - #60606

Merged
ljflores merged 2 commits into
ceph:mainfrom
Naveenaidu:naveen/telemetry-add-stretch-cluster
Feb 19, 2025
Merged

ljflores merged 2 commits into
ceph:mainfrom
Naveenaidu:naveen/telemetry-add-stretch-cluster

Conversation

@Naveenaidu

@Naveenaidu Naveenaidu commented Nov 4, 2024 •

Copy link
Copy Markdown
Contributor

Closes: https://tracker.ceph.com/issues/67812

Stretch Mode information helps us learn how deployments are done for stretch clusters. We add a basic_stretch_cluster collection to the basic channel for this purpose.

The newly added basic_stretch_cluster collection in the basic channel looks like:

"stretch_cluster": {
        "degraded_stretch_mode": 0,
        "recovering_stretch_mode": 0,
        "stretch_bucket_count": 2,
        "stretch_mode_bucket": 9,
        "stretch_mode_enabled": true
    },

Things I learned (click on details to expand)

Details

Telemetry module is used to send anonymous data about the Ceph cluster to us which helps us understand how Ceph is being used in the wild. The code for this is present in here

As mentioned in the docs, there are two main concepts to telemetry:

  • Channels: The telemetry data is broken down into different channels and each channel holds a different kind of information. This categorization is useful to group related data for easier access
  • Collections: These are different parts of data that are collected within a channel. Any new data that is added into a channel will be added as a new collection, this helps our users understand the diff (what new data is added) between different versions of telemetry releases.

The telemetry module is written is python and this code is extended with the C++ functions of our Ceph source code present in the src/ directory. The reason for writing telemetry module in python is to ease the development of adding new data to telemetry. Refer this to understand more about Python extensions.

Code details

To add stretch_mode data into telemetry, we need to do the following:

  1. Fetch the osdmap information
  2. Extract stretch_mode data from the map
  3. Add it to the telemetry report only when the collection is enabled

The OSDMap class and it's information is present in the C code of ceph. We would need to invoke the dump function of the OSDMap class to get the required information. The telemetry module has a helper function called as self.get('osd_map') to do exactly this. The list of all the cluster wide object that you are fetch are listed in the pydoc comment.

The OSDMap cluster object we get is a dictionary. To fetch the stretch mode information, the stretch mode key is required. The name of this key can be found in the implementation of the dump method of OSDMap class. Depending on how the data is being dumped, you will need to extract the data accordingly.

For eg: Stretch mode is dumped like this:

f->open_object_section("stretch_mode");
  {
    f->dump_bool("stretch_mode_enabled", stretch_mode_enabled);
    f->dump_unsigned("stretch_bucket_count", stretch_bucket_count);
    f->dump_unsigned("degraded_stretch_mode", degraded_stretch_mode);
    f->dump_unsigned("recovering_stretch_mode", recovering_stretch_mode);
    f->dump_int("stretch_mode_bucket", stretch_mode_bucket);
  }
  f->close_section();

i.e it;s a JSON object with key stretch_mode :

{
	"stretch_cluster": 
		{
	        "degraded_stretch_mode": 0,
	        "recovering_stretch_mode": 0,
	        "stretch_bucket_count": 0,
	        "stretch_mode_bucket": 0,
	        "stretch_mode_enabled": false
		 }
}

To extract this data in telemetry python module you would do this and add it only when collection is enabled, you would do this:

# Stretch Mode
if self.is_enabled_collection(Collection.basic_stretch_cluster):
	stretch_mode = osd_map['stretch_mode']
	report['stretch_cluster'] = {
		'stretch_mode_enabled': stretch_mode['stretch_mode_enabled'],
		 ....
	}

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

Comment thread src/pybind/mgr/telemetry/module.py Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Question: When do we nag users?

IIUC, we only do that for major data changes. What would constitute as major data changes? My assumption here for not nagging the user was that stretch_cluster is a small additive change and is not a sensitive information so it's okay to not nag the user. Please correct me if my understanding is wrong,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, you are correct with this assumption. We nagged when we added the perf channel since it was a bigger addition, but adding a smaller collection is usually not something we want to nag about. It would be good to confirm this with @yaarith though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, make sure to remove the comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for the clarification! have now removed the comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Naveenaidu @ljflores that's right, we nag in case we wish the user to be aware of the change and consider to re-opt-in (usually after a major change).

@Naveenaidu Naveenaidu self-assigned this Nov 4, 2024
@Naveenaidu
Naveenaidu marked this pull request as ready for review November 4, 2024 14:59
@Naveenaidu
Naveenaidu requested a review from a team as a code owner November 4, 2024 14:59
@Naveenaidu
Naveenaidu requested a review from yaarith November 4, 2024 14:59
ljflores
ljflores previously approved these changes Nov 14, 2024

@ljflores ljflores left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM except small nit is to remove the comment. Feel free to add "needs-qa" once that is done.

@Naveenaidu
Naveenaidu force-pushed the naveen/telemetry-add-stretch-cluster branch from 8ffc565 to ae100b1 Compare November 18, 2024 13:12
@Naveenaidu
Naveenaidu force-pushed the naveen/telemetry-add-stretch-cluster branch from ae100b1 to c7b5358 Compare November 18, 2024 13:15
@Naveenaidu

Copy link
Copy Markdown
Contributor Author

jenkins test api

@yaarith yaarith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Naveenaidu looks good!
We can squash the commits here.

Comment thread src/pybind/mgr/telemetry/module.py Resolved
Comment thread src/pybind/mgr/telemetry/module.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Naveenaidu @ljflores that's right, we nag in case we wish the user to be aware of the change and consider to re-opt-in (usually after a major change).

@yaarith

yaarith commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

@kamoltat can you please take a look?

How would you suggest testing with actual values in:

"stretch_cluster": {
        "degraded_stretch_mode": 0,
        "recovering_stretch_mode": 0,
        "stretch_bucket_count": 0,
        "stretch_mode_bucket": 0,
        "stretch_mode_enabled": false
 }

?

@yaarith

yaarith commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

@ljflores should we update our upgrade tests with this new collection?
@Naveenaidu will backport it to quincy, reef, and squid.

@Naveenaidu
Naveenaidu force-pushed the naveen/telemetry-add-stretch-cluster branch from c7b5358 to 77f2e9d Compare November 20, 2024 09:39
@kamoltat

kamoltat commented Nov 20, 2024 •

Copy link
Copy Markdown
Member

@kamoltat can you please take a look?

How would you suggest testing with actual values in:

"stretch_cluster": {
        "degraded_stretch_mode": 0,
        "recovering_stretch_mode": 0,
        "stretch_bucket_count": 0,
        "stretch_mode_bucket": 0,
        "stretch_mode_enabled": false
 }

?

Hi @yaarith
So we want to verify if the information you collect in telemetry matches the cluster's values.
We can do a standalone test where we set up a vstart cluster and compare the OSDMap with the new collection from the manager. I know that the telemetry essential fetches OSDMap but this is a sanity check.

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

@yaarith, As suggested by @kamoltat I used his script to start a stretch cluster can verify that the correct data is indeed being printed in telemetry.

The telemetry data that we get from the script:

"stretch_cluster": {
        "degraded_stretch_mode": 0,
        "recovering_stretch_mode": 0,
        "stretch_bucket_count": 2,
        "stretch_mode_bucket": 9,
        "stretch_mode_enabled": true
    },

In the script we add two buckets - which matches the value of stretch_bucket_count and the type of the bucket is a zone (which is number 9 according to this) which matches the stretch_mode_bucket values.

The script that was used to start a stretch cluster is:

#!/bin/bash
if [[ "$@" != *"--skip-vstart"* ]]; then
  MON=5 MDS=0 MGR=1 OSD=4 ../src/vstart.sh -n -x -l -d --without-dashboard
fi

if [[ "$@" != *"--skip-osd-check"* ]]; then

  sleep 20
  NUM_OSDS_UP=$(./bin/ceph osd df | grep "up" | wc -l)
  if [ $NUM_OSDS_UP -lt 4 ]; then
      echo "test requires at least 4 OSDs up and running"
      exit 1
  fi
fi


./bin/ceph mon set election_strategy connectivity
./bin/ceph mon add disallowed_leader e

for zone in iris pze
    do
      ./bin/ceph osd crush add-bucket $zone zone
      ./bin/ceph osd crush move $zone root=default
    done

./bin/ceph osd crush add-bucket node-2 host
./bin/ceph osd crush add-bucket node-3 host
./bin/ceph osd crush add-bucket node-4 host
./bin/ceph osd crush add-bucket node-5 host

./bin/ceph osd crush move node-2 zone=iris
./bin/ceph osd crush move node-3 zone=iris
./bin/ceph osd crush move node-4 zone=pze
./bin/ceph osd crush move node-5 zone=pze

./bin/ceph osd crush move osd.0 host=node-2
./bin/ceph osd crush move osd.1 host=node-3
./bin/ceph osd crush move osd.2 host=node-4
./bin/ceph osd crush move osd.3 host=node-5

./bin/ceph mon set_location a zone=iris host=node-2
./bin/ceph mon set_location b zone=iris host=node-3
./bin/ceph mon set_location c zone=pze host=node-4
./bin/ceph mon set_location d zone=pze host=node-5

hostname=$(hostname -s)
./bin/ceph osd crush remove $hostname
./bin/ceph osd getcrushmap > crushmap
./bin/crushtool --decompile crushmap > crushmap.txt
sed 's/^# end crush map$//' crushmap.txt > crushmap_modified.txt
cat >> crushmap_modified.txt << EOF
rule stretch_rule {
       id 2
       type replicated
       step take default
       step choose firstn 2 type zone
       step chooseleaf firstn 2 type host
       step emit
}
# end crush map
EOF

./bin/crushtool --compile crushmap_modified.txt -o crushmap.bin
./bin/ceph osd setcrushmap -i crushmap.bin
stretched_poolname=stretched_rbdpool
./bin/ceph osd pool create $stretched_poolname 32 32 stretch_rule
./bin/ceph osd pool set $stretched_poolname size 4

./bin/ceph mon set_location e zone=arbiter host=node-1
./bin/ceph mon enable_stretch_mode e stretch_rule zone

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

jenkins test api

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

jenkins make check

@Naveenaidu
Naveenaidu force-pushed the naveen/telemetry-add-stretch-cluster branch from 77f2e9d to cff8a5f Compare November 25, 2024 09:16
@Naveenaidu
Naveenaidu requested a review from yaarith November 25, 2024 12:54
@ljflores

ljflores commented Dec 3, 2024 •

Copy link
Copy Markdown
Member

@ljflores should we update our upgrade tests with this new collection? @Naveenaidu will backport it to quincy, reef, and squid.

Yes, @Naveenaidu let's update the upgrade tests. To give some context, we added some integration test coverage for telemetry in the form of workunits. Workunits are basically bash scripts that run commands against a Ceph cluster.

These are the relevant workunit files for telemetry:
https://github.com/ceph/ceph/blob/main/qa/workunits/test_telemetry_quincy.sh
https://github.com/ceph/ceph/blob/main/qa/workunits/test_telemetry_reef_x.sh
https://github.com/ceph/ceph/blob/main/qa/workunits/test_telemetry_quincy_x.sh
https://github.com/ceph/ceph/blob/main/qa/workunits/test_telemetry_reef.sh

These workunits are used in the upgrade suite, specifically in:

  1. upgrade/quincy-x/parallel
  2. upgrade/reef-x/parallel
  3. upgrade/telemetry-upgrade.

The upgrade/quincy-x/parallel sub-suite [1] installs a quincy cluster, then upgrades the cluster to whichever branch you are scheduling the tests against (if you are running this against a squid branch, X would stand for squid). In parallel, some workloads are against the cluster, including the above telemetry workunits with "quincy" in the file name. test_telemetry_quincy.sh is run on a quincy cluster before the upgrade, and test_telemetry_quincy_x.sh is run on the X-version cluster after the upgrade.

Similarly, the upgrade/reef-x/parallel sub-suite [2] installs a reef cluster, then upgrades the cluster to whichever branch you are scheduling the tests against (if you are running this against a squid branch, X would stand for squid). In parallel, some workloads are run against the cluster, including the above telemetry workunits with "reef" in the file name. test_telemetry_reef.sh is run on a reef cluster before the upgrade, and test_telemetry_reef_x.sh is run on the X-version cluster after the upgrade.

The upgrade/telemetry-upgrade sub-suite is identical to the upgrade/quincy-x/parallel and upgrade/reef-x/parallel suites as above, but these tests ONLY test the telemetry workunits and do not run with any other workloads. So upgrade/telemetry-upgrade is nice to schedule when you just want to verify that the telemetry workunits are working as expected (they complete much faster). The upgrade/[quincy|reef]-x/parallel suites are nice to schedule if you want to verify that the workunits are working fine with all the other workunits also running. Usually there is not any overlap between the telemetry workunits and the other workunits (like rbd workloads, etc) but it's nice to verify.

All of this is to say, we should update the workunits above to reflect the new collection that was added. For the main PR, you'd only need to edit the test_telemetry_quincy_x.sh and test_telemetry_reef_x.sh files since the collections have only been added to main for now. If the new collection is backported to squid, the same edits would take place. However, if the new collection is backported to quincy and reef, you'd also need to edit the test_telemetry_reef.sh and test_telemetry_quincy.sh files to reflect that the collection has been added there too.

Let me know if you have any questions or if I can clarify anything!

@ljflores ljflores added core and removed needs-qa labels Dec 3, 2024
@ljflores

ljflores commented Dec 3, 2024

Copy link
Copy Markdown
Member

I took off the "needs-qa" label for now until these changes are added. Then, we can send it to QA.

@ljflores

ljflores commented Dec 6, 2024

Copy link
Copy Markdown
Member

jenkins test api

@ljflores
ljflores dismissed their stale review December 6, 2024 17:00

Changes have been added since initially reviewing

@Naveenaidu
Naveenaidu requested a review from ljflores December 9, 2024 10:34
@ljflores

Copy link
Copy Markdown
Member

#60984 is ready to be reviewed now, which should be merged before this PR.

@ljflores

Copy link
Copy Markdown
Member

#60984 has been merged. This PR should be rebased.

@Naveenaidu
Naveenaidu force-pushed the naveen/telemetry-add-stretch-cluster branch from 7677687 to adcac85 Compare January 22, 2025 05:39

@ljflores ljflores left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @Naveenaidu, looking good! A couple of nits:

  1. The title of the second commit is on two lines when it should be on one:
qa/workunit: update telemetry quincy/reef workunits with
"basic_stretch_cluster" collection

Rather than

qa/workunit: update telemetry quincy/reef workunits with "basic_stretch_cluster" collection
  1. The first commit should have the tracker that we're fixing right above your Signed-off-by line:
Signed-off-by: <...>
Fixes: https://tracker.ceph.com/issues/67812

Also see below for a few clarifications about the workunit updates.

Comment thread qa/workunits/test_telemetry_reef.sh Resolved
Comment thread qa/workunits/test_telemetry_reef_x.sh Resolved
Comment thread qa/workunits/test_telemetry_squid.sh Resolved
Comment thread qa/workunits/test_telemetry_squid_x.sh Resolved
@Naveenaidu
Naveenaidu force-pushed the naveen/telemetry-add-stretch-cluster branch from adcac85 to ad48db3 Compare January 27, 2025 13:15
@Naveenaidu
Naveenaidu requested a review from ljflores January 27, 2025 13:17
Stretch Mode information helps us learn how deployments are done
for stretch clusters.

We add a basic_stretch_cluster collection fo the "basic" channel
for this purpose.

Fixes: https://tracker.ceph.com/issues/67812
Signed-off-by: Naveen Naidu <[email protected]>
@Naveenaidu
Naveenaidu force-pushed the naveen/telemetry-add-stretch-cluster branch from ad48db3 to 4dac20e Compare January 27, 2025 13:19
@ljflores

Copy link
Copy Markdown
Member

The make check and api test failures are unrelated:

E: The package ceph-libboost1.85-dev needs to be reinstalled, but I can't find an archive for it.

@ljflores ljflores left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! Good work!

@ljflores

ljflores commented Feb 6, 2025

Copy link
Copy Markdown
Member

jenkins test api

@ljflores

ljflores commented Feb 6, 2025

Copy link
Copy Markdown
Member

jenkins test make check

@ljflores

ljflores commented Feb 6, 2025

Copy link
Copy Markdown
Member

@yuriw

yuriw commented Feb 6, 2025

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants