-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'V4' into feat/onramp-widget
- Loading branch information
Showing
7 changed files
with
4,832 additions
and
3,444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# Obtain a project ID from https://cloud.walletconnect.com | ||
NEXT_PUBLIC_PROJECT_ID="" | ||
# See 1password for `NEXT_AUTH_SECRET` | ||
NEXTAUTH_SECRET="" | ||
NEXTAUTH_URL="" | ||
# See 1password for `Mailsac Web3Modal API Key` | ||
MAILSAC_API_KEY="" | ||
# Only needed when overriding default next-auth URL | ||
# NEXTAUTH_URL="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { | ||
CloudWatch, | ||
type MetricDatum, | ||
type PutMetricDataCommandInput | ||
} from '@aws-sdk/client-cloudwatch' | ||
|
||
// eslint-disable-next-line func-style | ||
export const uploadCanaryResultsToCloudWatch = async ( | ||
env: string, | ||
region: string, | ||
target: string, | ||
metricsPrefix: string, | ||
isTestPassed: boolean, | ||
testDurationMs: number | ||
// eslint-disable-next-line max-params | ||
) => { | ||
const cloudwatch = new CloudWatch({ region: 'eu-central-1' }) | ||
const ts = new Date() | ||
const metrics: MetricDatum[] = [ | ||
{ | ||
MetricName: `${metricsPrefix}.success`, | ||
Dimensions: [ | ||
{ | ||
Name: 'Target', | ||
Value: target | ||
}, | ||
{ | ||
Name: 'Region', | ||
Value: region | ||
} | ||
], | ||
Unit: 'Count', | ||
Value: isTestPassed ? 1 : 0, | ||
Timestamp: ts | ||
}, | ||
{ | ||
MetricName: `${metricsPrefix}.failure`, | ||
Dimensions: [ | ||
{ | ||
Name: 'Target', | ||
Value: target | ||
}, | ||
{ | ||
Name: 'Region', | ||
Value: region | ||
} | ||
], | ||
Unit: 'Count', | ||
Value: isTestPassed ? 0 : 1, | ||
Timestamp: ts | ||
} | ||
] | ||
|
||
if (isTestPassed) { | ||
metrics.push({ | ||
MetricName: `${metricsPrefix}.latency`, | ||
Dimensions: [ | ||
{ | ||
Name: 'Target', | ||
Value: target | ||
}, | ||
{ | ||
Name: 'Region', | ||
Value: region | ||
} | ||
], | ||
Unit: 'Milliseconds', | ||
Value: testDurationMs, | ||
Timestamp: ts | ||
}) | ||
} | ||
|
||
const params: PutMetricDataCommandInput = { | ||
MetricData: metrics, | ||
Namespace: `${env}_Canary_Web3Modal` | ||
} | ||
|
||
await new Promise<void>(resolve => { | ||
cloudwatch.putMetricData(params, (err: Error) => { | ||
if (err) { | ||
// eslint-disable-next-line no-console | ||
console.error('Failed to upload metrics to CloudWatch', err, err.stack) | ||
} | ||
resolve() | ||
}) | ||
}) | ||
} |
Oops, something went wrong.