Sha256: 8273f8322e2bcd4d295907044bf15d104bb314eff19917565ac8c5e019a1760d
Contents?: true
Size: 1.12 KB
Versions: 9
Compression:
Stored size: 1.12 KB
Contents
module PlainApm ## # Tracks current revision of the app. # # This enables per-deploy metrics segmentation and checking # for performance regressions. module Hooks class Deploy include EventAttributes ## # Collect once, immediately on install. def install collect end def uninstall # NOOP end def collect result = git_revision || hg_revision || return _, attrs = attributes_from_deploy(*result) ::PlainApm.agent.collect(attrs) end private # TODO: other deploy mechanisms # # Also, we might not be in the app root. def git_revision return unless File.exist?(".git") rev = `git rev-parse --short=8 HEAD`.strip return if rev.empty? ["git", rev] rescue Error::ENOENT # No git installed nil end def hg_revision return unless File.exist?(".hg") rev = `hg log -l 1 -r . -T '{node}'`.strip return if rev.empty? ["hg", rev] rescue Error::ENOENT # No mercurial installed nil end end end end
Version data entries
9 entries across 9 versions & 1 rubygems