-
Notifications
You must be signed in to change notification settings - Fork 628
backport: logs to otel #1163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backport: logs to otel #1163
Conversation
fix: add implementationDependencies.json dependencies chore: build version and changelog fix: add missing config and devConfig entries
| public static void createLogEvent(Main main, TenantIdentifier tenantIdentifier, String logMessage, | ||
| String logLevel) { | ||
| getInstance(main).openTelemetry.getTracer("core-tracer") | ||
| .spanBuilder(logLevel) | ||
| .setParent(Context.current()) | ||
| .setAttribute("tenant.connectionUriDomain", tenantIdentifier.getConnectionUriDomain()) | ||
| .setAttribute("tenant.appId", tenantIdentifier.getAppId()) | ||
| .setAttribute("tenant.tenantId", tenantIdentifier.getTenantId()) | ||
| .startSpan() | ||
| .addEvent("log", | ||
| Attributes.builder() | ||
| .put("message", logMessage) | ||
| .build(), | ||
| System.currentTimeMillis(), TimeUnit.MILLISECONDS) | ||
| .end(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The createLogEvent method should include a null check for the instance returned by getInstance(main) to prevent potential NullPointerException. Consider adding a guard clause at the beginning:
if (getInstance(main) == null) {
return;
}This pattern would be consistent with other methods in the codebase that use similar null checks when accessing singleton resources.
| public static void createLogEvent(Main main, TenantIdentifier tenantIdentifier, String logMessage, | |
| String logLevel) { | |
| getInstance(main).openTelemetry.getTracer("core-tracer") | |
| .spanBuilder(logLevel) | |
| .setParent(Context.current()) | |
| .setAttribute("tenant.connectionUriDomain", tenantIdentifier.getConnectionUriDomain()) | |
| .setAttribute("tenant.appId", tenantIdentifier.getAppId()) | |
| .setAttribute("tenant.tenantId", tenantIdentifier.getTenantId()) | |
| .startSpan() | |
| .addEvent("log", | |
| Attributes.builder() | |
| .put("message", logMessage) | |
| .build(), | |
| System.currentTimeMillis(), TimeUnit.MILLISECONDS) | |
| .end(); | |
| } | |
| public static void createLogEvent(Main main, TenantIdentifier tenantIdentifier, String logMessage, | |
| String logLevel) { | |
| TelemetryProvider instance = getInstance(main); | |
| if (instance == null) { | |
| return; | |
| } | |
| instance.openTelemetry.getTracer("core-tracer") | |
| .spanBuilder(logLevel) | |
| .setParent(Context.current()) | |
| .setAttribute("tenant.connectionUriDomain", tenantIdentifier.getConnectionUriDomain()) | |
| .setAttribute("tenant.appId", tenantIdentifier.getAppId()) | |
| .setAttribute("tenant.tenantId", tenantIdentifier.getTenantId()) | |
| .startSpan() | |
| .addEvent("log", | |
| Attributes.builder() | |
| .put("message", logMessage) | |
| .build(), | |
| System.currentTimeMillis(), TimeUnit.MILLISECONDS) | |
| .end(); | |
| } |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
fix: add implementationDependencies.json dependencies
chore: build version and changelog
fix: add missing config and devConfig entries
Summary of change
(A few sentences about this PR)
Related issues
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
coreDriverInterfaceSupported.jsonfile has been updated (if needed)pluginInterfaceSupported.jsonfile has been updated (if needed)build.gradlegetPaidFeatureStatsfunction in FeatureFlag.java filebuild.gradle, please make sure to add themin
implementationDependencies.json.getValidFieldsinio/supertokens/config/CoreConfig.javaif new aliases were added for any coreconfig (similar to the
access_token_signing_key_update_intervalconfig alias).git tag) in the formatvX.Y.Z, and then find thelatest branch (
git branch --all) whoseX.Yis greater than the latest released tag.app_id_to_user_idtable, make sure to delete from this table when deletingthe user as well if
deleteUserIdMappingToois false.Remaining TODOs for this PR