-
Notifications
You must be signed in to change notification settings - Fork 168
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
WIP: Open Source Telemetry #2363
base: dev
Are you sure you want to change the base?
Conversation
|
WalkthroughThe recent updates involve enhancing the workflows service with telemetry capabilities, enabling the logging of login events to a Supabase database. This includes new environmental configurations for telemetry settings and the incorporation of the Supabase client within the codebase. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
PR Description updated to latest commit (e6d8242) |
PR Review 🔍
Code feedback:
|
PR Code Suggestions ✨
|
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!pnpm-lock.yaml
Files selected for processing (3)
- services/workflows-service/package.json (1 hunks)
- services/workflows-service/src/auth/local/local-auth.guard.ts (2 hunks)
- services/workflows-service/src/env.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- services/workflows-service/package.json
Additional comments not posted (3)
services/workflows-service/src/auth/local/local-auth.guard.ts (2)
4-5
: Ensure that the imports from@supabase/supabase-js
and '@/env' are used appropriately in the file.
26-26
: The return statement correctly passes the result from the parentcanActivate
method. Good use of explicit type casting to boolean.services/workflows-service/src/env.ts (1)
81-87
: The new telemetry-related environment variables are well-defined with appropriate validations and descriptions. Ensure that these variables are documented in the project's environment configuration guide.
if (env.TELEMETRY_ENABLED && env.TELEMETRY_SUPABASE_URL && env.TELEMETRY_SUPABASE_API_KEY) { | ||
const SupabaseClient = createClient( | ||
env.TELEMETRY_SUPABASE_URL, | ||
env.TELEMETRY_SUPABASE_API_KEY, | ||
); | ||
|
||
const fullUrl = `${request.protocol}://${request.get('Host')}${request.originalUrl}`; | ||
|
||
await SupabaseClient.schema('public') | ||
.from('logins') | ||
.insert([{ url: fullUrl }]); | ||
} |
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 telemetry logging logic is well-implemented with checks for necessary conditions. However, consider adding error handling around the Supabase client operations to manage potential failures gracefully.
+ try {
const SupabaseClient = createClient(
env.TELEMETRY_SUPABASE_URL,
env.TELEMETRY_SUPABASE_API_KEY,
);
const fullUrl = `${request.protocol}://${request.get('Host')}${request.originalUrl}`;
await SupabaseClient.schema('public')
.from('logins')
.insert([{ url: fullUrl }]);
+ } catch (error) {
+ console.error('Failed to log telemetry data:', error);
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if (env.TELEMETRY_ENABLED && env.TELEMETRY_SUPABASE_URL && env.TELEMETRY_SUPABASE_API_KEY) { | |
const SupabaseClient = createClient( | |
env.TELEMETRY_SUPABASE_URL, | |
env.TELEMETRY_SUPABASE_API_KEY, | |
); | |
const fullUrl = `${request.protocol}://${request.get('Host')}${request.originalUrl}`; | |
await SupabaseClient.schema('public') | |
.from('logins') | |
.insert([{ url: fullUrl }]); | |
} | |
if (env.TELEMETRY_ENABLED && env.TELEMETRY_SUPABASE_URL && env.TELEMETRY_SUPABASE_API_KEY) { | |
try { | |
const SupabaseClient = createClient( | |
env.TELEMETRY_SUPABASE_URL, | |
env.TELEMETRY_SUPABASE_API_KEY, | |
); | |
const fullUrl = `${request.protocol}://${request.get('Host')}${request.originalUrl}`; | |
await SupabaseClient.schema('public') | |
.from('logins') | |
.insert([{ url: fullUrl }]); | |
} catch (error) { | |
console.error('Failed to log telemetry data:', error); | |
} | |
} |
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- services/workflows-service/src/auth/local/local-auth.guard.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- services/workflows-service/src/auth/local/local-auth.guard.ts
PR Type
enhancement
Description
local-auth.guard.ts
.pnpm-lock.yaml
andpackage.json
to include necessary Supabase packages.Changes walkthrough 📝
local-auth.guard.ts
Integrate Supabase for Telemetry Tracking on Logins
services/workflows-service/src/auth/local/local-auth.guard.ts
env.ts
Add Telemetry Configuration Environment Variables
services/workflows-service/src/env.ts
pnpm-lock.yaml
Update Dependencies for Supabase Integration
pnpm-lock.yaml
package.json
Add Supabase JS SDK to Package Dependencies
services/workflows-service/package.json
@supabase/supabase-js
to package dependencies.Summary by CodeRabbit