MCPcopy
hub / github.com/prometheus/client_js / hashObject

Function hashObject

lib/util.js:88–103  ·  view source on GitHub ↗
(labels, labelNames)

Source from the content-addressed store, hash-verified

86}
87
88function hashObject(labels, labelNames) {
89 // We don't actually need a hash here. We just need a string that
90 // is unique for each possible labels object and consistent across
91 // calls with equivalent labels objects.
92
93 if (labelNames) {
94 return fastHashObject(labelNames, labels);
95 }
96
97 const keys = Object.keys(labels);
98 if (keys.length > 1) {
99 keys.sort(); // need consistency across calls
100 }
101
102 return fastHashObject(keys, labels);
103}
104exports.hashObject = hashObject;
105
106exports.isObject = function isObject(obj) {

Callers 11

util.jsFile · 0.85
constructorMethod · 0.85
updateExemplarMethod · 0.85
zeroMethod · 0.85
observeFunction · 0.85
AggregatorFactoryFunction · 0.85
_getValueMethod · 0.85
setDeltaFunction · 0.85
incWithoutExemplarMethod · 0.85
constructorMethod · 0.85
observeFunction · 0.85

Calls 1

fastHashObjectFunction · 0.85

Tested by

no test coverage detected