Sha256: 4a1c6009fe48e87642393c0bbd675da851c09a9fb94086974b11dc53c0f5598f
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 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 ## # Collect once, immediately on install. def install collect end def collect result = git_revision || hg_revision || return tool, revision = *result Agent.instance.collect( { "source" => "deploy", "revision" => revision, "name" => tool, "started_at" => Time.now.to_f, "finished_at" => Time.now.to_f } ) 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
plain_apm-0.6.7 | lib/plain_apm/hooks/deploy.rb |
plain_apm-0.6.6 | lib/plain_apm/hooks/deploy.rb |
plain_apm-0.6.5 | lib/plain_apm/hooks/deploy.rb |
plain_apm-0.6.4 | lib/plain_apm/hooks/deploy.rb |