Skip to content

Conversation

@andrewbrook
Copy link

@andrewbrook andrewbrook commented Nov 18, 2025

Discussion

Adds a new "auto-constants" file that is not bundled into the index.js output. It can optionally be overwritten during the application's build process to automatically set "app version" based on context (eg. git commit hash, deployment id, etc.).

Testing

Unit tested, manually tested

API Changes

n/a

@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2025

⚠️ No Changeset found

Latest commit: ad7a709

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 18, 2025

Size Report 1

Affected Products

  • @firebase/telemetry

    TypeBase (ad0366b)Merge (92e7f03)Diff
    browser8.61 kB8.80 kB+192 B (+2.2%)
    main7.99 kB8.74 kB+755 B (+9.5%)
    module8.61 kB8.80 kB+192 B (+2.2%)
  • firebase

    TypeBase (ad0366b)Merge (92e7f03)Diff
    firebase-telemetry.js88.1 kB88.2 kB+103 B (+0.1%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/o0pW5HQOQE.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 18, 2025

Size Analysis Report 1

Affected Products

  • @firebase/telemetry

    • captureError

      Size

      TypeBase (ad0366b)Merge (92e7f03)Diff
      size5.17 kB5.29 kB+117 B (+2.3%)
      size-with-ext-deps64.5 kB64.7 kB+123 B (+0.2%)

      Dependency

      TypeBase (ad0366b)Merge (92e7f03)Diff
      functions

      captureError
      createLoggerProvider
      isExportRetryable
      parseRetryAfterToMills
      registerTelemetry

      captureError
      createLoggerProvider
      getAppVersion
      getSessionId
      isExportRetryable
      parseRetryAfterToMills
      registerTelemetry

      + getAppVersion
      + getSessionId

      variables

      LOG_ENTRY_ATTRIBUTE_KEYS
      TELEMETRY_SESSION_ID_KEY
      TELEMETRY_TYPE
      name
      version

      AUTO_CONSTANTS
      LOG_ENTRY_ATTRIBUTE_KEYS
      TELEMETRY_SESSION_ID_KEY
      TELEMETRY_TYPE
      name
      version

      + AUTO_CONSTANTS

    • nextOnRequestError

      Size

      TypeBase (ad0366b)Merge (92e7f03)Diff
      size5.54 kB5.66 kB+117 B (+2.1%)
      size-with-ext-deps71.9 kB72.0 kB+123 B (+0.2%)

      Dependency

      TypeBase (ad0366b)Merge (92e7f03)Diff
      functions

      captureError
      createLoggerProvider
      getTelemetry
      isExportRetryable
      nextOnRequestError
      parseRetryAfterToMills
      registerTelemetry

      captureError
      createLoggerProvider
      getAppVersion
      getSessionId
      getTelemetry
      isExportRetryable
      nextOnRequestError
      parseRetryAfterToMills
      registerTelemetry

      + getAppVersion
      + getSessionId

      variables

      LOG_ENTRY_ATTRIBUTE_KEYS
      TELEMETRY_SESSION_ID_KEY
      TELEMETRY_TYPE
      name
      version

      AUTO_CONSTANTS
      LOG_ENTRY_ATTRIBUTE_KEYS
      TELEMETRY_SESSION_ID_KEY
      TELEMETRY_TYPE
      name
      version

      + AUTO_CONSTANTS

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/F0QfXdMYO0.html

@andrewbrook andrewbrook marked this pull request as ready for review November 20, 2025 15:53
@andrewbrook andrewbrook requested a review from a team as a code owner November 20, 2025 15:53
Copy link
Contributor

@hsubox76 hsubox76 left a comment

Choose a reason for hiding this comment

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

Might be overcautious with that comment but worth a double check. I think almost all build pipelines can process CJS but not sure if there are problems when both CJS and ESM files come from the same dependency.

Also this won't be available for CDN users: https://firebase.google.com/docs/web/alt-setup so that's something to keep in mind - I think it's fine, but we need to document it and tell CDN users to just hardcode it into the init options, and this autoconstants route won't be an option for them.

@andrewbrook andrewbrook merged commit ff5b3a3 into telemetry Nov 20, 2025
45 checks passed
@andrewbrook andrewbrook deleted the telemetry_gh branch November 20, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants