|
| 1 | +// Copyright 2025 The Ray Authors. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#pragma once |
| 16 | + |
| 17 | +#include "ray/stats/metric.h" |
| 18 | + |
| 19 | +namespace ray { |
| 20 | + |
| 21 | +inline ray::stats::Histogram GetObjectStoreDistHistogramMetric() { |
| 22 | + return ray::stats::Histogram{ |
| 23 | + /*name=*/"object_store_dist", |
| 24 | + /*description=*/"The distribution of object size in bytes", |
| 25 | + /*unit=*/"MiB", |
| 26 | + /*boundaries=*/{32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384}, |
| 27 | + /*tag_keys=*/{"Source"}, |
| 28 | + }; |
| 29 | +} |
| 30 | + |
| 31 | +inline ray::stats::Gauge GetObjectStoreAvailableMemoryGaugeMetric() { |
| 32 | + return ray::stats::Gauge( |
| 33 | + /*name=*/"object_store_available_memory", |
| 34 | + /*description=*/"Amount of memory currently available in the object store.", |
| 35 | + /*unit=*/"bytes"); |
| 36 | +} |
| 37 | + |
| 38 | +inline ray::stats::Gauge GetObjectStoreUsedMemoryGaugeMetric() { |
| 39 | + return ray::stats::Gauge( |
| 40 | + /*name=*/"object_store_used_memory", |
| 41 | + /*description=*/"Amount of memory currently occupied in the object store.", |
| 42 | + /*unit=*/"bytes"); |
| 43 | +} |
| 44 | + |
| 45 | +inline ray::stats::Gauge GetObjectStoreFallbackMemoryGaugeMetric() { |
| 46 | + return ray::stats::Gauge( |
| 47 | + /*name=*/"object_store_fallback_memory", |
| 48 | + /*description=*/"Amount of memory in fallback allocations in the filesystem.", |
| 49 | + /*unit=*/"bytes"); |
| 50 | +} |
| 51 | + |
| 52 | +inline ray::stats::Gauge GetObjectStoreLocalObjectsGaugeMetric() { |
| 53 | + return ray::stats::Gauge( |
| 54 | + /*name=*/"object_store_num_local_objects", |
| 55 | + /*description=*/"Number of objects currently in the object store.", |
| 56 | + /*unit=*/"objects"); |
| 57 | +} |
| 58 | + |
| 59 | +inline ray::stats::Gauge GetObjectManagerPullRequestsGaugeMetric() { |
| 60 | + return ray::stats::Gauge( |
| 61 | + /*name=*/"object_manager_num_pull_requests", |
| 62 | + /*description=*/"Number of active pull requests for objects.", |
| 63 | + /*unit=*/"requests"); |
| 64 | +} |
| 65 | + |
| 66 | +inline ray::stats::Gauge GetObjectManagerBytesGaugeMetric() { |
| 67 | + return ray::stats::Gauge( |
| 68 | + /*name=*/"object_manager_bytes", |
| 69 | + /*description=*/ |
| 70 | + "Number of bytes pushed or received by type {PushedFromLocalPlasma, " |
| 71 | + "PushedFromLocalDisk, Received}.", |
| 72 | + /*unit=*/"bytes", |
| 73 | + /*tag_keys=*/{"Type"}); |
| 74 | +} |
| 75 | + |
| 76 | +inline ray::stats::Gauge GetObjectManagerReceivedChunksGaugeMetric() { |
| 77 | + return ray::stats::Gauge( |
| 78 | + /*name=*/"object_manager_received_chunks", |
| 79 | + /*description=*/ |
| 80 | + "Number object chunks received broken per type {Total, FailedTotal, " |
| 81 | + "FailedCancelled, FailedPlasmaFull}.", |
| 82 | + /*unit=*/"chunks", |
| 83 | + /*tag_keys=*/{"Type"}); |
| 84 | +} |
| 85 | + |
| 86 | +inline ray::stats::Gauge GetPullManagerUsageBytesGaugeMetric() { |
| 87 | + return ray::stats::Gauge( |
| 88 | + /*name=*/"pull_manager_usage_bytes", |
| 89 | + /*description=*/ |
| 90 | + "The total number of bytes usage broken per type {Available, BeingPulled, Pinned}", |
| 91 | + /*unit=*/"bytes", |
| 92 | + /*tag_keys=*/{"Type"}); |
| 93 | +} |
| 94 | + |
| 95 | +inline ray::stats::Gauge GetPullManagerRequestedBundlesGaugeMetric() { |
| 96 | + return ray::stats::Gauge( |
| 97 | + /*name=*/"pull_manager_requested_bundles", |
| 98 | + /*description=*/ |
| 99 | + "Number of requested bundles broken per type {Get, Wait, TaskArgs}.", |
| 100 | + /*unit=*/"bundles", |
| 101 | + /*tag_keys=*/{"Type"}); |
| 102 | +} |
| 103 | + |
| 104 | +inline ray::stats::Gauge GetPullManagerRequestsGaugeMetric() { |
| 105 | + return ray::stats::Gauge( |
| 106 | + /*name=*/"pull_manager_requests", |
| 107 | + /*description=*/"Number of pull requests broken per type {Queued, Active, Pinned}.", |
| 108 | + /*unit=*/"requests", |
| 109 | + /*tag_keys=*/{"Type"}); |
| 110 | +} |
| 111 | + |
| 112 | +inline ray::stats::Gauge GetPullManagerActiveBundlesGaugeMetric() { |
| 113 | + return ray::stats::Gauge( |
| 114 | + /*name=*/"pull_manager_active_bundles", |
| 115 | + /*description=*/"Number of active bundle requests", |
| 116 | + /*unit=*/"bundles", |
| 117 | + /*tag_keys=*/{"Type"}); |
| 118 | +} |
| 119 | + |
| 120 | +inline ray::stats::Gauge GetPullManagerRetriesTotalGaugeMetric() { |
| 121 | + return ray::stats::Gauge( |
| 122 | + /*name=*/"pull_manager_retries_total", |
| 123 | + /*description=*/"Number of cumulative pull retries.", |
| 124 | + /*unit=*/"retries", |
| 125 | + /*tag_keys=*/{"Type"}); |
| 126 | +} |
| 127 | + |
| 128 | +inline ray::stats::Gauge GetPullManagerNumObjectPinsGaugeMetric() { |
| 129 | + return ray::stats::Gauge( |
| 130 | + /*name=*/"pull_manager_num_object_pins", |
| 131 | + /*description=*/ |
| 132 | + "Number of object pin attempts by the pull manager, can be {Success, Failure}.", |
| 133 | + /*unit=*/"pins", |
| 134 | + /*tag_keys=*/{"Type"}); |
| 135 | +} |
| 136 | + |
| 137 | +inline ray::stats::Histogram GetPullManagerObjectRequestTimeMsHistogramMetric() { |
| 138 | + return ray::stats::Histogram( |
| 139 | + /*name=*/"pull_manager_object_request_time_ms", |
| 140 | + /*description=*/ |
| 141 | + "Time between initial object pull request and local pinning of the object. ", |
| 142 | + /*unit=*/"ms", |
| 143 | + /*boundaries=*/{1, 10, 100, 1000, 10000}, |
| 144 | + /*tag_keys=*/{"Type"}); |
| 145 | +} |
| 146 | + |
| 147 | +inline ray::stats::Gauge GetPushManagerNumPushesRemainingGaugeMetric() { |
| 148 | + return ray::stats::Gauge( |
| 149 | + /*name=*/"push_manager_num_pushes_remaining", |
| 150 | + /*description=*/"Number of pushes not completed.", |
| 151 | + /*unit=*/"pushes", |
| 152 | + /*tag_keys=*/{"Type"}); |
| 153 | +} |
| 154 | + |
| 155 | +inline ray::stats::Gauge GetPushManagerChunksGaugeMetric() { |
| 156 | + return ray::stats::Gauge( |
| 157 | + /*name=*/"push_manager_chunks", |
| 158 | + /*description=*/ |
| 159 | + "Number of object chunks transfer broken per type {InFlight, Remaining}.", |
| 160 | + /*unit=*/"chunks", |
| 161 | + /*tag_keys=*/{"Type"}); |
| 162 | +} |
| 163 | + |
| 164 | +} // namespace ray |
0 commit comments