Skip to content

Commit e967d4f

Browse files
authored
Fix bugs and add missing files in the Open Telemetry sample. (#1022)
1 parent 81700d7 commit e967d4f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This loads the telemetry library before functions framework because
2+
# The Open Telemetry SDK must be the first thing that runs
3+
NODE_OPTIONS=--require=./tracing.js

2nd-gen/instrument-with-opentelemetry/functions/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ async function calculatePrice(productIds) {
4949
async function calculateDiscount(productIds) {
5050
const timer = new Timer();
5151

52+
5253
let discountUsd = 0;
5354
const processConcurrently = sliceIntoChunks(productIds, 10)
5455
.map(async (productIds) => {
5556
const discounts = await db.collection("discounts")
56-
.where("products", "array-contains", productIds)
57+
.where("products", "array-contains-any", productIds)
5758
.get();
5859
for (const discount of discounts.docs) {
5960
discountUsd += discount.data().usd || 0;

0 commit comments

Comments
 (0)