Skip to content

Conversation

tamassoltesz
Copy link
Contributor

Summary of change

(A few sentences about this PR)

Related issues

  • Link to issue1 here
  • Link to issue1 here

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your
changes work. Bonus points for screenshots and videos!)

Documentation changes

(If relevant, please create a PR in our docs repo, or create a checklist here
highlighting the necessary changes)

Checklist for important updates

  • Changelog has been updated
    • If there are any db schema changes, mention those changes clearly
  • coreDriverInterfaceSupported.json file has been updated (if needed)
  • pluginInterfaceSupported.json file has been updated (if needed)
  • Changes to the version if needed
    • In build.gradle
  • If added a new paid feature, edit the getPaidFeatureStats function in FeatureFlag.java file
  • Had installed and ran the pre-commit hook
  • If there are new dependencies that have been added in build.gradle, please make sure to add them
    in implementationDependencies.json.
  • Update function getValidFields in io/supertokens/config/CoreConfig.java if new aliases were added for any core
    config (similar to the access_token_signing_key_update_interval config alias).
  • Issue this PR against the latest non released version branch.
    • To know which one it is, run find the latest released tag (git tag) in the format vX.Y.Z, and then find the
      latest branch (git branch --all) whose X.Y is greater than the latest released tag.
    • If no such branch exists, then create one from the latest released branch.
  • If added a foreign key constraint on app_id_to_user_id table, make sure to delete from this table when deleting
    the user as well if deleteUserIdMappingToo is false.
  • If added a new recipe, then make sure to update the bulk import API to include the new recipe.

Remaining TODOs for this PR

  • Item1
  • Item2

Comment on lines 114 to +118
if (getInstance(main) != null) {
getInstance(main).infoLogger.debug(getFormattedMessage(tenantIdentifier, msg));
String formattedMsg = getFormattedMessage(tenantIdentifier, msg);
getInstance(main).infoLogger.debug(formattedMsg);
TelemetryProvider.createLogEvent(main, tenantIdentifier, formattedMsg, "debug");
Copy link
Contributor

Choose a reason for hiding this comment

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

There appears to be duplicate code in the debug method that creates the formatted message twice. Consider storing the formatted message in a variable once and reusing it:

String formattedMsg = getFormattedMessage(tenantIdentifier, msg);
getInstance(main).infoLogger.debug(formattedMsg);
TelemetryProvider.createLogEvent(main, tenantIdentifier, formattedMsg, "debug");

This would improve efficiency and ensure consistency between the logged message and the telemetry event.

Suggested change
if (getInstance(main) != null) {
getInstance(main).infoLogger.debug(getFormattedMessage(tenantIdentifier, msg));
String formattedMsg = getFormattedMessage(tenantIdentifier, msg);
getInstance(main).infoLogger.debug(formattedMsg);
TelemetryProvider.createLogEvent(main, tenantIdentifier, formattedMsg, "debug");
if (getInstance(main) != null) {
String formattedMsg = getFormattedMessage(tenantIdentifier, msg);
getInstance(main).infoLogger.debug(formattedMsg);
TelemetryProvider.createLogEvent(main, tenantIdentifier, formattedMsg, "debug");

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@sattvikc sattvikc merged commit 678680e into 10.1 Aug 18, 2025
32 of 33 checks passed
@sattvikc sattvikc deleted the feat/logs_to_telemetry_backport branch August 18, 2025 08:38
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.

3 participants