Skip to content

Commit

Permalink
send webVitals one by one
Browse files Browse the repository at this point in the history
  • Loading branch information
schehata committed Nov 25, 2022
1 parent 4bc6d54 commit 69c1b88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 4 additions & 6 deletions src/platform/generic.ts
Expand Up @@ -31,17 +31,15 @@ export default class GenericConfig implements Provider {
return this.isBrowser ? `${this.proxyPath}/logs` : this.getIngestURL(EndpointType.webVitals);
}

wrapWebVitalsObject(metrics: any[]): any {
return [
{
webVitals: metrics,
wrapWebVitalsObject(metrics: any[]) {
return metrics.map(m => ({
webVital: m,
_time: new Date().getTime(),
platform: {
environment: this.environment,
source: 'web-vital',
},
},
];
}))
}

injectPlatformMetadata(logEvent: any, source: string) {
Expand Down
8 changes: 3 additions & 5 deletions src/platform/netlify.ts
Expand Up @@ -8,9 +8,8 @@ export default class NetlifyConfig extends GenericConfig implements Provider {
netlifyDeploymentId = process.env.DEPLOY_ID;

wrapWebVitalsObject(metrics: any[]) {
return [
{
webVitals: metrics,
return metrics.map(m => ({
webVital: m,
_time: new Date().getTime(),
netlify: {
environment: this.environment,
Expand All @@ -20,8 +19,7 @@ export default class NetlifyConfig extends GenericConfig implements Provider {
deploymentUrl: this.netlifyDeploymentUrl,
deploymentId: this.netlifyDeploymentId,
},
},
];
}))
}

injectPlatformMetadata(logEvent: any, source: string) {
Expand Down

0 comments on commit 69c1b88

Please sign in to comment.