Skip to content

Commit

Permalink
fix: disable tracing across the board (#445)
Browse files Browse the repository at this point in the history
We currently can't use Sentry's tracing functionality because we overrun
our tracing data quota within hours. I'm disabling all tracing and plan
on re-enabling it across the board once I've worked out how to use it
for the debugging tasks I have on my plate right now.

Note that this **does not** disable error reporting - that's a separate
configuration option and this just disables tracing:

https://docs.sentry.io/platforms/javascript/tracing/

My end goal for this is to have tracing configured at a reasonable
percentage for each lambda - most will probably end up around 0.1 but
some higher volume functions may need even lower settings.
  • Loading branch information
travis authored Nov 25, 2024
1 parent b6ee242 commit ecab639
Show file tree
Hide file tree
Showing 31 changed files with 42 additions and 31 deletions.
2 changes: 1 addition & 1 deletion billing/functions/billing-cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0
tracesSampleRate: 0
})

/**
Expand Down
2 changes: 1 addition & 1 deletion billing/functions/customer-billing-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0
tracesSampleRate: 0
})

/**
Expand Down
2 changes: 1 addition & 1 deletion billing/functions/space-billing-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0
tracesSampleRate: 0
})

/**
Expand Down
2 changes: 1 addition & 1 deletion billing/functions/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

export const webhook = Sentry.AWSLambda.wrapHandler(
Expand Down
2 changes: 1 addition & 1 deletion billing/functions/ucan-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0
tracesSampleRate: 0
})

/**
Expand Down
2 changes: 1 addition & 1 deletion billing/functions/usage-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { expect } from './lib.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0
tracesSampleRate: 0
})

/**
Expand Down
2 changes: 1 addition & 1 deletion carpark/event-bus/eipfs-indexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const SQS_INDEXER_QUEUE_REGION = 'us-west-2'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion carpark/functions/carpark-bucket-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { notifyBus } from '../event-bus/source.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const EVENT_BUS_ARN = process.env.EVENT_BUS_ARN || ''
Expand Down
2 changes: 1 addition & 1 deletion filecoin/functions/handle-cron-tick.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const AWS_REGION = process.env.AWS_REGION || 'us-west-2'
Expand Down
2 changes: 1 addition & 1 deletion filecoin/functions/handle-filecoin-submit-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const AWS_REGION = process.env.AWS_REGION || 'us-west-2'
Expand Down
2 changes: 1 addition & 1 deletion filecoin/functions/handle-piece-insert-to-content-claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion filecoin/functions/handle-piece-offer-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion filecoin/functions/handle-piece-status-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const AWS_REGION = process.env.AWS_REGION || 'us-west-2'
Expand Down
2 changes: 1 addition & 1 deletion filecoin/functions/piece-cid-compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { getS3Client } from '../../lib/aws/s3.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion indexer/functions/handle-block-advert-publish-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getSQSClient } from '../../lib/aws/sqs.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion indexer/functions/handle-block-index-writer-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getDynamoClient } from '../../lib/aws/dynamo.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion replicator/functions/replicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getS3Client } from '../../lib/aws/s3.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion roundabout/functions/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getS3Client } from '../../lib/aws/s3.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion upload-api/functions/admin-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const AWS_REGION = process.env.AWS_REGION || 'us-west-2'
Expand Down
2 changes: 1 addition & 1 deletion upload-api/functions/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { streamToArrayBuffer, stringToStream } from '../bridge/streams.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down
2 changes: 1 addition & 1 deletion upload-api/functions/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getServiceSigner } from '../config.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const repo = 'https://github.com/web3-storage/w3infra'
Expand Down
2 changes: 1 addition & 1 deletion upload-api/functions/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { createMetricsTable } from '../tables/metrics.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const AWS_REGION = process.env.AWS_REGION || 'us-west-2'
Expand Down
2 changes: 1 addition & 1 deletion upload-api/functions/receipt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})


Expand Down
2 changes: 1 addition & 1 deletion upload-api/functions/space-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { mustGetEnv } from '../../lib/env.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const AWS_REGION = process.env.AWS_REGION || 'us-west-2'
Expand Down
2 changes: 1 addition & 1 deletion upload-api/functions/storefront-cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { handleCronTick } from '../../filecoin/functions/handle-cron-tick.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

export const handler = Sentry.AWSLambda.wrapHandler(handleCronTick)
2 changes: 1 addition & 1 deletion upload-api/functions/ucan-invocation-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import * as UCantoValidator from '@ucanto/validator'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

export { API }
Expand Down
2 changes: 1 addition & 1 deletion upload-api/functions/ucan.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as AgentStore from '../stores/agent.js'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

const AWS_REGION = process.env.AWS_REGION || 'us-west-2'
Expand Down
13 changes: 12 additions & 1 deletion upload-api/functions/validate-email.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const html = process.env.HOSTED_ZONE === 'up.web3.storage' ? htmlW3s : htmlStora
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

/**
Expand Down Expand Up @@ -183,6 +183,7 @@ function createAuthorizeContext() {
* @param {import('aws-lambda').APIGatewayProxyEventV2} request
*/
export async function validateEmailPost(request) {
console.log("VALIDATING EMAIL")
const encodedUcan = request.queryStringParameters?.ucan
if (!encodedUcan) {
return toLambdaResponse(
Expand All @@ -191,8 +192,14 @@ export async function validateEmailPost(request) {
)
)
}
console.log("CREATING CONTEXT")

const context = createAuthorizeContext()
console.log("AUTHORIZING")

const authorizeResult = await authorize(encodedUcan, context)
console.log("AUTHORIZED", JSON.stringify(authorizeResult))

if (authorizeResult.error) {
console.error(authorizeResult.error)
return toLambdaResponse(
Expand All @@ -208,17 +215,21 @@ export async function validateEmailPost(request) {
}

const { email, audience, ucan } = authorizeResult.ok
console.log("CHECKING PLAN")

const planCheckResult = await context.customerStore.get({
customer: DidMailto.fromEmail(email),
})
let stripePricingTableId
let stripePublishableKey
console.log("CHECKED PLAN", JSON.stringify(planCheckResult))

if (!planCheckResult.ok?.product) {
stripePricingTableId = context.stripePricingTableId
stripePublishableKey = context.stripePublishableKey
}


return toLambdaResponse(
new html.HtmlResponse(
(
Expand Down
2 changes: 1 addition & 1 deletion upload-api/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as UploadAPI from '@web3-storage/upload-api'
Sentry.AWSLambda.init({
environment: process.env.SST_STAGE,
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
tracesSampleRate: 0,
})

export const createServiceRouter = UploadAPI.createService
Expand Down

0 comments on commit ecab639

Please sign in to comment.