File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
packages/bundler-plugin-core/src/plugins Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ import { type Hub , type NodeClient } from "@sentry/node" ;
2+ import { type UnpluginOptions } from "unplugin" ;
3+ import { dim } from "../utils/logging" ;
4+ import { safeFlushTelemetry } from "../sentry" ;
5+
6+ interface TelemetryPluginOptions {
7+ sentryHub ?: Hub ;
8+ sentryClient ?: NodeClient ;
9+ shouldSendTelemetry : boolean ;
10+ }
11+
12+ export function telemetryPlugin ( {
13+ sentryHub,
14+ sentryClient,
15+ shouldSendTelemetry,
16+ } : TelemetryPluginOptions ) : UnpluginOptions {
17+ return {
18+ name : "codecov-telemetry-plugin" ,
19+ async buildStart ( ) {
20+ if ( shouldSendTelemetry && sentryHub && sentryClient ) {
21+ dim (
22+ "Sending error and performance telemetry data to Sentry. To disable telemetry, set `options.telemetry` to `false`." ,
23+ ) ;
24+ sentryHub
25+ . startTransaction ( { name : "Codecov Bundler Plugin execution" } )
26+ . finish ( ) ;
27+ await safeFlushTelemetry ( sentryClient ) ;
28+ }
29+ } ,
30+ } ;
31+ }
You can’t perform that action at this time.
0 commit comments