Skip to content

Commit

Permalink
Reduce some unnecessary prometheus metrics. (#5006)
Browse files Browse the repository at this point in the history
close #5080
  • Loading branch information
mengxin9014 authored Jun 20, 2022
1 parent 604b0de commit 40baeca
Show file tree
Hide file tree
Showing 43 changed files with 612 additions and 1,046 deletions.
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
11 changes: 1 addition & 10 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 All @@ -50,7 +43,7 @@ ConnectionPoolWithFailover::ConnectionPoolWithFailover(
hostname_differences.resize(nested_pools.size());
for (size_t i = 0; i < nested_pools.size(); ++i)
{
ConnectionPool & connection_pool = dynamic_cast<ConnectionPool &>(*nested_pools[i]);
auto & connection_pool = dynamic_cast<ConnectionPool &>(*nested_pools[i]);
hostname_differences[i] = getHostNameDifference(local_hostname, connection_pool.getHost());
}
}
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
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
Loading

0 comments on commit 40baeca

Please sign in to comment.