Documentation
¶
Index ¶
- Constants
- Variables
- func ExtractContainerFromAnnotationKey(annotationKey string) (string, bool)
- func GetLanguageAnnotationKey(containerName string) string
- type Container
- type ContainersLanguages
- type Detector
- type Language
- type LanguageName
- type LanguageSet
- type Process
- type TimedContainersLanguages
- func (c TimedContainersLanguages) EqualTo(other TimedContainersLanguages) bool
- func (c TimedContainersLanguages) GetOrInitialize(container Container) *TimedLanguageSet
- func (c TimedContainersLanguages) Merge(other TimedContainersLanguages) bool
- func (c TimedContainersLanguages) RemoveExpiredLanguages() bool
- type TimedLanguageSet
- func (s TimedLanguageSet) Add(language LanguageName, expiration time.Time) bool
- func (s TimedLanguageSet) EqualTo(other TimedLanguageSet) bool
- func (s TimedLanguageSet) Has(language LanguageName) bool
- func (s TimedLanguageSet) Merge(other TimedLanguageSet) bool
- func (s TimedLanguageSet) Remove(language LanguageName)
- func (s TimedLanguageSet) RemoveExpired() bool
Constants ¶
const ( // AnnotationPrefix represents a prefix of the language detection annotations AnnotationPrefix string = "internal.dd.datadoghq.com/" )
Variables ¶
var AnnotationRegex = regexp.MustCompile(`internal\.dd\.datadoghq\.com\/(init\.)?(.+?)\.detected_langs`)
AnnotationRegex defines the regex pattern of language detection annotations
Functions ¶
func ExtractContainerFromAnnotationKey ¶
ExtractContainerFromAnnotationKey extracts container name from annotation key and indicates if it is an init container if the annotation key is not a language annotation it returns an empty container name
func GetLanguageAnnotationKey ¶
GetLanguageAnnotationKey returns the language annotation key for the specified container
Types ¶
type Container ¶
Container identifies a pod container by its name and an init boolean flag
func NewContainer ¶
NewContainer creates and returns a new Container object with unset init flag
func NewInitContainer ¶
NewInitContainer creates and returns a new Container object with set init flag
type ContainersLanguages ¶
type ContainersLanguages map[Container]LanguageSet
ContainersLanguages handles mapping containers to language sets
func (ContainersLanguages) ToAnnotations ¶
func (c ContainersLanguages) ToAnnotations() map[string]string
ToAnnotations converts the containers languages to language annotations
func (ContainersLanguages) ToProto ¶
func (c ContainersLanguages) ToProto() (containersDetailsProto, initContainersDetailsProto []*pbgo.ContainerLanguageDetails)
ToProto returns two proto messages ContainerLanguageDetails The first one contains standard containers The second one contains init containers
type Language ¶
type Language struct { Name LanguageName Version string }
Language contains metadata collected from the call to `DetectLanguage`
type LanguageName ¶
type LanguageName string
LanguageName is a string enum that represents a detected language name.
const ( // Go language name. Go LanguageName = "go" // Node language name. Node LanguageName = "node" // Dotnet language name. Dotnet LanguageName = "dotnet" // Python language name. Python LanguageName = "python" // Java language name. Java LanguageName = "java" // Ruby language name. Ruby LanguageName = "ruby" // PHP language name. PHP LanguageName = "php" // Unknown language name. Unknown LanguageName = "" )
type LanguageSet ¶
type LanguageSet map[LanguageName]struct{}
LanguageSet represents a set of languages
func (LanguageSet) Add ¶
func (s LanguageSet) Add(language LanguageName) bool
Add adds a new language to the language set returns false if the language is already included in the set, and true otherwise
func (LanguageSet) ToProto ¶
func (s LanguageSet) ToProto() []*pbgo.Language
ToProto returns a proto message Language
type TimedContainersLanguages ¶
type TimedContainersLanguages map[Container]TimedLanguageSet
TimedContainersLanguages handles mapping containers to timed language sets
func (TimedContainersLanguages) EqualTo ¶
func (c TimedContainersLanguages) EqualTo(other TimedContainersLanguages) bool
EqualTo checks if current TimedContainersLanguages object has identical content in comparison another TimedContainersLanguages
func (TimedContainersLanguages) GetOrInitialize ¶
func (c TimedContainersLanguages) GetOrInitialize(container Container) *TimedLanguageSet
GetOrInitialize returns the language set of a container if it exists, or initializes it otherwise
func (TimedContainersLanguages) Merge ¶
func (c TimedContainersLanguages) Merge(other TimedContainersLanguages) bool
Merge merges another containers languages object to the current object Returns true if new languages were added, and false otherwise
func (TimedContainersLanguages) RemoveExpiredLanguages ¶
func (c TimedContainersLanguages) RemoveExpiredLanguages() bool
RemoveExpiredLanguages removes expired languages from each container language set Returns true if at least one language is expired and removed
type TimedLanguageSet ¶
type TimedLanguageSet map[LanguageName]time.Time
TimedLanguageSet handles storing sets of languages along with their expiration times
func (TimedLanguageSet) Add ¶
func (s TimedLanguageSet) Add(language LanguageName, expiration time.Time) bool
Add adds a new language to the language set with an expiration time returns false if the language is already included in the set, and true otherwise
func (TimedLanguageSet) EqualTo ¶
func (s TimedLanguageSet) EqualTo(other TimedLanguageSet) bool
EqualTo determines if the current timed languageset has the same languages as another timed languageset
func (TimedLanguageSet) Has ¶
func (s TimedLanguageSet) Has(language LanguageName) bool
Has returns whether the set contains a specific language
func (TimedLanguageSet) Merge ¶
func (s TimedLanguageSet) Merge(other TimedLanguageSet) bool
Merge merges another timed language set with the current language set returns true if the set new languages were introduced, and false otherwise
func (TimedLanguageSet) Remove ¶
func (s TimedLanguageSet) Remove(language LanguageName)
Remove deletes a language from the language set
func (TimedLanguageSet) RemoveExpired ¶
func (s TimedLanguageSet) RemoveExpired() bool
RemoveExpired removes all expired languages from the set Returns true if at least one language is expired and removed