Skip to content

Commit

Permalink
add report errors to influxdb
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Dec 18, 2024
1 parent 1c4d6ad commit 449fe8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import pRetry from 'p-retry'
import * as Name from 'w3name'
import { ethers } from 'ethers'
import * as SparkImpactEvaluator from '@filecoin-station/spark-impact-evaluator'
import { reportW3NameError } from './telemetry.js'

const {
// https://github.com/filecoin-station/contract-addresses
Expand Down Expand Up @@ -65,6 +66,7 @@ async function getContractAddresses () {
try {
revision = await Name.resolve(name)
} catch (err) {
reportW3NameError()
// These errors aren't actionable
err.reportToSentry = false
throw err
Expand Down
2 changes: 2 additions & 0 deletions lib/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { CarReader } from '@ipld/car'
import { validateBlock } from '@web3-storage/car-block-validator'
import { recursive as exporter } from 'ipfs-unixfs-exporter'
import * as tar from 'tar'
import { reportW3NameError } from './telemetry.js'

/** @typedef {import('unzip-stream').UnzipStreamEntry} UnzipStreamEntry */

Expand Down Expand Up @@ -110,6 +111,7 @@ async function getLatestCID (ipnsKey) {
try {
revision = await Name.resolve(name)
} catch (err) {
reportW3NameError()
// These errors aren't actionable
err.reportToSentry = false
throw err
Expand Down
7 changes: 7 additions & 0 deletions lib/telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,10 @@ export const runMachinesLoop = async ({ STATION_ID }) => {
await timers.setTimeout(24 * 3600 * 1000) // 1 day
}
}

export const reportW3NameError = () => {
const point = new Point('w3name-error')
point.stringField('version', pkg.version)
writeClient.writePoint(point)
writeClient.flush().catch(handleFlushError)
}

0 comments on commit 449fe8d

Please sign in to comment.