Documentation
¶
Index ¶
- func DetectLanguageForFile(filePath string) (string, error)
- func DetectLanguages(rootPath string) (map[string]string, error)
- type Analysis
- type CodebaseAnalyzer
- type DirectoryAnalysis
- type IssueDetector
- type KnowledgeBasedInstrumentationService
- func (s *KnowledgeBasedInstrumentationService) Close() error
- func (s *KnowledgeBasedInstrumentationService) GetBreakingChanges(ctx context.Context, pkg domain.Package) ([]types.BreakingChange, error)
- func (s *KnowledgeBasedInstrumentationService) GetCompatibleVersions(ctx context.Context, pkg domain.Package) ([]types.CompatibleComponent, error)
- func (s *KnowledgeBasedInstrumentationService) GetInstrumentation(ctx context.Context, pkg domain.Package) (*domain.InstrumentationInfo, error)
- func (s *KnowledgeBasedInstrumentationService) GetLatestVersion(ctx context.Context, pkg domain.Package) (*types.Version, error)
- func (s *KnowledgeBasedInstrumentationService) GetRecommendedInstrumentations(ctx context.Context, pkg domain.Package) ([]domain.InstrumentationInfo, error)
- type Language
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectLanguageForFile ¶
Types ¶
type Analysis ¶
type Analysis struct {
RootPath string `json:"root_path"`
DirectoryAnalyses map[string]*DirectoryAnalysis `json:"directory_analyses"`
}
Analysis contains the results of language detection and library discovery
type CodebaseAnalyzer ¶
type CodebaseAnalyzer struct {
// contains filtered or unexported fields
}
CodebaseAnalyzer coordinates the detection process
func NewCodebaseAnalyzer ¶
func NewCodebaseAnalyzer(detectors []IssueDetector, languages map[string]Language, storageClient *storage.Storage, logger logger.Logger) *CodebaseAnalyzer
NewCodebaseAnalyzer creates a new analysis engine
func (*CodebaseAnalyzer) AnalyzeCodebase ¶
func (ca *CodebaseAnalyzer) AnalyzeCodebase(ctx context.Context, rootPath string) (*Analysis, error)
AnalyzeCodebase performs the full analysis
type DirectoryAnalysis ¶
type DirectoryAnalysis struct {
Directory string `json:"directory"`
FullPath string `json:"full_path"`
Language string `json:"language"`
Libraries []domain.Library `json:"libraries"`
Packages []domain.Package `json:"packages"`
AvailableInstrumentations []domain.InstrumentationInfo `json:"available_instrumentations"`
Issues []domain.Issue `json:"issues"`
}
DirectoryAnalysis contains analysis results for a specific directory
type IssueDetector ¶
type IssueDetector interface {
// ID returns a unique identifier for this detector
ID() string
// Name returns a human-readable name
Name() string
// Description returns what this detector looks for
Description() string
// Category returns the issue category
Category() domain.Category
// Languages returns which languages this detector applies to (empty = all)
Languages() []string
// Detect finds issues in the given context
Detect(ctx context.Context, analysis *DirectoryAnalysis) ([]domain.Issue, error)
}
IssueDetector defines how to detect specific issues
type KnowledgeBasedInstrumentationService ¶
type KnowledgeBasedInstrumentationService struct {
// contains filtered or unexported fields
}
KnowledgeBasedInstrumentationService integrates the new knowledge base with the detector system
func NewKnowledgeBasedInstrumentationService ¶
func NewKnowledgeBasedInstrumentationService(storageClient *storage.Storage, logger logger.Logger) *KnowledgeBasedInstrumentationService
NewKnowledgeBasedInstrumentationService creates a new knowledge-based instrumentation service
func (*KnowledgeBasedInstrumentationService) Close ¶
func (s *KnowledgeBasedInstrumentationService) Close() error
Close closes the underlying storage connection
func (*KnowledgeBasedInstrumentationService) GetBreakingChanges ¶
func (s *KnowledgeBasedInstrumentationService) GetBreakingChanges(ctx context.Context, pkg domain.Package) ([]types.BreakingChange, error)
GetBreakingChanges returns breaking changes for a given package
func (*KnowledgeBasedInstrumentationService) GetCompatibleVersions ¶
func (s *KnowledgeBasedInstrumentationService) GetCompatibleVersions(ctx context.Context, pkg domain.Package) ([]types.CompatibleComponent, error)
GetCompatibleVersions returns compatible versions for a given package
func (*KnowledgeBasedInstrumentationService) GetInstrumentation ¶
func (s *KnowledgeBasedInstrumentationService) GetInstrumentation(ctx context.Context, pkg domain.Package) (*domain.InstrumentationInfo, error)
GetInstrumentation finds instrumentation information using the knowledge base
func (*KnowledgeBasedInstrumentationService) GetLatestVersion ¶
func (s *KnowledgeBasedInstrumentationService) GetLatestVersion(ctx context.Context, pkg domain.Package) (*types.Version, error)
GetLatestVersion returns the latest stable version of a package
func (*KnowledgeBasedInstrumentationService) GetRecommendedInstrumentations ¶
func (s *KnowledgeBasedInstrumentationService) GetRecommendedInstrumentations(ctx context.Context, pkg domain.Package) ([]domain.InstrumentationInfo, error)
GetRecommendedInstrumentations returns recommended instrumentations for a given package
type Language ¶
type Language interface {
// Name returns the language name
Name() string
// GetOTelLibraries finds OpenTelemetry libraries used in the codebase
GetOTelLibraries(ctx context.Context, rootPath string) ([]domain.Library, error)
// GetAllPackages finds all packages/dependencies used in the codebase
GetAllPackages(ctx context.Context, rootPath string) ([]domain.Package, error)
// GetFilePatterns returns file patterns this language detector should scan
GetFilePatterns() []string
}
Language represents a programming language detector