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 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, 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, additional ...string)
SetNames sets generated names for the service.
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.