Documentation
¶
Index ¶
- func DetectLanguageForFile(filePath string) (string, error)
- func DetectLanguages(rootPath string) (map[string]string, error)
- type Analysis
- type CodebaseAnalyzer
- type DirectoryAnalysis
- type InstrumentationRegistryService
- func (s *InstrumentationRegistryService) CanonicalLanguage(language string) string
- func (s *InstrumentationRegistryService) GetInstrumentation(ctx context.Context, pkg domain.Package) (*domain.InstrumentationInfo, error)
- func (s *InstrumentationRegistryService) PackageName(packageName string) string
- func (s *InstrumentationRegistryService) RegistryLanguage(language string) string
- 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
- type RegistryEntry
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, 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"` 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 InstrumentationRegistryService ¶
type InstrumentationRegistryService struct {
// contains filtered or unexported fields
}
InstrumentationRegistryService handles communication with the OpenTelemetry instrumentation registry
func NewInstrumentationRegistryService ¶
func NewInstrumentationRegistryService() *InstrumentationRegistryService
NewInstrumentationRegistryService creates a new instrumentation registry service
func (*InstrumentationRegistryService) CanonicalLanguage ¶
func (s *InstrumentationRegistryService) CanonicalLanguage(language string) string
CanonicalLanguage normalizes registry language identifiers to our internal ones
func (*InstrumentationRegistryService) GetInstrumentation ¶
func (s *InstrumentationRegistryService) GetInstrumentation(ctx context.Context, pkg domain.Package) (*domain.InstrumentationInfo, error)
GetInstrumentation checks if instrumentation exists for a given package
func (*InstrumentationRegistryService) PackageName ¶
func (s *InstrumentationRegistryService) PackageName(packageName string) string
normalizedomain.PackageName converts package names to the format used in the registry
func (*InstrumentationRegistryService) RegistryLanguage ¶
func (s *InstrumentationRegistryService) RegistryLanguage(language string) string
RegistryLanguage normalizes language names to the ones used by the registry filenames
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(logger logger.Logger) (*KnowledgeBasedInstrumentationService, error)
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
type RegistryEntry ¶
type RegistryEntry struct { Title string `yaml:"title"` RegistryType string `yaml:"registryType"` Language string `yaml:"language"` Tags []string `yaml:"tags"` Description string `yaml:"description"` License string `yaml:"license"` Authors []struct { Name string `yaml:"name"` } `yaml:"authors"` URLs struct { Repo string `yaml:"repo"` } `yaml:"urls"` CreatedAt string `yaml:"createdAt"` IsFirstParty bool `yaml:"isFirstParty"` }
RegistryEntry represents the YAML structure from the OpenTelemetry registry