Skip to content

Commit 328070f

Browse files
committed
chore: update counter to histogram to collect the identifier counts
1 parent 95c876c commit 328070f

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

src/util/prometheus.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -635,18 +635,6 @@ class Prometheus {
635635
type: 'counter',
636636
labelNames: ['identifier_type', 'destination_id'],
637637
},
638-
{
639-
name: 'braze_lookup_failure_count',
640-
help: 'braze look-up failure count',
641-
type: 'counter',
642-
labelNames: ['http_status', 'destination_id'],
643-
},
644-
{
645-
name: 'braze_lookup_success_count',
646-
help: 'Count of events where user look up was successful in Braze destination transformation.',
647-
type: 'counter',
648-
labelNames: ['http_status', 'destination_id'],
649-
},
650638
{
651639
name: 'braze_lookup_time',
652640
help: 'braze look-up time',
@@ -671,10 +659,18 @@ class Prometheus {
671659
],
672660
},
673661
{
674-
name: 'braze_dedup_skipped_due_to_lookup_failure_count',
675-
help: 'Count of events that skipped deduplication due to lookup API failure',
676-
type: 'counter',
662+
name: 'braze_lookup_failure_identifiers',
663+
help: 'Count of identifiers that failed to lookup due to API failure',
664+
type: 'histogram',
665+
labelNames: ['destination_id', 'http_status'],
666+
buckets: [0, 10, 20, 30, 40, 50],
667+
},
668+
{
669+
name: 'braze_lookup_success_identifiers',
670+
help: 'Count of identifiers that successfully looked up due to API failure',
671+
type: 'histogram',
677672
labelNames: ['destination_id'],
673+
buckets: [0, 10, 20, 30, 40, 50],
678674
},
679675
{
680676
name: 'fb_custom_audience_event_having_all_null_field_values_for_a_user',

src/v0/destinations/braze/util.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,19 @@ const BrazeDedupUtility = {
265265
...externalIdentifiers.map((id) => id.external_id),
266266
...aliasIdentifiers.map((id) => id.alias_name),
267267
];
268-
stats.counter('braze_lookup_failure_count', 1, {
268+
stats.histogram('braze_lookup_failure_identifiers', failedIdentifiers.length, {
269269
http_status: lookUpResponse.status,
270270
destination_id: destination.ID,
271271
});
272272
return { users: [], failedIdentifiers };
273273
}
274-
stats.counter('braze_lookup_success_count', 1, {
275-
http_status: lookUpResponse.status,
276-
destination_id: destination.ID,
277-
});
274+
stats.histogram(
275+
'braze_lookup_success_identifiers',
276+
externalIdentifiers.length + aliasIdentifiers.length,
277+
{
278+
destination_id: destination.ID,
279+
},
280+
);
278281
const { users } = lookUpResponse.response;
279282
return { users: users || [], failedIdentifiers: [] };
280283
}),

0 commit comments

Comments
 (0)