-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(factory): introduce factories #6782
Conversation
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
1 similar comment
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Reviewed everything up to ae5ba2b in 1 minute and 44 seconds
More details
- Looked at
1775
lines of code in34
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. pkg/config/conf.go:28
- Draft comment:
The comment on line 28 is misleading. It should clarify that the function merges the input configuration at a specified path within the current configuration. - Reason this comment was not posted:
Confidence changes required:50%
The comment on line 28 incorrectly states that the function merges the current configuration with the input configuration. This is misleading as the function actually merges the input configuration at a specified path within the current configuration.
2. pkg/config/uri.go:10
- Draft comment:
The comment on line 10 is misleading. It should clarify that the regex matches a specific format of URI, not the entire URI definition. - Reason this comment was not posted:
Confidence changes required:50%
The comment on line 10 inpkg/config/uri.go
is misleading. It states that the regex complies with the URI definition, but it only matches a specific format of URI. This should be clarified.
3. pkg/web/config.go:10
- Draft comment:
The comment on line 10 is outdated. It should reflect that the Config satisfies the new config.Config interface, not confmap.Config. - Reason this comment was not posted:
Confidence changes required:50%
The comment on line 10 inpkg/web/config.go
is misleading. It states that the Config satisfies the confmap.Config interface, but it should be updated to reflect the new config.Config interface.
4. pkg/web/router/router.go:1
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_XloMbrlpzoO23qs6
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on 4c94386 in 1 minute and 31 seconds
More details
- Looked at
2466
lines of code in40
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. pkg/signoz/signoz.go:24
- Draft comment:
Add error handling for unrecognized cache providers to prevent potential nil pointer dereference. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
2. pkg/signoz/signoz.go:46
- Draft comment:
Add error handling for web initialization to prevent potential nil pointer dereference. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
3. pkg/signoz/signoz.go:57
- Draft comment:
Add error handling for sqlStore initialization to prevent potential nil pointer dereference. - Reason this comment was not posted:
Comment looked like it was already resolved.
4. pkg/query-service/app/server.go:27
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
Workflow ID: wflow_SdvgtI8IbXj32Z5C
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on 5d26d2b in 1 minute and 8 seconds
More details
- Looked at
170
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. pkg/query-service/app/integrations/manager.go:126
- Draft comment:
Removing error handling forNewInstalledIntegrationsSqliteRepo
can lead to runtime errors if the database is not properly initialized. Consider re-adding error handling to ensure robustness. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
- Without seeing NewInstalledIntegrationsSqliteRepo implementation, I can't be certain if it can fail. 2. The change suggests the function was modified to not return an error anymore. 3. If the function signature changed, then error handling would be unnecessary. 4. The code compiles, suggesting the function signature must have changed. 5. The PR author likely made this change intentionally after determining errors weren't possible.
I don't have access to the NewInstalledIntegrationsSqliteRepo implementation or its changes. The comment could be valid if that function can still fail at runtime.
Since the code compiles, the function signature must have changed to not return an error. The PR author likely determined error handling wasn't needed and simplified the API.
Without seeing the NewInstalledIntegrationsSqliteRepo implementation or its changes, I cannot verify if error handling is actually needed. The comment makes assumptions without full context.
2. pkg/query-service/app/integrations/test_utils.go:18
- Draft comment:
Removing error handling forNewInstalledIntegrationsSqliteRepo
can lead to runtime errors if the database is not properly initialized. Consider re-adding error handling to ensure robustness. This is also applicable inNewTestIntegrationsManager
. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
This is a test utility function, and test utilities often simplify error handling for cleaner tests. The database is created using NewQueryServiceDBForTests which likely handles setup validation. Since this is test code, a panic on initialization failure is actually preferable to error propagation. The comment seems to be applying production code standards to test code.
I could be wrong about the database initialization being validated in NewQueryServiceDBForTests. There could be valid reasons to handle errors even in test code.
Even if the database initialization isn't fully validated elsewhere, having a test utility panic on setup failure is a valid and common pattern - it fails fast and makes test failures more obvious.
The comment should be deleted as it's applying overly strict standards to test code where simplified error handling is acceptable and often preferred.
3. pkg/query-service/app/integrations/manager.go:126
- Draft comment:
TheNewInstalledIntegrationsSqliteRepo
function no longer returns an error, so the error handling inNewManager
is unnecessary and should be removed. - Reason this comment was not posted:
Comment looked like it was already resolved.
Workflow ID: wflow_BOx5CKlqmlQpyfHW
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on 0c3af05 in 1 minute and 5 seconds
More details
- Looked at
106
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. ee/query-service/app/server.go:210
- Draft comment:
The removal of the 'engine' parameter from theNewLogParsingPipelinesController
function call is consistent with the refactoring goal. Ensure that this parameter is not used elsewhere in the function. - Reason this comment was not posted:
Confidence changes required:20%
The removal of the 'engine' parameter from the function signature is consistent across all instances where the function is called. This change aligns with the refactoring goal of removing unnecessary parameters.
2. pkg/query-service/agentConf/manager.go:42
- Draft comment:
The removal of the 'DBEngine' field from theManagerOptions
struct is consistent with the refactoring goal. Ensure that this field is not used elsewhere in the code. - Reason this comment was not posted:
Confidence changes required:20%
The removal of the 'DBEngine' field from theManagerOptions
struct is consistent across all instances where the struct is used. This change aligns with the refactoring goal of removing unnecessary fields.
3. pkg/query-service/app/logparsingpipeline/controller.go:30
- Draft comment:
The removal of the 'engine' parameter from theNewLogParsingPipelinesController
function call is consistent with the refactoring goal. Ensure that this parameter is not used elsewhere in the function. - Reason this comment was not posted:
Confidence changes required:20%
The removal of the 'engine' parameter from the function signature is consistent across all instances where the function is called. This change aligns with the refactoring goal of removing unnecessary parameters.
4. pkg/query-service/tests/integration/logparsingpipeline_test.go:487
- Draft comment:
The removal of the 'DBEngine' field from theManagerOptions
struct is consistent with the refactoring goal. Ensure that this field is not used elsewhere in the code. - Reason this comment was not posted:
Confidence changes required:20%
The removal of the 'DBEngine' field from theManagerOptions
struct is consistent across all instances where the struct is used. This change aligns with the refactoring goal of removing unnecessary fields.
5. pkg/query-service/app/server.go:174
- Draft comment:
Avoid using inline styles in React components. Use external stylesheets, CSS classes, or styled components instead. This is also applicable in other parts of the code where inline styles are used. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
Workflow ID: wflow_8M11gtu6Fo1lD3Vp
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on e1cb905 in 38 seconds
More details
- Looked at
241
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. pkg/sqlstore/config.go:36
- Draft comment:
The increase inMaxOpenConns
from 10 to 100 should be justified. Ensure the system can handle this increase without resource exhaustion. - Reason this comment was not posted:
Confidence changes required:50%
The change inMaxOpenConns
from 10 to 100 inpkg/sqlstore/config.go
is significant and should be justified. Increasing the number of open connections can improve performance by allowing more concurrent database operations, but it can also lead to resource exhaustion if not managed properly. It's important to ensure that the system can handle this increase without negative side effects.
2. pkg/sqlstore/provider/sqlite/provider.go:33
- Draft comment:
The log message includes?_foreign_keys=true
in the path, which might be misleading as it's not part of the actual connection string. Consider aligning the log message with the actual connection string or explaining the discrepancy. - Reason this comment was not posted:
Confidence changes required:50%
The connection string for SQLite inpkg/sqlstore/provider/sqlite/provider.go
includes?_foreign_keys=true
in the log message but not in the actual connection string. This could lead to confusion as the log message suggests foreign keys are enabled by default, which is not the case unless explicitly set in the connection string or via PRAGMA command.
3. pkg/sqlstore/provider/sqlite/provider.go:5
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_WX037G8SS8Azkp3M
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on 2060905 in 36 seconds
More details
- Looked at
75
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. pkg/sqlstore/provider/sqlite/provider.go:30
- Draft comment:
The refactor removed the explicit enabling of foreign key support usingPRAGMA foreign_keys = ON;
. Ensure that foreign key constraints are enforced as expected, as SQLite does not enable them by default. - Reason this comment was not posted:
Comment did not seem useful.
2. pkg/sqlstore/provider/sqlite/provider.go:30
- Draft comment:
Avoid using inline styles in React components. Use external stylesheets, CSS classes, or styled components instead. This comment applies to other instances of inline styles in the code as well. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_iCItnw1uPH1tsZFP
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
2060905
to
e9decec
Compare
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on e9decec in 37 seconds
More details
- Looked at
76
lines of code in4
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. pkg/query-service/utils/testutils.go:18
- Draft comment:
The functionNewQueryServiceDBForTests
is a good refactor as it encapsulates the setup of a test database, including migrations and DAO initialization, providing a cleaner and more reliable test setup. - Reason this comment was not posted:
Confidence changes required:0%
The functionNewQueryServiceDBForTests
inpkg/query-service/utils/testutils.go
is responsible for setting up a test database. It creates a temporary SQLite database file, initializes the SQL store, runs migrations, and initializes the DAO and dashboards. This function is used in the test files to provide a test database instance. The refactoring seems to replace the previousNewTestSqliteDB
function with this new function, which is more comprehensive and encapsulates the setup process better.
2. ee/query-service/app/server.go:206
- Draft comment:
Refactored to usesignoz.SqlStore.Provider().SqlxDB()
for initializingcloudIntegrationsController
, which centralizes database access and reduces redundancy. - Reason this comment was not posted:
Confidence changes required:0%
The refactor inee/query-service/app/server.go
andpkg/query-service/app/server.go
changes the way thecloudIntegrationsController
is initialized. It now usessignoz.SqlStore.Provider().SqlxDB()
instead oflocalDB
. This change aligns with the refactor goal of removing upstream dependencies and centralizing the database access throughsignoz.SqlStore
. This is a positive change as it reduces redundancy and potential inconsistencies in database access.
3. pkg/query-service/app/cloudintegrations/controller_test.go:15
- Draft comment:
ReplacedNewTestSqliteDB
withNewQueryServiceDBForTests
for better encapsulation of test database setup, improving test reliability. - Reason this comment was not posted:
Confidence changes required:0%
The refactor inpkg/query-service/app/cloudintegrations/controller_test.go
replacesNewTestSqliteDB
withNewQueryServiceDBForTests
. This change is consistent with the refactor goal of centralizing test database setup. The new function encapsulates the setup process better, including migrations and DAO initialization, which improves test reliability.
4. pkg/query-service/app/server.go:177
- Draft comment:
Refactored to usesignoz.SqlStore.Provider().SqlxDB()
for initializingcloudIntegrationsController
, aligning with the goal of centralizing database access. - Reason this comment was not posted:
Confidence changes required:0%
The refactor inpkg/query-service/app/server.go
changes the initialization ofcloudIntegrationsController
to usesignoz.SqlStore.Provider().SqlxDB()
. This aligns with the refactor goal of centralizing database access and removing upstream dependencies, which is a positive change for maintainability and consistency.
Workflow ID: wflow_5fjNCUa3QKXZ0UzS
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on 50a06d1 in 48 seconds
More details
- Looked at
71
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. pkg/sqlstore/migrations/007_add_integrations.go:37
- Draft comment:
Consider implementing theDown
method to make the migration reversible. This will help in rolling back the migration if needed. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
2. pkg/sqlstore/migrations/007_add_integrations.go:40
- Draft comment:
Do not add non-ClickHouse related functions to the ClickHouseReader interface. Use the DAO in the telemetry instance to access such information instead. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
Workflow ID: wflow_DU2eZElvH4qeMJOr
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
e35d1c2
to
288747a
Compare
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
1 similar comment
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on e35d1c2 in 1 minute and 26 seconds
More details
- Looked at
2165
lines of code in41
files - Skipped
0
files when reviewing. - Skipped posting
6
drafted comments based on config settings.
1. ee/query-service/app/server.go:115
- Draft comment:
The refactoring replacesSqlStore.Provider().SqlxDB()
withSQLStore.SQLxDB()
. Ensure that this change is consistent across the codebase and aligns with the refactoring goal to remove upstream dependencies. - Reason this comment was not posted:
Confidence changes required:20%
The refactoring seems to have removed theSqlStore.Provider().SqlxDB()
calls and replaced them withSQLStore.SQLxDB()
. This change is consistent across the files and aligns with the refactoring goal to remove upstream dependencies.
2. ee/query-service/main.go:148
- Draft comment:
The introduction of theinstrumentation
package and its usage to create anInstrumentation
instance is a good practice. It modularizes the code and separates concerns. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring introduces a newinstrumentation
package and uses it to create anInstrumentation
instance. This is a good practice as it modularizes the code and separates concerns.
3. pkg/cache/config.go:28
- Draft comment:
The introduction of thefactory
package to handle configuration and provider creation centralizes the creation logic and makes the code more maintainable. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring introduces a newfactory
package to handle configuration and provider creation. This is a good practice as it centralizes the creation logic and makes the code more maintainable.
4. pkg/sqlstore/config.go:30
- Draft comment:
The introduction of thefactory
package to handle configuration and provider creation centralizes the creation logic and makes the code more maintainable. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring introduces a newfactory
package to handle configuration and provider creation. This is a good practice as it centralizes the creation logic and makes the code more maintainable.
5. pkg/web/config.go:18
- Draft comment:
The introduction of thefactory
package to handle configuration and provider creation centralizes the creation logic and makes the code more maintainable. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring introduces a newfactory
package to handle configuration and provider creation. This is a good practice as it centralizes the creation logic and makes the code more maintainable.
6. pkg/signoz/config.go:22
- Draft comment:
The introduction of thefactory
package to handle configuration and provider creation centralizes the creation logic and makes the code more maintainable. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring introduces a newfactory
package to handle configuration and provider creation. This is a good practice as it centralizes the creation logic and makes the code more maintainable.
Workflow ID: wflow_B18PCoTALM59wbck
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on 288747a in 1 minute and 41 seconds
More details
- Looked at
2165
lines of code in41
files - Skipped
0
files when reviewing. - Skipped posting
6
drafted comments based on config settings.
1. ee/query-service/app/server.go:115
- Draft comment:
Refactored to usesignoz.SQLStore.SQLxDB()
instead ofsignoz.SqlStore.Provider().SqlxDB()
, which aligns with the refactoring goal to remove the dependency onopentelemetry-collector
. This change is applied consistently across the files. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring of theNewServer
function inee/query-service/app/server.go
andpkg/query-service/app/server.go
is consistent with the intent to remove the dependency onopentelemetry-collector
. The changes involve usingsignoz.SQLStore.SQLxDB()
instead ofsignoz.SqlStore.Provider().SqlxDB()
, which aligns with the refactoring goal. This change is applied consistently across the files.
2. pkg/query-service/main.go:91
- Draft comment:
Refactored to initializeinstrumentation
andsignoz
using the new factory pattern, which aligns with the refactoring goal to remove the dependency onopentelemetry-collector
. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring inpkg/query-service/main.go
andee/query-service/main.go
involves initializing theinstrumentation
andsignoz
instances with the new factory pattern. This change is consistent with the refactoring goal to remove the dependency onopentelemetry-collector
. The initialization ofinstrumentation
andsignoz
is done using the newNewProviderFactories
method, which is a part of the refactoring.
3. pkg/cache/provider/memory/memory.go:18
- Draft comment:
Introduced a new factory pattern for creating cache providers usingNewFactory
, which aligns with the refactoring goal to remove the dependency onopentelemetry-collector
. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring inpkg/cache/provider/memory/memory.go
introduces a new factory pattern for creating cache providers. This change is consistent with the refactoring goal to remove the dependency onopentelemetry-collector
. TheNewFactory
function is used to create a new provider factory for the memory cache, which aligns with the new factory pattern.
4. pkg/sqlstore/provider/sqlite/sqlite.go:23
- Draft comment:
Introduced a new factory pattern for creating SQL store providers usingNewFactory
, which aligns with the refactoring goal to remove the dependency onopentelemetry-collector
. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring inpkg/sqlstore/provider/sqlite/sqlite.go
introduces a new factory pattern for creating SQL store providers. This change is consistent with the refactoring goal to remove the dependency onopentelemetry-collector
. TheNewFactory
function is used to create a new provider factory for the SQLite provider, which aligns with the new factory pattern.
5. pkg/sqlstore/migrations/migrations.go:19
- Draft comment:
Refactored to use the new factory pattern for creating migration instances usingNamedMap
, which aligns with the refactoring goal to remove the dependency onopentelemetry-collector
. - Reason this comment was not posted:
Confidence changes required:10%
The refactoring inpkg/sqlstore/migrations/migrations.go
involves using the new factory pattern for creating migration instances. This change is consistent with the refactoring goal to remove the dependency onopentelemetry-collector
. TheNew
function now uses theNamedMap
to get migration factories, which aligns with the new factory pattern.
6. pkg/query-service/app/server.go:98
- Draft comment:
Avoid using inline styles in React components. Use external stylesheets, CSS classes, or styled components instead. This is also applicable at line 115, 153, 170, and 233. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_Nm8s5l6BS2KSoR9s
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on 6a7975a in 51 seconds
More details
- Looked at
216
lines of code in4
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. ee/query-service/main.go:94
- Draft comment:
The removal of theenableQueryServiceLogOTLPExport
flag and related logic changes the functionality. Ensure this is intended and documented. - Reason this comment was not posted:
Confidence changes required:50%
The PR refactors the logging setup by removing the custom initialization and using the logger from the instrumentation package. This is a good change as it centralizes logging configuration. However, the removal of theenableQueryServiceLogOTLPExport
flag and related logic should be noted as it changes the functionality.
2. pkg/query-service/main.go:87
- Draft comment:
The removal of theinitZapLog
function changes the logging setup. Ensure this is intended and documented. - Reason this comment was not posted:
Confidence changes required:50%
The PR refactors the logging setup by removing the custom initialization and using the logger from the instrumentation package. This is a good change as it centralizes logging configuration. However, the removal of theinitZapLog
function should be noted as it changes the logging setup.
Workflow ID: wflow_QCSU5FCHm6TrL9Jd
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
33bbc96
to
63a7ae5
Compare
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on 63a7ae5 in 1 minute and 51 seconds
More details
- Looked at
37
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. go.sum:947
- Draft comment:
The go.sum file contains future-dated versions (e.g.,golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
). This is likely incorrect and should be reviewed. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_LzwDg7J55QrHpI77
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
I tried to review, but I am getting lost.
From what is seems,it feels like separate pr's can be created.
MaxOpenConns: 100, | ||
}, | ||
Sqlite: SqliteConfig{ | ||
Path: "/var/lib/signoz/signoz.db", |
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.
env variables ?
return err | ||
} | ||
|
||
if _, err := db.ExecContext(ctx, `CREATE TABLE IF NOT EXISTS cloud_integrations_accounts( |
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.
since these are already known things, I guess we can club this all to the 001_migration_squashed
, anything new can be added as a new migration.
} | ||
|
||
var config Config | ||
if err := conf.Unmarshal("", &config); err != nil { |
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.
what is the use of this ?
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on fae0581 in 3 minutes and 0 seconds
More details
- Looked at
1071
lines of code in30
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. ee/query-service/main.go:14
- Draft comment:
The import aliassignozconfig
is not used and can be removed to clean up the code. - Reason this comment was not posted:
Confidence changes required:50%
The import path forenvprovider
has been changed in the PR, but the import aliassignozconfig
is no longer used. This alias should be removed to clean up the code.
2. pkg/query-service/main.go:12
- Draft comment:
The import aliassignozconfig
is not used and can be removed to clean up the code. - Reason this comment was not posted:
Confidence changes required:50%
The import path forenvprovider
has been changed in the PR, but the import aliassignozconfig
is no longer used. This alias should be removed to clean up the code.
3. pkg/cache/memorycache/memory.go:1
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. This is applicable in other files likepkg/cache/memorycache/memory_test.go
,pkg/cache/rediscache/redis.go
,pkg/cache/rediscache/redis_test.go
, etc. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_cSrKC9rVGdSO4JMv
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on b10a906 in 1 minute and 21 seconds
More details
- Looked at
72
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. pkg/signoz/provider.go:10
- Draft comment:
The import path formigrations
should be updated to"go.signoz.io/signoz/pkg/sqlstoremigrator/migrations"
to maintain consistency with other files. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. pkg/query-service/utils/testutils.go:16
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. This is applicable to thepkg/sqlstoremigrator/migrations/003_add_dashboards.go
file and other similar files. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_SaHPzgkMPBEqAJw7
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
path := filepath.Join(web.config.Directory, req.URL.Path) | ||
|
||
// check whether a file exists or is a directory at the given path | ||
fi, err := os.Stat(path) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 12 days ago
To fix the problem, we need to ensure that the user-provided path is validated and sanitized before it is used to construct a file path. Specifically, we should:
- Resolve the user-provided path relative to a safe base directory.
- Ensure that the resolved path is still within the intended directory to prevent directory traversal attacks.
We will modify the ServeHTTP
function to include these checks.
-
Copy modified lines R77-R82 -
Copy modified line R85
@@ -76,7 +76,11 @@ | ||
func (web *router) ServeHTTP(rw http.ResponseWriter, req *http.Request) { | ||
// Join internally call path.Clean to prevent directory traversal | ||
path := filepath.Join(web.config.Directory, req.URL.Path) | ||
// Resolve the user-provided path relative to the base directory | ||
absPath, err := filepath.Abs(filepath.Join(web.config.Directory, req.URL.Path)) | ||
if err != nil || !strings.HasPrefix(absPath, web.config.Directory) { | ||
http.Error(rw, "Invalid file path", http.StatusBadRequest) | ||
return | ||
} | ||
|
||
// check whether a file exists or is a directory at the given path | ||
fi, err := os.Stat(path) | ||
fi, err := os.Stat(absPath) | ||
if os.IsNotExist(err) || fi.IsDir() { |
Summary
feat(pkg/factory)
refactor(pkg/config)
factory
andprovider
patterns inpkg/config
andpkg/factory
.opentelemetry-collector
.NewConfigFactory
andNewProviderFactory
for modular configuration.feat(pkg/sqlstore)
sqlstore
andmigrations
.query-service
to use this new package.feat(pkg/web)
noop
provider inweb
ENABLED
to web.refactor(pkg/instrumentation)
Important
Introduce factory-based initialization, refactor configuration and database setup, and update web and instrumentation components.
pkg/factory
.pkg/config
to usefactory
andprovider
patterns.NewConfigFactory
andNewProviderFactory
for modular configuration.pkg/sqlstore
to usesqlstore
andmigrations
.pkg/sqlstoremigrator/migrations
.dao
andsqlite
packages to use new database initialization.noop
provider inpkg/web
and addENABLED
config.pkg/instrumentation
.pkg/query-service/tests/integration
to align with new initialization.NewQueryServiceDBForTests
inpkg/query-service/utils/testutils.go
to use new factory system.This description was created by for b10a906. It will automatically update as commits are pushed.