-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add telemetry constants, helpers, signatures
- Loading branch information
1 parent
03910f2
commit eed3e38
Showing
26 changed files
with
990 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module CI | ||
module Ext | ||
module Telemetry | ||
NAMESPACE = "civisibility" | ||
|
||
METRIC_EVENT_CREATED = "event_created" | ||
METRIC_EVENT_FINISHED = "event_finished" | ||
|
||
METRIC_MANUAL_API_EVENTS = "manual_api_events" | ||
|
||
METRIC_CODE_COVERAGE_STARTED = "code_coverage_started" | ||
METRIC_CODE_COVERAGE_FINISHED = "code_coverage_finished" | ||
|
||
METRIC_EVENTS_ENQUEUED = "events_enqueued_for_serialization" | ||
METRIC_ENDPOINT_PAYLOAD_BYTES = "endpoint_payload.bytes" | ||
METRIC_ENDPOINT_PAYLOAD_REQUESTS = "endpoint_payload.requests" | ||
METRIC_ENDPOINT_PAYLOAD_REQUESTS_MS = "endpoint_payload.requests_ms" | ||
METRIC_ENDPOINT_PAYLOAD_REQUESTS_ERRORS = "endpoint_payload.requests_errors" | ||
METRIC_ENDPOINT_PAYLOAD_EVENTS_COUNT = "endpoint_payload.events_count" | ||
METRIC_ENDPOINT_PAYLOAD_EVENTS_SERIALIZATION_MS = "endpoint_payload.events_serialization_ms" | ||
METRIC_ENDPOINT_PAYLOAD_DROPPED = "endpoint_payload.dropped" | ||
|
||
METRIC_GIT_COMMAND = "git.command" | ||
METRIC_GIT_COMMAND_ERRORS = "git.command_errors" | ||
METRIC_GIT_COMMAND_MS = "git.command_ms" | ||
|
||
METRIC_GIT_REQUESTS_SEARCH_COMMITS = "git_requests.search_commits" | ||
METRIC_GIT_REQUESTS_SEARCH_COMMITS_MS = "git_requests.search_commits_ms" | ||
METRIC_GIT_REQUESTS_SEARCH_COMMITS_ERRORS = "git_requests.search_commits_errors" | ||
|
||
METRIC_GIT_REQUESTS_OBJECT_PACK = "git_requests.objects_pack" | ||
METRIC_GIT_REQUESTS_OBJECT_PACK_MS = "git_requests.objects_pack_ms" | ||
METRIC_GIT_REQUESTS_OBJECT_PACK_ERRORS = "git_requests.objects_pack_errors" | ||
METRIC_GIT_REQUESTS_OBJECT_PACK_BYTES = "git_requests.objects_pack_bytes" | ||
METRIC_GIT_REQUESTS_OBJECT_PACK_FILES = "git_requests.objects_pack_files" | ||
|
||
METRIC_GIT_REQUESTS_SETTINGS = "git_requests.settings" | ||
METRIC_GIT_REQUESTS_SETTINGS_MS = "git_requests.settings_ms" | ||
METRIC_GIT_REQUESTS_SETTINGS_ERRORS = "git_requests.settings_errors" | ||
METRIC_GIT_REQUESTS_SETTINGS_RESPONSE = "git_requests.settings_response" | ||
|
||
METRIC_ITR_SKIPPABLE_TESTS_REQUEST = "itr_skippable_tests.request" | ||
METRIC_ITR_SKIPPABLE_TESTS_REQUEST_MS = "itr_skippable_tests.request_ms" | ||
METRIC_ITR_SKIPPABLE_TESTS_REQUEST_ERRORS = "itr_skippable_tests.request_errors" | ||
METRIC_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES = "itr_skippable_tests.response_bytes" | ||
METRIC_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS = "itr_skippable_tests.response_tests" | ||
|
||
METRIC_ITR_SKIPPED = "itr_skipped" | ||
METRIC_ITR_UNSKIPPABLE = "itr_unskippable" | ||
METRIC_ITR_FORCED_RUN = "itr_forced_run" | ||
|
||
METRIC_CODE_COVERAGE_IS_EMPTY = "code_coverage.is_empty" | ||
METRIC_CODE_COVERAGE_FILES = "code_coverage.files" | ||
METRIC_CODE_COVERAGE_ERRORS = "code_coverage.errors" | ||
|
||
METRIC_TEST_SESSION = "test_session" | ||
|
||
TAG_TEST_FRAMEWORK = "test_framework" | ||
TAG_EVENT_TYPE = "event_type" | ||
TAG_HAS_CODEOWNER = "has_codeowner" | ||
TAG_IS_UNSUPPORTED_CI = "is_unsupported_ci" | ||
TAG_BROWSER_DRIVER = "browser_driver" | ||
TAG_IS_RUM = "is_rum" | ||
TAG_LIBRARY = "library" | ||
TAG_ENDPOINT = "endpoint" | ||
TAG_ERROR_TYPE = "error_type" | ||
TAG_EXIT_CODE = "exit_code" | ||
TAG_STATUS_CODE = "status_code" | ||
TAG_REQUEST_COMPRESSED = "rq_compressed" | ||
TAG_RESPONSE_COMPRESSED = "rs_compressed" | ||
TAG_COMMAND = "command" | ||
TAG_COVERAGE_ENABLED = "coverage_enabled" | ||
TAG_ITR_ENABLED = "itr_enabled" | ||
TAG_ITR_SKIP_ENABLED = "itr_skip_enabled" | ||
TAG_REQUIRE_GIT = "require_git" | ||
TAG_PROVIDER = "provider" | ||
TAG_AUTO_INJECTED = "auto_injected" | ||
|
||
module Library | ||
BUILTIN = "builtin" | ||
end | ||
|
||
module Endpoint | ||
CODE_COVERAGE = "code_coverage" | ||
TEST_CYCLE = "test_cycle" | ||
end | ||
|
||
module ErrorType | ||
NETWORK = "network" | ||
TIMEOUT = "timeout" | ||
end | ||
|
||
module ExitCode | ||
MISSING = "missing" | ||
end | ||
|
||
module Command | ||
GET_REPOSITORY = "get_repository" | ||
GET_BRANCH = "get_branch" | ||
CHECK_SHALLOW = "check_shallow" | ||
UNSHALLOW = "unshallow" | ||
GET_LOCAL_COMMITS = "get_local_commits" | ||
GET_OBJECTS = "get_objects" | ||
PACK_OBJECTS = "pack_objects" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "../ext/telemetry" | ||
|
||
module Datadog | ||
module CI | ||
module Utils | ||
module Telemetry | ||
def self.inc(metric_name, count, tags = {}) | ||
telemetry.inc(Ext::Telemetry::NAMESPACE, metric_name, count, tags: tags) | ||
end | ||
|
||
def self.distribution(metric_name, value, tags = {}) | ||
telemetry.distribution(Ext::Telemetry::NAMESPACE, metric_name, value, tags: tags) | ||
end | ||
|
||
def self.telemetry | ||
Datadog.send(:components).telemtry | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
module Datadog | ||
module CI | ||
module Ext | ||
module Telemetry | ||
NAMESPACE: "civisibility" | ||
|
||
METRIC_EVENT_CREATED: "event_created" | ||
|
||
METRIC_EVENT_FINISHED: "event_finished" | ||
|
||
METRIC_MANUAL_API_EVENTS: "manual_api_events" | ||
|
||
METRIC_CODE_COVERAGE_STARTED: "code_coverage_started" | ||
|
||
METRIC_CODE_COVERAGE_FINISHED: "code_coverage_finished" | ||
|
||
METRIC_EVENTS_ENQUEUED: "events_enqueued_for_serialization" | ||
|
||
METRIC_ENDPOINT_PAYLOAD_BYTES: "endpoint_payload.bytes" | ||
|
||
METRIC_ENDPOINT_PAYLOAD_REQUESTS: "endpoint_payload.requests" | ||
|
||
METRIC_ENDPOINT_PAYLOAD_REQUESTS_MS: "endpoint_payload.requests_ms" | ||
|
||
METRIC_ENDPOINT_PAYLOAD_REQUESTS_ERRORS: "endpoint_payload.requests_errors" | ||
|
||
METRIC_ENDPOINT_PAYLOAD_EVENTS_COUNT: "endpoint_payload.events_count" | ||
|
||
METRIC_ENDPOINT_PAYLOAD_EVENTS_SERIALIZATION_MS: "endpoint_payload.events_serialization_ms" | ||
|
||
METRIC_ENDPOINT_PAYLOAD_DROPPED: "endpoint_payload.dropped" | ||
|
||
METRIC_GIT_COMMAND: "git.command" | ||
|
||
METRIC_GIT_COMMAND_ERRORS: "git.command_errors" | ||
|
||
METRIC_GIT_COMMAND_MS: "git.command_ms" | ||
|
||
METRIC_GIT_REQUESTS_SEARCH_COMMITS: "git_requests.search_commits" | ||
|
||
METRIC_GIT_REQUESTS_SEARCH_COMMITS_MS: "git_requests.search_commits_ms" | ||
|
||
METRIC_GIT_REQUESTS_SEARCH_COMMITS_ERRORS: "git_requests.search_commits_errors" | ||
|
||
METRIC_GIT_REQUESTS_OBJECT_PACK: "git_requests.objects_pack" | ||
|
||
METRIC_GIT_REQUESTS_OBJECT_PACK_MS: "git_requests.objects_pack_ms" | ||
|
||
METRIC_GIT_REQUESTS_OBJECT_PACK_ERRORS: "git_requests.objects_pack_errors" | ||
|
||
METRIC_GIT_REQUESTS_OBJECT_PACK_BYTES: "git_requests.objects_pack_bytes" | ||
|
||
METRIC_GIT_REQUESTS_OBJECT_PACK_FILES: "git_requests.objects_pack_files" | ||
|
||
METRIC_GIT_REQUESTS_SETTINGS: "git_requests.settings" | ||
|
||
METRIC_GIT_REQUESTS_SETTINGS_MS: "git_requests.settings_ms" | ||
|
||
METRIC_GIT_REQUESTS_SETTINGS_ERRORS: "git_requests.settings_errors" | ||
|
||
METRIC_GIT_REQUESTS_SETTINGS_RESPONSE: "git_requests.settings_response" | ||
|
||
METRIC_ITR_SKIPPABLE_TESTS_REQUEST: "itr_skippable_tests.request" | ||
|
||
METRIC_ITR_SKIPPABLE_TESTS_REQUEST_MS: "itr_skippable_tests.request_ms" | ||
|
||
METRIC_ITR_SKIPPABLE_TESTS_REQUEST_ERRORS: "itr_skippable_tests.request_errors" | ||
|
||
METRIC_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES: "itr_skippable_tests.response_bytes" | ||
|
||
METRIC_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS: "itr_skippable_tests.response_tests" | ||
|
||
METRIC_ITR_SKIPPED: "itr_skipped" | ||
|
||
METRIC_ITR_UNSKIPPABLE: "itr_unskippable" | ||
|
||
METRIC_ITR_FORCED_RUN: "itr_forced_run" | ||
|
||
METRIC_CODE_COVERAGE_IS_EMPTY: "code_coverage.is_empty" | ||
|
||
METRIC_CODE_COVERAGE_FILES: "code_coverage.files" | ||
|
||
METRIC_CODE_COVERAGE_ERRORS: "code_coverage.errors" | ||
|
||
METRIC_TEST_SESSION: "test_session" | ||
|
||
TAG_TEST_FRAMEWORK: "test_framework" | ||
|
||
TAG_EVENT_TYPE: "event_type" | ||
|
||
TAG_HAS_CODEOWNER: "has_codeowner" | ||
|
||
TAG_IS_UNSUPPORTED_CI: "is_unsupported_ci" | ||
|
||
TAG_BROWSER_DRIVER: "browser_driver" | ||
|
||
TAG_IS_RUM: "is_rum" | ||
|
||
TAG_LIBRARY: "library" | ||
|
||
TAG_ENDPOINT: "endpoint" | ||
|
||
TAG_ERROR_TYPE: "error_type" | ||
|
||
TAG_EXIT_CODE: "exit_code" | ||
|
||
TAG_STATUS_CODE: "status_code" | ||
|
||
TAG_REQUEST_COMPRESSED: "rq_compressed" | ||
|
||
TAG_RESPONSE_COMPRESSED: "rs_compressed" | ||
|
||
TAG_COMMAND: "command" | ||
|
||
TAG_COVERAGE_ENABLED: "coverage_enabled" | ||
|
||
TAG_ITR_ENABLED: "itr_enabled" | ||
|
||
TAG_ITR_SKIP_ENABLED: "itr_skip_enabled" | ||
|
||
TAG_REQUIRE_GIT: "require_git" | ||
|
||
TAG_PROVIDER: "provider" | ||
|
||
TAG_AUTO_INJECTED: "auto_injected" | ||
|
||
module Library | ||
BUILTIN: "builtin" | ||
end | ||
|
||
module Endpoint | ||
CODE_COVERAGE: "code_coverage" | ||
|
||
TEST_CYCLE: "test_cycle" | ||
end | ||
|
||
module ErrorType | ||
NETWORK: "network" | ||
|
||
TIMEOUT: "timeout" | ||
end | ||
|
||
module ExitCode | ||
MISSING: "missing" | ||
end | ||
|
||
module Command | ||
GET_REPOSITORY: "get_repository" | ||
|
||
GET_BRANCH: "get_branch" | ||
|
||
CHECK_SHALLOW: "check_shallow" | ||
|
||
UNSHALLOW: "unshallow" | ||
|
||
GET_LOCAL_COMMITS: "get_local_commits" | ||
|
||
GET_OBJECTS: "get_objects" | ||
|
||
PACK_OBJECTS: "pack_objects" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Datadog | ||
module CI | ||
module Utils | ||
module Telemetry | ||
def self.inc: (String metric_name, Integer count, ?Datadog::Core::Telemetry::Metric::tags_input tags) -> void | ||
|
||
def self.distribution: (String metric_name, Float value, ?Datadog::Core::Telemetry::Metric::tags_input tags) -> void | ||
|
||
def self.telemetry: () -> Datadog::Core::Telemetry::Component | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Datadog | ||
module Core | ||
module Telemetry | ||
class Component | ||
@enabled: bool | ||
@stopped: bool | ||
@metrics_manager: Datadog::Core::Telemetry::MetricsManager | ||
@worker: Datadog::Core::Telemetry::Worker | ||
|
||
attr_reader enabled: bool | ||
|
||
include Core::Utils::Forking | ||
|
||
def initialize: (http_transport: Datadog::Core::Telemetry::Http::Transport, heartbeat_interval_seconds: Float, metrics_aggregation_interval_seconds: Float, dependency_collection: bool, ?enabled: bool, ?metrics_enabled: bool, shutdown_timeout_seconds: Float) -> void | ||
|
||
def disable!: () -> void | ||
|
||
def client_configuration_change!: (Enumerable[[String, Numeric | bool | String]] changes) -> void | ||
|
||
def emit_closing!: () -> void | ||
|
||
def stop!: () -> void | ||
|
||
def integrations_change!: () -> void | ||
|
||
def inc: (String namespace, String metric_name, Datadog::Core::Telemetry::Metric::input_value value, ?tags: Datadog::Core::Telemetry::Metric::tags_input, ?common: bool) -> void | ||
|
||
def dec: (String namespace, String metric_name, Datadog::Core::Telemetry::Metric::input_value value, ?tags: Datadog::Core::Telemetry::Metric::tags_input, ?common: bool) -> void | ||
|
||
def gauge: (String namespace, String metric_name, Datadog::Core::Telemetry::Metric::input_value value, ?tags: Datadog::Core::Telemetry::Metric::tags_input, ?common: bool) -> void | ||
|
||
def rate: (String namespace, String metric_name, Datadog::Core::Telemetry::Metric::input_value value, ?tags: Datadog::Core::Telemetry::Metric::tags_input, ?common: bool) -> void | ||
|
||
def distribution: (String namespace, String metric_name, Datadog::Core::Telemetry::Metric::input_value value, ?tags: Datadog::Core::Telemetry::Metric::tags_input, ?common: bool) -> void | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module Datadog | ||
module Core | ||
module Telemetry | ||
class Emitter | ||
self.@sequence: Datadog::Core::Utils::Sequence | ||
|
||
attr_reader http_transport: untyped | ||
|
||
extend Core::Utils::Forking | ||
def initialize: (http_transport: untyped) -> void | ||
def request: (Datadog::Core::Telemetry::Event::Base event) -> Datadog::Core::Telemetry::Http::Adapters::Net::Response | ||
def self.sequence: () -> untyped | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.