void ThreadLocalStoreImpl::setHistogramSettings(HistogramSettingsConstPtr&& histogram_settings) {
list.push_back(iter->second); // Save SharedPtr to the list to avoid invalidating refs to stat.
StatNameHashMap<StatSharedPtr>& map, std::function<void(const StatSharedPtr&)> f_deletion) {
ScopeSharedPtr ThreadLocalStoreImpl::ScopeImpl::createScope(const std::string& name, bool evictable,
StatNameManagedStorage stat_name_storage(Utility::sanitizeStatsName(name), symbolTable());
return scopeFromStatName(stat_name_storage.statName(), evictable, limits, std::move(matcher));
auto new_scope = std::make_shared<ScopeImpl>(parent_, StatName(joined.get()), evictable, limits,
[&ret](TextReadout& text_readout) { ret.emplace_back(TextReadoutSharedPtr(&text_readout)); });
[](Event::Dispatcher&) -> std::shared_ptr<TlsCache> { return std::make_shared<TlsCache>(); });
ASSERT(symbol_table_.toString(StatNameManagedStorage("Hello.world", symbol_table_).statName()) ==
void ThreadLocalStoreImpl::TlsCache::eraseScopes(const std::vector<uint64_t>& scope_ids) {
void ThreadLocalStoreImpl::TlsCache::eraseHistograms(const std::vector<uint64_t>& histograms) {
// Move the histograms pending cleanup into a local variable. Future histogram deletions will be
: scope_id_(parent.next_scope_id_++), parent_(parent), evictable_(evictable), limits_(limits),
// converting them to StatName. Making the tag extraction optional within this class simplifies the
// The StatNameTagVector returned by this object will be valid as long as this object is in scope
// When tag extraction is not done, this class is just a passthrough for the provided name/tags.
: pool_(tls.symbolTable()), stat_name_tags_(stat_name_tags.value_or(StatNameTagVector())) {
parent_.alloc_, full_stat_name, tag_helper.tagExtractedName(), tag_helper.statNameTags());
tls_cache->insert(std::make_pair(ret.statName(), std::reference_wrapper<StatType>(ret)));
TagUtility::TagStatNameJoiner joiner(prefix_.statName(), name, stat_name_tags, symbolTable());
void ThreadLocalStoreImpl::deliverHistogramToSinks(const Histogram& histogram, uint64_t value) {
TagUtility::TagStatNameJoiner joiner(prefix_.statName(), name, stat_name_tags, symbolTable());
const StatName& name, StatNameTagVectorOptConstRef stat_name_tags, Histogram::Unit unit) {
TagUtility::TagStatNameJoiner joiner(prefix_.statName(), name, stat_name_tags, symbolTable());
TagUtility::TagStatNameJoiner joiner(prefix_.statName(), name, stat_name_tags, symbolTable());
final_stat_name, joiner.tagExtractedName(), stat_name_tags, central_cache->text_readouts_,
HistogramOptConstRef ThreadLocalStoreImpl::ScopeImpl::findHistogramLockHeld(StatName name) const
TextReadoutOptConstRef ThreadLocalStoreImpl::ScopeImpl::findTextReadout(StatName name) const {
Histogram& ThreadLocalStoreImpl::tlsHistogram(ParentHistogramImpl& parent, uint64_t id) {
new ThreadLocalHistogramImpl(parent.statName(), parent.unit(), tag_helper.tagExtractedName(),
: HistogramImplHelper(name, tag_extracted_name, stat_name_tags, symbol_table), unit_(unit),
used_(false), created_thread_id_(std::this_thread::get_id()), symbol_table_(symbol_table) {
: MetricImpl(name, tag_extracted_name, stat_name_tags, thread_local_store.symbolTable()),
SymbolTable& ParentHistogramImpl::symbolTable() { return thread_local_store_.symbolTable(); }
const std::vector<double>& supported_quantiles_ref = interval_statistics_.supportedQuantiles();
void ThreadLocalStoreImpl::forEachCounter(SizeFn f_size, StatFn<Counter> f_stat) const {
void ThreadLocalStoreImpl::forEachTextReadout(SizeFn f_size, StatFn<TextReadout> f_stat) const {
void ThreadLocalStoreImpl::forEachHistogram(SizeFn f_size, StatFn<ParentHistogram> f_stat) const {
return counters_.empty() && gauges_.empty() && histograms_.empty() && text_readouts_.empty();
void ThreadLocalStoreImpl::forEachSinkedCounter(SizeFn f_size, StatFn<Counter> f_stat) const {
void ThreadLocalStoreImpl::forEachSinkedGauge(SizeFn f_size, StatFn<Gauge> f_stat) const {
void ThreadLocalStoreImpl::setSinkPredicates(std::unique_ptr<SinkPredicates>&& sink_predicates) {
if (!need_counter_overflow_stat && !need_gauge_overflow_stat && !need_histogram_overflow_stat) {