File tree Expand file tree Collapse file tree 4 files changed +35
-305
lines changed Expand file tree Collapse file tree 4 files changed +35
-305
lines changed Original file line number Diff line number Diff line change 66
77import { AnyValueMap } from ' @opentelemetry/api-logs' ;
88import { FirebaseApp } from ' @firebase/app' ;
9- import { Instrumentation } from ' next' ;
109import { LoggerProvider } from ' @opentelemetry/sdk-logs' ;
1110
1211// @public
@@ -18,8 +17,24 @@ export function flush(telemetry: Telemetry): Promise<void>;
1817// @public
1918export function getTelemetry(app ? : FirebaseApp ): Telemetry ;
2019
20+ // @public (undocumented)
21+ export type InstrumentationOnRequestError = (error : unknown , errorRequest : Readonly <{
22+ path: string ;
23+ method: string ;
24+ headers: NodeJS .Dict <string | string []>;
25+ }>, errorContext : Readonly <RequestErrorContext >) => void | Promise <void >;
26+
27+ // @public
28+ export const nextOnRequestError: InstrumentationOnRequestError ;
29+
2130// @public
22- export const nextOnRequestError: Instrumentation .onRequestError ;
31+ export type RequestErrorContext = {
32+ routerKind: ' Pages Router' | ' App Router' ;
33+ routePath: string ;
34+ routeType: ' render' | ' route' | ' action' | ' middleware' ;
35+ renderSource? : ' react-server-components' | ' react-server-components-payload' | ' server-rendering' ;
36+ revalidateReason: ' on-demand' | ' stale' | undefined ;
37+ };
2338
2439// @public
2540export interface Telemetry {
Original file line number Diff line number Diff line change 5151 "@opentelemetry/resources" : " 2.0.1" ,
5252 "@opentelemetry/sdk-logs" : " 0.203.0" ,
5353 "@opentelemetry/semantic-conventions" : " 1.36.0" ,
54- "next" : " 15.5.2" ,
5554 "tslib" : " ^2.1.0"
5655 },
5756 "license" : " Apache-2.0" ,
Original file line number Diff line number Diff line change 1717
1818import { getApp } from '@firebase/app' ;
1919import { captureError , getTelemetry } from './api' ;
20- import { type Instrumentation } from 'next' ;
20+
21+ // The following types mirror those from Next at v15.5
22+ export type RequestErrorContext = {
23+ routerKind : 'Pages Router' | 'App Router' ;
24+ routePath : string ;
25+ routeType : 'render' | 'route' | 'action' | 'middleware' ;
26+ renderSource ?: 'react-server-components' | 'react-server-components-payload' | 'server-rendering' ;
27+ revalidateReason : 'on-demand' | 'stale' | undefined ;
28+ } ;
29+ export type InstrumentationOnRequestError = ( error : unknown , errorRequest : Readonly < {
30+ path : string ;
31+ method : string ;
32+ headers : NodeJS . Dict < string | string [ ] > ;
33+ } > , errorContext : Readonly < RequestErrorContext > ) => void | Promise < void > ;
2134
2235/**
2336 * Automatically report uncaught errors from server routes to Firebase Telemetry.
2437 *
2538 * @example
2639 * ```javascript
2740 * // In instrumentation.ts (https://nextjs.org/docs/app/guides/instrumentation):
28- * import { nextOnRequestError } from '@firebase/telemetry/next';
29- * export const onRequestError = nextOnRequestError;
41+ * export { nextOnRequestError as onRequestError } from 'firebase/telemetry'
3042 * ```
3143 *
3244 * @public
3345 */
34- export const nextOnRequestError : Instrumentation . onRequestError = async (
46+ export const nextOnRequestError : InstrumentationOnRequestError = async (
3547 error ,
3648 errorRequest ,
3749 errorContext
You can’t perform that action at this time.
0 commit comments