github.com/bigcommerce/nomad@v0.9.3-bc/client/fingerprint/nomad.go (about)

     1  package fingerprint
     2  
     3  import (
     4  	log "github.com/hashicorp/go-hclog"
     5  )
     6  
     7  // NomadFingerprint is used to fingerprint the Nomad version
     8  type NomadFingerprint struct {
     9  	StaticFingerprinter
    10  	logger log.Logger
    11  }
    12  
    13  // NewNomadFingerprint is used to create a Nomad fingerprint
    14  func NewNomadFingerprint(logger log.Logger) Fingerprint {
    15  	f := &NomadFingerprint{logger: logger.Named("nomad")}
    16  	return f
    17  }
    18  
    19  func (f *NomadFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error {
    20  	resp.AddAttribute("nomad.advertise.address", req.Node.HTTPAddr)
    21  	resp.AddAttribute("nomad.version", req.Config.Version.VersionNumber())
    22  	resp.AddAttribute("nomad.revision", req.Config.Version.Revision)
    23  	resp.Detected = true
    24  	return nil
    25  }