Skip to content
Draft
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
5 changes: 5 additions & 0 deletions cloud/blockstore/config/diagnostics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,10 @@ message TDiagnosticsConfig
// Skip reporting ZeroBlocks metrics as part of WriteBlocks metrics
optional bool SkipReportingZeroBlocksMetricsForYDBBasedDisks = 53;

// Opentelemetry trace config
optional NCloud.NProto.TOpentelemetryTraceConfig OpentelemetryTraceConfig = 54;

// Report time histograms with milliseconds buckets. Percentiles are still
// reported in microseconds.
optional bool UseMsUnitsForTimeHistogram = 56;
}
1 change: 1 addition & 0 deletions cloud/blockstore/libs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ client/ut/cloud-blockstore-libs-client-ut
common/benchmark/benchmark
common/ut/cloud-blockstore-libs-common-ut
daemon/ydb/ut/cloud-blockstore-libs-daemon-ydb-ut
diagnostics/gtest/cloud-blockstore-libs-diagnostics-gtest
diagnostics/ut/cloud-blockstore-libs-diagnostics-ut
discovery/ut/cloud-blockstore-libs-discovery-ut
disk_agent/ut/cloud-blockstore-libs-disk_agent-ut
Expand Down
7 changes: 6 additions & 1 deletion cloud/blockstore/libs/diagnostics/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ namespace {
xxx(LocalHDDDowntimeThreshold, TDuration, TDuration::Seconds(15) )\
xxx(ReportHistogramAsMultipleCounters, bool, true )\
xxx(ReportHistogramAsSingleCounter, bool, false )\
xxx(StatsFetcherType, NCloud::NProto::EStatsFetcherType, NCloud::NProto::EStatsFetcherType::CGROUP )\
xxx(UseMsUnitsForTimeHistogram, bool, false )\
xxx(StatsFetcherType, NCloud::NProto::EStatsFetcherType, NCloud::NProto::EStatsFetcherType::CGROUP )\
\
xxx(SkipReportingZeroBlocksMetricsForYDBBasedDisks, bool, false )\
xxx(OpentelemetryTraceConfig, ::NCloud::NProto::TOpentelemetryTraceConfig, {} )\
Expand Down Expand Up @@ -173,6 +174,10 @@ EHistogramCounterOptions TDiagnosticsConfig::GetHistogramCounterOptions() const
if (GetReportHistogramAsSingleCounter()) {
histogramCounterOptions |= EHistogramCounterOption::ReportSingleCounter;
}
if (GetUseMsUnitsForTimeHistogram()) {
histogramCounterOptions |=
EHistogramCounterOption::UseMsUnitsForTimeHistogram;
}
return histogramCounterOptions;
}

Expand Down
1 change: 1 addition & 0 deletions cloud/blockstore/libs/diagnostics/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class TDiagnosticsConfig

TRequestThresholds GetRequestThresholds() const;
EHistogramCounterOptions GetHistogramCounterOptions() const;
bool GetUseMsUnitsForTimeHistogram() const;

NCloud::NProto::EStatsFetcherType GetStatsFetcherType() const;

Expand Down
30 changes: 30 additions & 0 deletions cloud/blockstore/libs/diagnostics/gtest/ya.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
GTEST()

INCLUDE(${ARCADIA_ROOT}/cloud/storage/core/tests/recipes/small.inc)

PEERDIR(
cloud/blockstore/libs/service
cloud/storage/core/libs/diagnostics
cloud/storage/core/libs/user_stats/counter

library/cpp/eventlog/dumper
library/cpp/json
library/cpp/monlib/encode/json
library/cpp/monlib/encode/spack
library/cpp/monlib/encode/text
library/cpp/resource
)

RESOURCE(
res/user_server_volume_instance_test.json user_server_volume_instance_test
res/user_service_volume_instance_test.json user_service_volume_instance_test
res/user_server_volume_instance_skip_zero_blocks_test.json user_server_volume_instance_skip_zero_blocks_test
)

SRCS(
../user_counter.cpp

../user_counter_ut.cpp
)

END()
22 changes: 18 additions & 4 deletions cloud/blockstore/libs/diagnostics/user_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void RegisterServiceVolume(
const TString& cloudId,
const TString& folderId,
const TString& diskId,
EHistogramCounterOptions histogramCounterOptions,
TDynamicCounterPtr src)
{
const auto commonLabels =
Expand All @@ -94,7 +95,10 @@ void RegisterServiceVolume(

auto readSub = src->FindSubgroup("request", "ReadBlocks");
AddHistogramUserMetric(
GetUsBuckets(),
histogramCounterOptions.HasFlag(
EHistogramCounterOption::UseMsUnitsForTimeHistogram)
? GetMsBuckets()
: GetUsBuckets(),
dsc,
commonLabels,
{{readSub, "ThrottlerDelay"}},
Expand All @@ -103,7 +107,10 @@ void RegisterServiceVolume(
auto writeSub = src->FindSubgroup("request", "WriteBlocks");
auto zeroSub = src->FindSubgroup("request", "ZeroBlocks");
AddHistogramUserMetric(
GetUsBuckets(),
histogramCounterOptions.HasFlag(
EHistogramCounterOption::UseMsUnitsForTimeHistogram)
? GetMsBuckets()
: GetUsBuckets(),
dsc,
commonLabels,
{{writeSub, "ThrottlerDelay"}, {zeroSub, "ThrottlerDelay"}},
Expand Down Expand Up @@ -132,6 +139,7 @@ void RegisterServerVolumeInstance(
const TString& diskId,
const TString& instanceId,
const bool reportZeroBlocksMetrics,
EHistogramCounterOptions histogramCounterOptions,
TDynamicCounterPtr src)
{
if (instanceId.empty()) {
Expand Down Expand Up @@ -184,7 +192,10 @@ void RegisterServerVolumeInstance(
{{readSub, "MaxInProgressBytes"}},
DISK_READ_BYTES_IN_FLIGHT_BURST);
AddHistogramUserMetric(
GetUsBuckets(),
histogramCounterOptions.HasFlag(
EHistogramCounterOption::UseMsUnitsForTimeHistogram)
? GetMsBuckets()
: GetUsBuckets(),
dsc,
commonLabels,
{{readSub, "Time"}},
Expand Down Expand Up @@ -242,7 +253,10 @@ void RegisterServerVolumeInstance(
getWriteCounters("MaxInProgressBytes"),
DISK_WRITE_BYTES_IN_FLIGHT_BURST);
AddHistogramUserMetric(
GetUsBuckets(),
histogramCounterOptions.HasFlag(
EHistogramCounterOption::UseMsUnitsForTimeHistogram)
? GetMsBuckets()
: GetUsBuckets(),
dsc,
commonLabels,
getWriteCounters("Time"),
Expand Down
7 changes: 5 additions & 2 deletions cloud/blockstore/libs/diagnostics/user_counter.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once

#include <cloud/storage/core/libs/diagnostics/histogram_counter_options.h>
#include <cloud/storage/core/libs/user_stats/counter/user_counter.h>

#include <library/cpp/monlib/dynamic_counters/counters.h>
#include <library/cpp/monlib/metrics/metric_registry.h>

#include <cloud/storage/core/libs/user_stats/counter/user_counter.h>

#include <util/generic/hash_multi_map.h>

namespace NCloud::NBlockStore::NUserCounter {
Expand All @@ -18,6 +19,7 @@ void RegisterServiceVolume(
const TString& cloudId,
const TString& folderId,
const TString& diskId,
EHistogramCounterOptions histogramCounterOptions,
NMonitoring::TDynamicCounterPtr src);

void UnregisterServiceVolume(
Expand All @@ -33,6 +35,7 @@ void RegisterServerVolumeInstance(
const TString& diskId,
const TString& instanceId,
const bool reportZeroBlocksMetrics,
EHistogramCounterOptions histogramCounterOptions,
NMonitoring::TDynamicCounterPtr src);

void UnregisterServerVolumeInstance(
Expand Down
Loading
Loading