grafana/pkg/services/pluginsintegration/angularinspector/angularinspector.go

29 lines
1.0 KiB
Go
Raw Normal View History

Plugins: Angular detector: Remote patterns fetching (#69843) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * Fix merge conflict on updated angular patterns * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * Moved dynamic inspector into pluginsintegration * Move gcom angulardetectorsprovider into pluginsintegration * Log errUnknownPatternType at debug level * re-generate feature flags * fix error log
2023-06-26 08:33:21 -05:00
package angularinspector
import (
"github.com/grafana/grafana/pkg/plugins/config"
"github.com/grafana/grafana/pkg/plugins/manager/loader/angular/angulardetector"
"github.com/grafana/grafana/pkg/plugins/manager/loader/angular/angularinspector"
"github.com/grafana/grafana/pkg/services/featuremgmt"
Plugins: Angular detector: Add database cache store for remote patterns (#70693) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * WIP: Angular: cache patterns in db, moved gcom into pluginsintegration More similar to signing keys fetching * Rename package, refactoring * try to solve circular import * Fix merge conflict on updated angular patterns * Fix circular imports * Fix wire gen * Add docstrings, refactoring * Removed angualrdetectorsprovider dependency into angularpatternsstore * Moved GCOM test files * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * refactoring * lint * Fix angularinspector TestProvideService * cleanup * Await initial restore * Register dynamicAngularDetector background service * Removed static detectors provider from pluginsintegration * Add tests for kvstore * Add more tests * order imports in dynamic_test.go * Fix potential panic in dynamic_test * Add "runs the job periodically" test * lint * add timeout to test * refactoring * Removed context.Context from DetectorsProvider * Refactoring, ensure angular dynamic background service is not started if feature flag is off * Fix deadlock on startup * Fix angulardetectorsprovider tests * Revert "Removed context.Context from DetectorsProvider" This reverts commit 4e8c6dded70844709400fa0ce4ce45e66c8458ca. * Fix wrong argument number in dynamic_teset * Standardize gcom http client * Reduce context timeout for angular inspector in plugins loader * Simplify initial restore logic * Fix dynamic detectors provider tests * Chore: removed angulardetector/provider.go * Add more tests * Removed backgroundJob interface, PR review feedback * Update tests * PR review feedback: remove ErrNoCachedValue from kv store Get * Update tests * PR review feedback: add IsDisabled and remove nop background srevice * Update tests * Remove initialRestore channel, use mux instead * Removed backgroundJobInterval, use package-level variable instead * Add TestDynamicAngularDetectorsProviderBackgroundService * Removed timeouts * pr review feedback: restore from store before returning the service * Update tests * Log duration on startup restore and cron run * Switch cron job start log to debug level * Do not attempt to restore if disabled
2023-07-06 09:34:27 -05:00
"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
Plugins: Angular detector: Remote patterns fetching (#69843) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * Fix merge conflict on updated angular patterns * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * Moved dynamic inspector into pluginsintegration * Move gcom angulardetectorsprovider into pluginsintegration * Log errUnknownPatternType at debug level * re-generate feature flags * fix error log
2023-06-26 08:33:21 -05:00
)
type Service struct {
angularinspector.Inspector
}
Plugins: Angular detector: Add database cache store for remote patterns (#70693) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * WIP: Angular: cache patterns in db, moved gcom into pluginsintegration More similar to signing keys fetching * Rename package, refactoring * try to solve circular import * Fix merge conflict on updated angular patterns * Fix circular imports * Fix wire gen * Add docstrings, refactoring * Removed angualrdetectorsprovider dependency into angularpatternsstore * Moved GCOM test files * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * refactoring * lint * Fix angularinspector TestProvideService * cleanup * Await initial restore * Register dynamicAngularDetector background service * Removed static detectors provider from pluginsintegration * Add tests for kvstore * Add more tests * order imports in dynamic_test.go * Fix potential panic in dynamic_test * Add "runs the job periodically" test * lint * add timeout to test * refactoring * Removed context.Context from DetectorsProvider * Refactoring, ensure angular dynamic background service is not started if feature flag is off * Fix deadlock on startup * Fix angulardetectorsprovider tests * Revert "Removed context.Context from DetectorsProvider" This reverts commit 4e8c6dded70844709400fa0ce4ce45e66c8458ca. * Fix wrong argument number in dynamic_teset * Standardize gcom http client * Reduce context timeout for angular inspector in plugins loader * Simplify initial restore logic * Fix dynamic detectors provider tests * Chore: removed angulardetector/provider.go * Add more tests * Removed backgroundJob interface, PR review feedback * Update tests * PR review feedback: remove ErrNoCachedValue from kv store Get * Update tests * PR review feedback: add IsDisabled and remove nop background srevice * Update tests * Remove initialRestore channel, use mux instead * Removed backgroundJobInterval, use package-level variable instead * Add TestDynamicAngularDetectorsProviderBackgroundService * Removed timeouts * pr review feedback: restore from store before returning the service * Update tests * Log duration on startup restore and cron run * Switch cron job start log to debug level * Do not attempt to restore if disabled
2023-07-06 09:34:27 -05:00
func ProvideService(cfg *config.Cfg, dynamic *angulardetectorsprovider.Dynamic) (*Service, error) {
var detectorsProvider angulardetector.DetectorsProvider
Plugins: Angular detector: Remote patterns fetching (#69843) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * Fix merge conflict on updated angular patterns * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * Moved dynamic inspector into pluginsintegration * Move gcom angulardetectorsprovider into pluginsintegration * Log errUnknownPatternType at debug level * re-generate feature flags * fix error log
2023-06-26 08:33:21 -05:00
var err error
Plugins: Angular detector: Add database cache store for remote patterns (#70693) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * WIP: Angular: cache patterns in db, moved gcom into pluginsintegration More similar to signing keys fetching * Rename package, refactoring * try to solve circular import * Fix merge conflict on updated angular patterns * Fix circular imports * Fix wire gen * Add docstrings, refactoring * Removed angualrdetectorsprovider dependency into angularpatternsstore * Moved GCOM test files * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * refactoring * lint * Fix angularinspector TestProvideService * cleanup * Await initial restore * Register dynamicAngularDetector background service * Removed static detectors provider from pluginsintegration * Add tests for kvstore * Add more tests * order imports in dynamic_test.go * Fix potential panic in dynamic_test * Add "runs the job periodically" test * lint * add timeout to test * refactoring * Removed context.Context from DetectorsProvider * Refactoring, ensure angular dynamic background service is not started if feature flag is off * Fix deadlock on startup * Fix angulardetectorsprovider tests * Revert "Removed context.Context from DetectorsProvider" This reverts commit 4e8c6dded70844709400fa0ce4ce45e66c8458ca. * Fix wrong argument number in dynamic_teset * Standardize gcom http client * Reduce context timeout for angular inspector in plugins loader * Simplify initial restore logic * Fix dynamic detectors provider tests * Chore: removed angulardetector/provider.go * Add more tests * Removed backgroundJob interface, PR review feedback * Update tests * PR review feedback: remove ErrNoCachedValue from kv store Get * Update tests * PR review feedback: add IsDisabled and remove nop background srevice * Update tests * Remove initialRestore channel, use mux instead * Removed backgroundJobInterval, use package-level variable instead * Add TestDynamicAngularDetectorsProviderBackgroundService * Removed timeouts * pr review feedback: restore from store before returning the service * Update tests * Log duration on startup restore and cron run * Switch cron job start log to debug level * Do not attempt to restore if disabled
2023-07-06 09:34:27 -05:00
static := angularinspector.NewDefaultStaticDetectorsProvider()
if cfg.Features != nil && cfg.Features.IsEnabledGlobally(featuremgmt.FlagPluginsDynamicAngularDetectionPatterns) {
Plugins: Angular detector: Add database cache store for remote patterns (#70693) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * WIP: Angular: cache patterns in db, moved gcom into pluginsintegration More similar to signing keys fetching * Rename package, refactoring * try to solve circular import * Fix merge conflict on updated angular patterns * Fix circular imports * Fix wire gen * Add docstrings, refactoring * Removed angualrdetectorsprovider dependency into angularpatternsstore * Moved GCOM test files * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * refactoring * lint * Fix angularinspector TestProvideService * cleanup * Await initial restore * Register dynamicAngularDetector background service * Removed static detectors provider from pluginsintegration * Add tests for kvstore * Add more tests * order imports in dynamic_test.go * Fix potential panic in dynamic_test * Add "runs the job periodically" test * lint * add timeout to test * refactoring * Removed context.Context from DetectorsProvider * Refactoring, ensure angular dynamic background service is not started if feature flag is off * Fix deadlock on startup * Fix angulardetectorsprovider tests * Revert "Removed context.Context from DetectorsProvider" This reverts commit 4e8c6dded70844709400fa0ce4ce45e66c8458ca. * Fix wrong argument number in dynamic_teset * Standardize gcom http client * Reduce context timeout for angular inspector in plugins loader * Simplify initial restore logic * Fix dynamic detectors provider tests * Chore: removed angulardetector/provider.go * Add more tests * Removed backgroundJob interface, PR review feedback * Update tests * PR review feedback: remove ErrNoCachedValue from kv store Get * Update tests * PR review feedback: add IsDisabled and remove nop background srevice * Update tests * Remove initialRestore channel, use mux instead * Removed backgroundJobInterval, use package-level variable instead * Add TestDynamicAngularDetectorsProviderBackgroundService * Removed timeouts * pr review feedback: restore from store before returning the service * Update tests * Log duration on startup restore and cron run * Switch cron job start log to debug level * Do not attempt to restore if disabled
2023-07-06 09:34:27 -05:00
detectorsProvider = angulardetector.SequenceDetectorsProvider{dynamic, static}
Plugins: Angular detector: Remote patterns fetching (#69843) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * Fix merge conflict on updated angular patterns * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * Moved dynamic inspector into pluginsintegration * Move gcom angulardetectorsprovider into pluginsintegration * Log errUnknownPatternType at debug level * re-generate feature flags * fix error log
2023-06-26 08:33:21 -05:00
} else {
Plugins: Angular detector: Add database cache store for remote patterns (#70693) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * WIP: Angular: cache patterns in db, moved gcom into pluginsintegration More similar to signing keys fetching * Rename package, refactoring * try to solve circular import * Fix merge conflict on updated angular patterns * Fix circular imports * Fix wire gen * Add docstrings, refactoring * Removed angualrdetectorsprovider dependency into angularpatternsstore * Moved GCOM test files * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * refactoring * lint * Fix angularinspector TestProvideService * cleanup * Await initial restore * Register dynamicAngularDetector background service * Removed static detectors provider from pluginsintegration * Add tests for kvstore * Add more tests * order imports in dynamic_test.go * Fix potential panic in dynamic_test * Add "runs the job periodically" test * lint * add timeout to test * refactoring * Removed context.Context from DetectorsProvider * Refactoring, ensure angular dynamic background service is not started if feature flag is off * Fix deadlock on startup * Fix angulardetectorsprovider tests * Revert "Removed context.Context from DetectorsProvider" This reverts commit 4e8c6dded70844709400fa0ce4ce45e66c8458ca. * Fix wrong argument number in dynamic_teset * Standardize gcom http client * Reduce context timeout for angular inspector in plugins loader * Simplify initial restore logic * Fix dynamic detectors provider tests * Chore: removed angulardetector/provider.go * Add more tests * Removed backgroundJob interface, PR review feedback * Update tests * PR review feedback: remove ErrNoCachedValue from kv store Get * Update tests * PR review feedback: add IsDisabled and remove nop background srevice * Update tests * Remove initialRestore channel, use mux instead * Removed backgroundJobInterval, use package-level variable instead * Add TestDynamicAngularDetectorsProviderBackgroundService * Removed timeouts * pr review feedback: restore from store before returning the service * Update tests * Log duration on startup restore and cron run * Switch cron job start log to debug level * Do not attempt to restore if disabled
2023-07-06 09:34:27 -05:00
detectorsProvider = static
Plugins: Angular detector: Remote patterns fetching (#69843) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * Fix merge conflict on updated angular patterns * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * Moved dynamic inspector into pluginsintegration * Move gcom angulardetectorsprovider into pluginsintegration * Log errUnknownPatternType at debug level * re-generate feature flags * fix error log
2023-06-26 08:33:21 -05:00
}
if err != nil {
return nil, err
}
return &Service{Inspector: angularinspector.NewPatternListInspector(detectorsProvider)}, nil
Plugins: Angular detector: Remote patterns fetching (#69843) * Plugins: Angular detector: Remote patterns fetching * Renamed PatternType to GCOMPatternType * Renamed files * Renamed more files * Moved files again * Add type checks, unexport GCOM structs * Cache failures, update log messages, fix GCOM URL * Fail silently for unknown pattern types, update docstrings * Fix tests * Rename gcomPattern.Value to gcomPattern.Pattern * Refactoring * Add FlagPluginsRemoteAngularDetectionPatterns feature flag * Fix tests * Re-generate feature flags * Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector * Add TestProvideInspector * Add TestContainsBytesDetector and TestRegexDetector * Renamed getter to provider * More tests * TestStaticDetectorsProvider, TestSequenceDetectorsProvider * GCOM tests * Lint * Made detector.detect unexported, updated docstrings * Allow changing grafana.com URL * Fix API path, add more logs * Update tryUpdateRemoteDetectors docstring * Use angulardetector http client * Return false, nil if module.js does not exist * Chore: Split angualrdetector into angularinspector and angulardetector packages Moved files around, changed references and fixed tests: - Split the old angulardetector package into angular/angulardetector and angular/angularinspector - angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...) - angularinspector provides the actual angular detection service used directly in pluginsintegration - Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector * Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go Forgot to rename those two files to match the package's names * Renamed angularinspector.ProvideInspector to angularinspector.ProvideService * Renamed "harcoded" to "static" and "remote" to "dynamic" from PR review, matches the same naming schema used for signing keys fetching * Fix merge conflict on updated angular patterns * Removed GCOM cache * Renamed Detect to DetectAngular and Detector to AngularDetector * Fix call to NewGCOMDetectorsProvider in newDynamicInspector * Removed unused test function newError500GCOMScenario * Added angularinspector service definition in pluginsintegration * Moved dynamic inspector into pluginsintegration * Move gcom angulardetectorsprovider into pluginsintegration * Log errUnknownPatternType at debug level * re-generate feature flags * fix error log
2023-06-26 08:33:21 -05:00
}