Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


registry "https://registry.npmjs.org/"
save-prefix ""
yarn-path ".yarn/releases/yarn-1.22.11.cjs"
2 changes: 1 addition & 1 deletion common/api-review/crashlytics-angular.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface Crashlytics {
// @public
export interface CrashlyticsOptions {
appVersion?: string;
loggingUrl?: string;
endpointUrl?: string;
tracingUrl?: string;
}

Expand Down
2 changes: 1 addition & 1 deletion common/api-review/crashlytics-react-router.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface Crashlytics {
// @public
export interface CrashlyticsOptions {
appVersion?: string;
loggingUrl?: string;
endpointUrl?: string;
tracingUrl?: string;
}

Expand Down
2 changes: 1 addition & 1 deletion common/api-review/crashlytics-react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface Crashlytics {
// @public
export interface CrashlyticsOptions {
appVersion?: string;
loggingUrl?: string;
endpointUrl?: string;
tracingUrl?: string;
}

Expand Down
2 changes: 1 addition & 1 deletion common/api-review/crashlytics.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface Crashlytics {
// @public
export interface CrashlyticsOptions {
appVersion?: string;
loggingUrl?: string;
endpointUrl?: string;
tracingUrl?: string;
}

Expand Down
6 changes: 3 additions & 3 deletions docs-devsite/crashlytics_.crashlyticsoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface CrashlyticsOptions
| Property | Type | Description |
| --- | --- | --- |
| [appVersion](./crashlytics_.crashlyticsoptions.md#crashlyticsoptionsappversion) | string | The version of the application. This should be a unique string that identifies the snapshot of code to be deployed, such as "1.0.2". If not specified, other default locations will be checked for an identifier. Setting a value here takes precedence over any other values. |
| [loggingUrl](./crashlytics_.crashlyticsoptions.md#crashlyticsoptionsloggingurl) | string | The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |
| [endpointUrl](./crashlytics_.crashlyticsoptions.md#crashlyticsoptionsendpointUrl) | string | The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |
| [tracingUrl](./crashlytics_.crashlyticsoptions.md#crashlyticsoptionstracingurl) | string | The URL for the endpoint to which Crashlytics traces should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |

## CrashlyticsOptions.appVersion
Expand All @@ -36,14 +36,14 @@ The version of the application. This should be a unique string that identifies t
appVersion?: string;
```

## CrashlyticsOptions.loggingUrl
## CrashlyticsOptions.endpointUrl

The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase.

<b>Signature:</b>

```typescript
loggingUrl?: string;
endpointUrl?: string;
```

## CrashlyticsOptions.tracingUrl
Expand Down
6 changes: 3 additions & 3 deletions docs-devsite/crashlytics_angular.crashlyticsoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface CrashlyticsOptions
| Property | Type | Description |
| --- | --- | --- |
| [appVersion](./crashlytics_angular.crashlyticsoptions.md#crashlyticsoptionsappversion) | string | The version of the application. This should be a unique string that identifies the snapshot of code to be deployed, such as "1.0.2". If not specified, other default locations will be checked for an identifier. Setting a value here takes precedence over any other values. |
| [loggingUrl](./crashlytics_angular.crashlyticsoptions.md#crashlyticsoptionsloggingurl) | string | The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |
| [endpointUrl](./crashlytics_angular.crashlyticsoptions.md#crashlyticsoptionsendpointUrl) | string | The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |
| [tracingUrl](./crashlytics_angular.crashlyticsoptions.md#crashlyticsoptionstracingurl) | string | The URL for the endpoint to which Crashlytics traces should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |

## CrashlyticsOptions.appVersion
Expand All @@ -36,14 +36,14 @@ The version of the application. This should be a unique string that identifies t
appVersion?: string;
```

## CrashlyticsOptions.loggingUrl
## CrashlyticsOptions.endpointUrl

The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase.

<b>Signature:</b>

```typescript
loggingUrl?: string;
endpointUrl?: string;
```

## CrashlyticsOptions.tracingUrl
Expand Down
6 changes: 3 additions & 3 deletions docs-devsite/crashlytics_react-router.crashlyticsoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface CrashlyticsOptions
| Property | Type | Description |
| --- | --- | --- |
| [appVersion](./crashlytics_react-router.crashlyticsoptions.md#crashlyticsoptionsappversion) | string | The version of the application. This should be a unique string that identifies the snapshot of code to be deployed, such as "1.0.2". If not specified, other default locations will be checked for an identifier. Setting a value here takes precedence over any other values. |
| [loggingUrl](./crashlytics_react-router.crashlyticsoptions.md#crashlyticsoptionsloggingurl) | string | The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |
| [endpointUrl](./crashlytics_react-router.crashlyticsoptions.md#crashlyticsoptionsendpointUrl) | string | The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |
| [tracingUrl](./crashlytics_react-router.crashlyticsoptions.md#crashlyticsoptionstracingurl) | string | The URL for the endpoint to which Crashlytics traces should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |

## CrashlyticsOptions.appVersion
Expand All @@ -36,14 +36,14 @@ The version of the application. This should be a unique string that identifies t
appVersion?: string;
```

## CrashlyticsOptions.loggingUrl
## CrashlyticsOptions.endpointUrl

The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase.

<b>Signature:</b>

```typescript
loggingUrl?: string;
endpointUrl?: string;
```

## CrashlyticsOptions.tracingUrl
Expand Down
6 changes: 3 additions & 3 deletions docs-devsite/crashlytics_react.crashlyticsoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface CrashlyticsOptions
| Property | Type | Description |
| --- | --- | --- |
| [appVersion](./crashlytics_react.crashlyticsoptions.md#crashlyticsoptionsappversion) | string | The version of the application. This should be a unique string that identifies the snapshot of code to be deployed, such as "1.0.2". If not specified, other default locations will be checked for an identifier. Setting a value here takes precedence over any other values. |
| [loggingUrl](./crashlytics_react.crashlyticsoptions.md#crashlyticsoptionsloggingurl) | string | The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |
| [endpointUrl](./crashlytics_react.crashlyticsoptions.md#crashlyticsoptionsendpointUrl) | string | The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |
| [tracingUrl](./crashlytics_react.crashlyticsoptions.md#crashlyticsoptionstracingurl) | string | The URL for the endpoint to which Crashlytics traces should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase. |

## CrashlyticsOptions.appVersion
Expand All @@ -36,14 +36,14 @@ The version of the application. This should be a unique string that identifies t
appVersion?: string;
```

## CrashlyticsOptions.loggingUrl
## CrashlyticsOptions.endpointUrl

The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format. By default, data will be sent to Firebase.

<b>Signature:</b>

```typescript
loggingUrl?: string;
endpointUrl?: string;
```

## CrashlyticsOptions.tracingUrl
Expand Down
34 changes: 17 additions & 17 deletions packages/crashlytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
"@firebase/app": "0.x",
"@firebase/app-types": "0.x",
"@types/react": ">= 16.8.0",
"next": ">= 13.0.0",
"react": ">= 16.8.0",
"react-router-dom": ">= 6.0.0",
"next": ">= 13.0.0"
"react-router-dom": ">= 6.0.0"
},
"peerDependenciesMeta": {
"react": {
Expand All @@ -116,21 +116,21 @@
"@firebase/component": "0.7.0",
"@firebase/installations": "0.6.19",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/api-logs": "0.212.0",
"@opentelemetry/core": "2.5.1",
"@opentelemetry/exporter-logs-otlp-http": "0.212.0",
"@opentelemetry/api-logs": "0.203.0",
"@opentelemetry/core": "2.1.0",
"@opentelemetry/exporter-logs-otlp-http": "0.203.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.212.0",
"@opentelemetry/instrumentation": "0.212.0",
"@opentelemetry/instrumentation-document-load": "0.57.0",
"@opentelemetry/instrumentation-fetch": "0.212.0",
"@opentelemetry/instrumentation-user-interaction": "0.56.0",
"@opentelemetry/otlp-exporter-base": "0.212.0",
"@opentelemetry/otlp-transformer": "0.212.0",
"@opentelemetry/resources": "2.5.1",
"@opentelemetry/sdk-logs": "0.212.0",
"@opentelemetry/sdk-trace-base": "2.5.1",
"@opentelemetry/sdk-trace-web": "2.5.1",
"@opentelemetry/semantic-conventions": "1.39.0",
"@opentelemetry/instrumentation": "0.55.0",
"@opentelemetry/instrumentation-document-load": "0.46.0",
"@opentelemetry/instrumentation-fetch": "0.55.0",
"@opentelemetry/instrumentation-user-interaction": "0.45.0",
"@opentelemetry/otlp-exporter-base": "0.205.0",
"@opentelemetry/otlp-transformer": "0.205.0",
"@opentelemetry/resources": "2.0.1",
"@opentelemetry/sdk-logs": "0.203.0",
"@opentelemetry/sdk-trace-base": "2.1.0",
"@opentelemetry/sdk-trace-web": "2.1.0",
"@opentelemetry/semantic-conventions": "1.36.0",
"tslib": "^2.1.0"
},
"license": "Apache-2.0",
Expand Down Expand Up @@ -174,4 +174,4 @@
],
"reportDir": "./coverage/node"
}
}
}
12 changes: 6 additions & 6 deletions packages/crashlytics/src/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,16 @@ describe('Top level API', () => {
);
});

it('works with options: loggingUrl set', () => {
it('works with options: endpointUrl set', () => {
const app = getFakeApp();
expect(getCrashlytics(app, { loggingUrl: 'http://endpoint1' })).to.equal(
getCrashlytics(app, { loggingUrl: 'http://endpoint1' })
expect(getCrashlytics(app, { endpointUrl: 'http://endpoint1' })).to.equal(
getCrashlytics(app, { endpointUrl: 'http://endpoint1' })
);
expect(
getCrashlytics(app, { loggingUrl: 'http://endpoint1' })
).not.to.equal(getCrashlytics(app, { loggingUrl: 'http://endpoint2' }));
getCrashlytics(app, { endpointUrl: 'http://endpoint1' })
).not.to.equal(getCrashlytics(app, { endpointUrl: 'http://endpoint2' }));
expect(
getCrashlytics(app, { loggingUrl: 'http://endpoint1' })
getCrashlytics(app, { endpointUrl: 'http://endpoint1' })
).not.to.equal(getCrashlytics(app, {}));
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/crashlytics/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function getCrashlytics(
app,
CRASHLYTICS_TYPE
);
const identifier = options?.loggingUrl || '';
const identifier = options?.endpointUrl || '';
const crashlytics: CrashlyticsService = crashlyticsProvider.getImmediate({
identifier
});
Expand Down
2 changes: 1 addition & 1 deletion packages/crashlytics/src/public-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface CrashlyticsOptions {
* The URL for the endpoint to which Crashlytics data should be sent, in the OpenTelemetry format.
* By default, data will be sent to Firebase.
*/
loggingUrl?: string;
endpointUrl?: string;

/**
* The URL for the endpoint to which Crashlytics traces should be sent, in the OpenTelemetry format.
Expand Down
4 changes: 3 additions & 1 deletion packages/crashlytics/src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export function registerCrashlytics(): void {

// TODO: change to default endpoint once it exists
const loggingUrl = instanceIdentifier || 'http://localhost';
const tracingUrl = instanceIdentifier || 'http://localhost';
// Traces will only be sent when running locally; change to instanceIdentifier once we can
// send trace data through the Crashlytics backend
const tracingUrl = 'http://localhost:4318';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Hardcoding tracingUrl to http://localhost:4318 will cause issues in non-local environments, as it will always try to send traces to localhost. The accompanying comment // Traces will only be sent when running locally suggests this is intended for local development only, but the implementation does not reflect this. This could lead to failed network requests and potential performance issues in production.

To ensure this URL is only used during development, you could make its value conditional based on the environment. For example:

const tracingUrl =
  process.env.NODE_ENV === 'development'
    ? 'http://localhost:4318'
    : instanceIdentifier || 'http://localhost';

This would use the local proxy URL for development and fall back to the previous behavior for other environments.

Suggested change
const tracingUrl = 'http://localhost:4318';
const tracingUrl = process.env.NODE_ENV === 'development' ? 'http://localhost:4318' : (instanceIdentifier || 'http://localhost');


// getImmediate for FirebaseApp will always succeed
const app = container.getProvider('app').getImmediate();
Expand Down
6 changes: 1 addition & 5 deletions packages/crashlytics/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
"outDir": "dist",
"jsx": "react",
"baseUrl": ".",
"paths": {
"@opentelemetry/exporter-trace-otlp-proto": [
"../../node_modules/@opentelemetry/exporter-trace-otlp-proto"
]
}
"paths": {}
},
"exclude": [
"dist/**/*"
Expand Down
Loading
Loading