Module: Datadog::CI::Git::Telemetry
- Defined in:
- lib/datadog/ci/git/telemetry.rb
Class Method Summary collapse
- .exit_code_for(exit_code: nil, executable_missing: false) ⇒ Object
- .git_command(command) ⇒ Object
- .git_command_errors(command, exit_code: nil, executable_missing: false) ⇒ Object
- .git_command_ms(command, duration_ms) ⇒ Object
- .tags_for_command(command) ⇒ Object
Class Method Details
.exit_code_for(exit_code: nil, executable_missing: false) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/datadog/ci/git/telemetry.rb', line 28 def self.exit_code_for(exit_code: nil, executable_missing: false) return Ext::Telemetry::ExitCode::MISSING if executable_missing return exit_code.to_s if exit_code nil end |
.git_command(command) ⇒ Object
7 8 9 |
# File 'lib/datadog/ci/git/telemetry.rb', line 7 def self.git_command(command) Utils::Telemetry.inc(Ext::Telemetry::METRIC_GIT_COMMAND, 1, (command)) end |
.git_command_errors(command, exit_code: nil, executable_missing: false) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/datadog/ci/git/telemetry.rb', line 11 def self.git_command_errors(command, exit_code: nil, executable_missing: false) = (command) exit_code_tag_value = exit_code_for(exit_code: exit_code, executable_missing: executable_missing) [Ext::Telemetry::TAG_EXIT_CODE] = exit_code_tag_value if exit_code_tag_value Utils::Telemetry.inc(Ext::Telemetry::METRIC_GIT_COMMAND_ERRORS, 1, ) end |
.git_command_ms(command, duration_ms) ⇒ Object
20 21 22 |
# File 'lib/datadog/ci/git/telemetry.rb', line 20 def self.git_command_ms(command, duration_ms) Utils::Telemetry.distribution(Ext::Telemetry::METRIC_GIT_COMMAND_MS, duration_ms, (command)) end |
.tags_for_command(command) ⇒ Object
24 25 26 |
# File 'lib/datadog/ci/git/telemetry.rb', line 24 def self.(command) {Ext::Telemetry::TAG_COMMAND => command} end |