Documentation ¶
Overview ¶
Package usm provides functionality to detect the most appropriate service name for a process.
Index ¶
Constants ¶
const ( // NodePackageJSONPath The path to the Node service's package.json NodePackageJSONPath = iota // ServiceSubFS The SubdirFS instance package.json path is valid in. ServiceSubFS = iota // The pointer to the Process instance of the service ServiceProc = iota )
DetectorContextMap keys enum
Variables ¶
This section is empty.
Functions ¶
func ReadlinkFS ¶
ReadlinkFS reads the symlink on the provided FS. There is no standard SymlinkFS interface yet https://github.com/golang/go/issues/49580.
Types ¶
type DetectionContext ¶
type DetectionContext struct { // Pid process PID Pid int // Args the command line arguments of the process Args []string // Envs targeted environment variables of the process Envs envs.Variables // DetectorContextMap a map to pass data between detectors, like some paths. ContextMap DetectorContextMap // contains filtered or unexported fields }
DetectionContext allows to detect ServiceMetadata.
func NewDetectionContext ¶
NewDetectionContext initializes DetectionContext.
type DetectorContextMap ¶
type DetectorContextMap map[int]interface{}
DetectorContextMap is a map for passing data between the different detectors of the service discovery (i.e between the service name detector and the instrumentation detector)
type ServiceMetadata ¶
type ServiceMetadata struct { Name string Source ServiceNameSource AdditionalNames []string DDService string DDServiceInjected bool }
ServiceMetadata holds information about a service.
func ExtractServiceMetadata ¶
func ExtractServiceMetadata(lang language.Language, ctx DetectionContext) (metadata ServiceMetadata, success bool)
ExtractServiceMetadata attempts to detect ServiceMetadata from the given process.
func NewServiceMetadata ¶
func NewServiceMetadata(name string, source ServiceNameSource, additional ...string) ServiceMetadata
NewServiceMetadata initializes ServiceMetadata.
func (ServiceMetadata) GetServiceKey ¶
func (s ServiceMetadata) GetServiceKey() string
GetServiceKey returns the key for the service.
func (*ServiceMetadata) SetAdditionalNames ¶
func (s *ServiceMetadata) SetAdditionalNames(additional ...string)
SetAdditionalNames set additional names for the service
func (*ServiceMetadata) SetNames ¶
func (s *ServiceMetadata) SetNames(name string, source ServiceNameSource, additional ...string)
SetNames sets generated names for the service.
type ServiceNameSource ¶
type ServiceNameSource string
ServiceNameSource is a string enum that represents the source of a generated service name
const ( // CommandLine indicates that the name comes from the command line CommandLine ServiceNameSource = "command-line" // Container indicates the name comes from the container tags Container ServiceNameSource = "container" // Laravel indicates that the name comes from the Laravel application name Laravel ServiceNameSource = "laravel" // Python indicates that the name comes from the Python package name Python ServiceNameSource = "python" // Nodejs indicates that the name comes from the Node.js package name Nodejs ServiceNameSource = "nodejs" // Gunicorn indicates that the name comes from the Gunicorn application name Gunicorn ServiceNameSource = "gunicorn" // Rails indicates that the name comes from the Rails application name Rails ServiceNameSource = "rails" // Spring indicates that the name comes from the Spring application name Spring ServiceNameSource = "spring" // JBoss indicates that the name comes from the JBoss application name JBoss ServiceNameSource = "jboss" // Tomcat indicates that the name comes from the Tomcat application name Tomcat ServiceNameSource = "tomcat" // WebLogic indicates that the name comes from the WebLogic application name WebLogic ServiceNameSource = "weblogic" // WebSphere indicates that the name comes from the WebSphere application name WebSphere ServiceNameSource = "websphere" )
type SubDirFS ¶
SubDirFS is like the fs.FS implemented by os.DirFS, except that it allows absolute paths to be passed in the Open/Stat/etc, and attaches them to the root dir. It also implements SubFS, unlink the one implemented by os.DirFS.
func NewSubDirFS ¶
NewSubDirFS creates a new SubDirFS rooted at the specified path.