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

Reduce some unnecessary prometheus metrics. #5006

Merged
merged 14 commits into from
Jun 20, 2022
8 changes: 0 additions & 8 deletions dbms/src/Client/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
#include <Poco/Net/SecureStreamSocket.h>
#endif


namespace CurrentMetrics
{
extern const Metric SendExternalTables;
}

namespace DB
{
namespace ErrorCodes
Expand Down Expand Up @@ -434,8 +428,6 @@ void Connection::sendExternalTablesData(ExternalTablesData & data)
size_t maybe_compressed_out_bytes = maybe_compressed_out ? maybe_compressed_out->count() : 0;
size_t rows = 0;

CurrentMetrics::Increment metric_increment{CurrentMetrics::SendExternalTables};

for (auto & elem : data)
{
elem.first->readPrefix();
Expand Down
9 changes: 0 additions & 9 deletions dbms/src/Client/ConnectionPoolWithFailover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
#include <Poco/Net/DNS.h>
#include <Poco/Net/NetException.h>


namespace ProfileEvents
{
extern const Event DistributedConnectionMissingTable;
extern const Event DistributedConnectionStaleReplica;
} // namespace ProfileEvents

namespace DB
{
namespace ErrorCodes
Expand Down Expand Up @@ -187,7 +180,6 @@ ConnectionPoolWithFailover::tryGetEntry(
fail_message = "There is no table " + table_to_check->database + "." + table_to_check->table
+ " on server: " + result.entry->getDescription();
LOG_WARNING(log, fail_message);
ProfileEvents::increment(ProfileEvents::DistributedConnectionMissingTable);

return result;
}
Expand Down Expand Up @@ -217,7 +209,6 @@ ConnectionPoolWithFailover::tryGetEntry(
table_to_check->database,
table_to_check->table,
delay);
ProfileEvents::increment(ProfileEvents::DistributedConnectionStaleReplica);
}
}
catch (const Exception & e)
Expand Down
10 changes: 0 additions & 10 deletions dbms/src/Common/Arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@
#include <memory>
#include <vector>


namespace ProfileEvents
{
extern const Event ArenaAllocChunks;
extern const Event ArenaAllocBytes;
} // namespace ProfileEvents

namespace DB
{
/** Memory pool to append something. For example, short strings.
Expand All @@ -55,9 +48,6 @@ class Arena : private boost::noncopyable

Chunk(size_t size_, Chunk * prev_)
{
ProfileEvents::increment(ProfileEvents::ArenaAllocChunks);
ProfileEvents::increment(ProfileEvents::ArenaAllocBytes, size_);

begin = reinterpret_cast<char *>(Allocator::alloc(size_));
pos = begin;
end = begin + size_;
Expand Down
25 changes: 0 additions & 25 deletions dbms/src/Common/CurrentMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,11 @@

/// Available metrics. Add something here as you wish.
#define APPLY_FOR_METRICS(M) \
M(Query) \
M(Merge) \
M(ReplicatedFetch) \
M(ReplicatedSend) \
M(ReplicatedChecks) \
M(BackgroundPoolTask) \
M(DiskSpaceReservedForMerge) \
M(DistributedSend) \
M(QueryPreempted) \
M(TCPConnection) \
M(HTTPConnection) \
M(InterserverConnection) \
M(OpenFileForRead) \
M(OpenFileForWrite) \
M(OpenFileForReadWrite) \
M(SendExternalTables) \
M(QueryThread) \
M(ReadonlyReplica) \
M(LeaderReplica) \
M(MemoryTracking) \
M(MemoryTrackingInBackgroundProcessingPool) \
M(MemoryTrackingForMerges) \
M(LeaderElection) \
M(EphemeralNode) \
M(DelayedInserts) \
M(ContextLockWait) \
M(StorageBufferRows) \
M(StorageBufferBytes) \
M(DictCacheRequests) \
M(Revision) \
M(PSMVCCNumSnapshots) \
M(PSMVCCSnapshotsList) \
M(RWLockWaitingReaders) \
Expand Down
2 changes: 0 additions & 2 deletions dbms/src/Common/LRUCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@ class LRUCache
--queue_size;
}

onRemoveOverflowWeightLoss(current_weight_lost);

mengxin9014 marked this conversation as resolved.
Show resolved Hide resolved
if (current_size > (1ull << 63))
{
LOG_FMT_ERROR(&Poco::Logger::get("LRUCache"), "LRUCache became inconsistent. There must be a bug in it.");
Expand Down
8 changes: 0 additions & 8 deletions dbms/src/Common/PoolWithFailoverBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ extern const int LOGICAL_ERROR;
} // namespace ErrorCodes
} // namespace DB

namespace ProfileEvents
{
extern const Event DistributedConnectionFailTry;
extern const Event DistributedConnectionFailAtAll;
} // namespace ProfileEvents

/// This class provides a pool with fault tolerance. It is used for pooling of connections to replicated DB.
/// Initialized by several PoolBase objects.
/// When a connection is requested, tries to create or choose an alive connection from one of the nested pools.
Expand Down Expand Up @@ -254,14 +248,12 @@ PoolWithFailoverBase<TNestedPool>::getMany(
else
{
LOG_FMT_WARNING(log, "Connection failed at try No.{}, reason: {}", shuffled_pool.error_count + 1, fail_message);
ProfileEvents::increment(ProfileEvents::DistributedConnectionFailTry);

++shuffled_pool.error_count;

if (shuffled_pool.error_count >= max_tries)
{
++failed_pools_count;
ProfileEvents::increment(ProfileEvents::DistributedConnectionFailAtAll);
}
}
}
Expand Down
243 changes: 89 additions & 154 deletions dbms/src/Common/ProfileEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,160 +16,95 @@


/// Available events. Add something here as you wish.
#define APPLY_FOR_EVENTS(M) \
M(Query) \
M(SelectQuery) \
M(InsertQuery) \
M(DeleteQuery) \
M(FileOpen) \
M(FileOpenFailed) \
M(Seek) \
M(ReadBufferFromFileDescriptorRead) \
M(ReadBufferFromFileDescriptorReadFailed) \
M(ReadBufferFromFileDescriptorReadBytes) \
M(WriteBufferFromFileDescriptorWrite) \
M(WriteBufferFromFileDescriptorWriteFailed) \
M(WriteBufferFromFileDescriptorWriteBytes) \
M(ReadBufferAIORead) \
M(ReadBufferAIOReadBytes) \
M(WriteBufferAIOWrite) \
M(WriteBufferAIOWriteBytes) \
M(ReadCompressedBytes) \
M(CompressedReadBufferBlocks) \
M(CompressedReadBufferBytes) \
M(UncompressedCacheHits) \
M(UncompressedCacheMisses) \
M(UncompressedCacheWeightLost) \
M(IOBufferAllocs) \
M(IOBufferAllocBytes) \
M(ArenaAllocChunks) \
M(ArenaAllocBytes) \
M(FunctionExecute) \
M(TableFunctionExecute) \
M(MarkCacheHits) \
M(MarkCacheMisses) \
M(CreatedReadBufferOrdinary) \
M(CreatedReadBufferAIO) \
M(CreatedWriteBufferOrdinary) \
M(CreatedWriteBufferAIO) \
\
M(InsertedRows) \
M(InsertedBytes) \
M(DelayedInserts) \
M(RejectedInserts) \
M(DelayedInsertsMilliseconds) \
M(DuplicatedInsertedBlocks) \
\
M(DistributedConnectionFailTry) \
M(DistributedConnectionMissingTable) \
M(DistributedConnectionStaleReplica) \
M(DistributedConnectionFailAtAll) \
\
M(CompileAttempt) \
M(CompileSuccess) \
\
M(ExternalSortWritePart) \
M(ExternalSortMerge) \
M(ExternalAggregationWritePart) \
M(ExternalAggregationMerge) \
M(ExternalAggregationCompressedBytes) \
M(ExternalAggregationUncompressedBytes) \
\
M(SlowRead) \
M(ReadBackoff) \
\
M(RegexpCreated) \
M(ContextLock) \
\
M(StorageBufferFlush) \
M(StorageBufferErrorOnFlush) \
M(StorageBufferPassedAllMinThresholds) \
M(StorageBufferPassedTimeMaxThreshold) \
M(StorageBufferPassedRowsMaxThreshold) \
M(StorageBufferPassedBytesMaxThreshold) \
\
M(DictCacheKeysRequested) \
M(DictCacheKeysRequestedMiss) \
M(DictCacheKeysRequestedFound) \
M(DictCacheKeysExpired) \
M(DictCacheKeysNotFound) \
M(DictCacheKeysHit) \
M(DictCacheRequestTimeNs) \
M(DictCacheRequests) \
M(DictCacheLockWriteNs) \
M(DictCacheLockReadNs) \
\
M(DistributedSyncInsertionTimeoutExceeded) \
M(DataAfterMergeDiffersFromReplica) \
M(PolygonsAddedToPool) \
M(PolygonsInPoolAllocatedBytes) \
M(RWLockAcquiredReadLocks) \
M(RWLockAcquiredWriteLocks) \
M(RWLockReadersWaitMilliseconds) \
M(RWLockWritersWaitMilliseconds) \
\
M(PSMWritePages) \
M(PSMWriteIOCalls) \
M(PSV3MBlobExpansion) \
M(PSV3MBlobReused) \
M(PSMWriteBytes) \
M(PSMBackgroundWriteBytes) \
M(PSMReadPages) \
M(PSMBackgroundReadBytes) \
\
M(PSMReadIOCalls) \
M(PSMReadBytes) \
M(PSMWriteFailed) \
M(PSMReadFailed) \
\
M(PSMVCCApplyOnCurrentBase) \
M(PSMVCCApplyOnCurrentDelta) \
M(PSMVCCApplyOnNewDelta) \
M(PSMVCCCompactOnDelta) \
M(PSMVCCCompactOnDeltaRebaseRejected) \
M(PSMVCCCompactOnBase) \
\
M(DMWriteBytes) \
M(DMWriteBlock) \
M(DMWriteBlockNS) \
M(DMWriteFile) \
M(DMWriteFileNS) \
M(DMDeleteRange) \
M(DMDeleteRangeNS) \
M(DMAppendDeltaPrepare) \
M(DMAppendDeltaPrepareNS) \
M(DMAppendDeltaCommitMemory) \
M(DMAppendDeltaCommitMemoryNS) \
M(DMAppendDeltaCommitDisk) \
M(DMAppendDeltaCommitDiskNS) \
M(DMAppendDeltaCleanUp) \
M(DMAppendDeltaCleanUpNS) \
M(DMPlace) \
M(DMPlaceNS) \
M(DMPlaceUpsert) \
M(DMPlaceUpsertNS) \
M(DMPlaceDeleteRange) \
M(DMPlaceDeleteRangeNS) \
M(DMDeltaMerge) \
M(DMDeltaMergeNS) \
M(DMSegmentSplit) \
M(DMSegmentSplitNS) \
M(DMSegmentGetSplitPoint) \
M(DMSegmentGetSplitPointNS) \
M(DMSegmentMerge) \
M(DMSegmentMergeNS) \
M(DMFlushDeltaCache) \
M(DMFlushDeltaCacheNS) \
M(DMCleanReadRows) \
\
M(FileFSync) \
\
M(DMFileFilterNoFilter) \
M(DMFileFilterAftPKAndPackSet) \
M(DMFileFilterAftRoughSet) \
\
M(ChecksumDigestBytes) \
\
#define APPLY_FOR_EVENTS(M) \
M(Query) \
M(FileOpen) \
M(FileOpenFailed) \
M(ReadBufferFromFileDescriptorRead) \
M(ReadBufferFromFileDescriptorReadFailed) \
M(ReadBufferFromFileDescriptorReadBytes) \
M(WriteBufferFromFileDescriptorWrite) \
M(WriteBufferFromFileDescriptorWriteBytes) \
M(ReadBufferAIORead) \
M(ReadBufferAIOReadBytes) \
M(WriteBufferAIOWrite) \
M(WriteBufferAIOWriteBytes) \
\
M(MarkCacheHits) \
M(MarkCacheMisses) \
\
M(ExternalAggregationCompressedBytes) \
M(ExternalAggregationUncompressedBytes) \
\
M(ContextLock) \
\
M(RWLockAcquiredReadLocks) \
M(RWLockAcquiredWriteLocks) \
M(RWLockReadersWaitMilliseconds) \
M(RWLockWritersWaitMilliseconds) \
\
M(PSMWritePages) \
M(PSMWriteIOCalls) \
M(PSV3MBlobExpansion) \
M(PSV3MBlobReused) \
M(PSMWriteBytes) \
M(PSMBackgroundWriteBytes) \
M(PSMReadPages) \
M(PSMBackgroundReadBytes) \
\
M(PSMReadIOCalls) \
M(PSMReadBytes) \
M(PSMWriteFailed) \
M(PSMReadFailed) \
\
M(PSMVCCApplyOnCurrentBase) \
M(PSMVCCApplyOnCurrentDelta) \
M(PSMVCCApplyOnNewDelta) \
M(PSMVCCCompactOnDelta) \
M(PSMVCCCompactOnDeltaRebaseRejected) \
M(PSMVCCCompactOnBase) \
\
M(DMWriteBytes) \
M(DMWriteBlock) \
M(DMWriteBlockNS) \
M(DMWriteFile) \
M(DMWriteFileNS) \
M(DMDeleteRange) \
M(DMDeleteRangeNS) \
M(DMAppendDeltaPrepare) \
M(DMAppendDeltaPrepareNS) \
M(DMAppendDeltaCommitMemory) \
M(DMAppendDeltaCommitMemoryNS) \
M(DMAppendDeltaCommitDisk) \
M(DMAppendDeltaCommitDiskNS) \
M(DMAppendDeltaCleanUp) \
M(DMAppendDeltaCleanUpNS) \
M(DMPlace) \
M(DMPlaceNS) \
M(DMPlaceUpsert) \
M(DMPlaceUpsertNS) \
M(DMPlaceDeleteRange) \
M(DMPlaceDeleteRangeNS) \
M(DMDeltaMerge) \
M(DMDeltaMergeNS) \
M(DMSegmentSplit) \
M(DMSegmentSplitNS) \
M(DMSegmentGetSplitPoint) \
M(DMSegmentGetSplitPointNS) \
M(DMSegmentMerge) \
M(DMSegmentMergeNS) \
M(DMFlushDeltaCache) \
M(DMFlushDeltaCacheNS) \
M(DMCleanReadRows) \
\
M(FileFSync) \
\
M(DMFileFilterNoFilter) \
M(DMFileFilterAftPKAndPackSet) \
M(DMFileFilterAftRoughSet) \
\
M(ChecksumDigestBytes) \
\
M(RaftWaitIndexTimeout)

namespace ProfileEvents
Expand Down
Loading