From d662619825d10c9a57fb842ca8cdbf56f22f54e5 Mon Sep 17 00:00:00 2001 From: Sarah Witt Date: Wed, 18 Dec 2024 15:25:06 -0500 Subject: [PATCH 1/6] Add support for machine metrics --- .../datadog_checks/octopus_deploy/check.py | 22 ++++ octopus_deploy/metadata.csv | 2 + octopus_deploy/tests/constants.py | 2 + octopus_deploy/tests/docker/Caddyfile | 10 +- .../machines/skip=0/take=2/response.json | 68 ++++++++++++ .../machines/skip=0/take=30/response.json | 68 ++++++++++++ octopus_deploy/tests/test_unit.py | 104 ++++++++++++++++++ 7 files changed, 275 insertions(+), 1 deletion(-) create mode 100644 octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=2/response.json create mode 100644 octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=30/response.json diff --git a/octopus_deploy/datadog_checks/octopus_deploy/check.py b/octopus_deploy/datadog_checks/octopus_deploy/check.py index c71b36875a81a..67cb8d05a6bd4 100644 --- a/octopus_deploy/datadog_checks/octopus_deploy/check.py +++ b/octopus_deploy/datadog_checks/octopus_deploy/check.py @@ -188,6 +188,7 @@ def _process_spaces(self): self._process_project_groups( space_id, space_name, space_config.get("project_groups") if space_config else None ) + self._collect_machine_metrics(space_id) if self.collect_events: self._collect_new_events(space_id, space_name) @@ -341,6 +342,27 @@ def _collect_server_nodes_metrics(self): self.gauge("server_node.in_maintenance_mode", maintenance_mode, tags=self._base_tags + server_tags) self.gauge("server_node.max_concurrent_tasks", max_tasks, tags=self._base_tags + server_tags) + def _collect_machine_metrics(self, space_id): + self.log.debug("Collecting server node metrics.") + url = f"api/{space_id}/machines" + response_json = self._process_paginated_endpoint(url) + machines = response_json.get('Items', []) + + for machine in machines: + machine_id = machine.get("Id") + machine_name = machine.get("Name") + machine_slug = machine.get("Slug") + health_status = machine.get("HealthStatus", None) + is_healthy = health_status == "Healthy" + machine_tags = [ + f"machine_id:{machine_id}", + f"machine_name:{machine_name}", + f"machine_slug:{machine_slug}", + f"health_status:{health_status}", + ] + self.gauge("machine.count", 1, tags=self._base_tags + machine_tags) + self.gauge("machine.is_healthy", is_healthy, tags=self._base_tags + machine_tags) + def _collect_deployment_logs(self, space_id, task_id, tags): url = f"api/{space_id}/tasks/{task_id}/details" activity_logs = self._process_endpoint(url).get('ActivityLogs', []) diff --git a/octopus_deploy/metadata.csv b/octopus_deploy/metadata.csv index a41002aa00758..971d18eb5fe22 100644 --- a/octopus_deploy/metadata.csv +++ b/octopus_deploy/metadata.csv @@ -4,6 +4,8 @@ octopus_deploy.deployment.completed_time,gauge,,second,,Duration of deployment., octopus_deploy.deployment.count,gauge,,,,Number of deployments monitored.,-1,octopus_deploy,octopus_deploy deploy count,, octopus_deploy.deployment.executing_time,gauge,,second,,How long the deployment has been executing.,-1,octopus_deploy,octopus_deploy deploy dur,, octopus_deploy.deployment.queued_time,gauge,,second,,Time deployment was in queue.,-1,octopus_deploy,octopus_deploy deploy queue,, +octopus_deploy.machine.count,gauge,,,,Number of machines discovered.,-1,octopus_deploy,octopus_deploy machine count,, +octopus_deploy.machine.is_healthy,gauge,,,,Whether or not the machine is healthy.,-1,octopus_deploy,octopus_deploy machine health,, octopus_deploy.project.count,gauge,,,,Number of projects discovered.,-1,octopus_deploy,octopus_deploy projects count,, octopus_deploy.project_group.count,gauge,,,,Number of project groups discovered.,-1,octopus_deploy,octopus_deploy project group count,, octopus_deploy.server_node.count,gauge,,,,Number of Octopus server nodes discovered.,-1,octopus_deploy,octopus_deploy server count,, diff --git a/octopus_deploy/tests/constants.py b/octopus_deploy/tests/constants.py index 2dce9ef9aa1f7..ff3abf0ccb8ae 100644 --- a/octopus_deploy/tests/constants.py +++ b/octopus_deploy/tests/constants.py @@ -33,6 +33,8 @@ "octopus_deploy.server_node.count", "octopus_deploy.server_node.in_maintenance_mode", "octopus_deploy.server_node.max_concurrent_tasks", + "octopus_deploy.machine.count", + "octopus_deploy.machine.is_healthy", ] ALL_METRICS = ["octopus_deploy.deployment.completed_time"] + E2E_METRICS diff --git a/octopus_deploy/tests/docker/Caddyfile b/octopus_deploy/tests/docker/Caddyfile index b78c45e8b0422..16e67e6d27d4a 100644 --- a/octopus_deploy/tests/docker/Caddyfile +++ b/octopus_deploy/tests/docker/Caddyfile @@ -124,7 +124,15 @@ rewrite * /GET/api/octopusservernodes/skip=0/take=30/response.json file_server } - @get_tasks_1844 { + @get_machines { + method GET + path /api/Spaces-1/machines + } + route @get_machines { + rewrite * /GET/api/Spaces-1/machines/skip=0/take=30/response.json + file_server + } + @get_tasks_1844 { method GET path /api/Spaces-1/tasks/ServerTasks-1844/details } diff --git a/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=2/response.json b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=2/response.json new file mode 100644 index 0000000000000..93b4d1dfe10df --- /dev/null +++ b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=2/response.json @@ -0,0 +1,68 @@ +{ + "ItemType": "Machine", + "TotalResults": 1, + "ItemsPerPage": 2, + "NumberOfPages": 1, + "LastPageNumber": 0, + "Items": [ + { + "Id": "Machines-1", + "EnvironmentIds": [ + "Environments-1" + ], + "Roles": [ + "test-tag" + ], + "TenantedDeploymentParticipation": "Untenanted", + "TenantIds": [], + "TenantTags": [], + "SpaceId": "Spaces-1", + "Name": "test-machine", + "Thumbprint": "test-footprint", + "Uri": "hostname-test:10933/", + "IsDisabled": false, + "MachinePolicyId": "MachinePolicies-1", + "HealthStatus": "Healthy", + "HasLatestCalamari": false, + "StatusSummary": "Octopus was able to successfully establish a connection with this machine on Wednesday", + "IsInProcess": false, + "Endpoint": { + "CommunicationStyle": "TentaclePassive", + "ProxyId": null, + "Thumbprint": "test-footprint", + "Uri": "hostname-test:10933/", + "TentacleVersionDetails": { + "UpgradeLocked": false, + "Version": "8.2.2517", + "UpgradeSuggested": false, + "UpgradeRequired": false, + "UpgradeAvailable": false + }, + "CertificateSignatureAlgorithm": "sha256RSA", + "Id": null, + "LastModifiedOn": null, + "LastModifiedBy": null, + "Links": {} + }, + "OperatingSystem": "Ubuntu 24.04.1 LTS", + "ShellName": "Bash", + "ShellVersion": "5.2.21(1)-release", + "Architecture": "x86_64", + "Slug": "test-machine", + "SkipInitialHealthCheck": false, + "Links": { + "Self": "/api/Spaces-1/machines/Machines-1", + "Connection": "/api/Spaces-1/machines/Machines-1/connection", + "TasksTemplate": "/api/Spaces-1/machines/Machines-1/tasks{?skip,take,type}", + "SinglyScopedVariableDetails": "/api/Spaces-1/machines/Machines-1/singlyScopedVariableDetails" + } + } + ], + "Links": { + "Self": "/api/Spaces-1/machines?skip=0&take=30", + "Template": "/api/Spaces-1/machines{?skip,take,name,ids,partialName,roles,isDisabled,healthStatuses,commStyles,tenantIds,tenantTags,environmentIds,shellNames,deploymentTargetTypes}", + "Page.All": "/api/Spaces-1/machines?skip=0&take=2147483647", + "Page.Current": "/api/Spaces-1/machines?skip=0&take=30", + "Page.Last": "/api/Spaces-1/machines?skip=0&take=30" + } +} \ No newline at end of file diff --git a/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=30/response.json b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=30/response.json new file mode 100644 index 0000000000000..18b7818ffe166 --- /dev/null +++ b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=30/response.json @@ -0,0 +1,68 @@ +{ + "ItemType": "Machine", + "TotalResults": 1, + "ItemsPerPage": 30, + "NumberOfPages": 1, + "LastPageNumber": 0, + "Items": [ + { + "Id": "Machines-1", + "EnvironmentIds": [ + "Environments-1" + ], + "Roles": [ + "test-tag" + ], + "TenantedDeploymentParticipation": "Untenanted", + "TenantIds": [], + "TenantTags": [], + "SpaceId": "Spaces-1", + "Name": "test-machine", + "Thumbprint": "test-footprint", + "Uri": "hostname-test:10933/", + "IsDisabled": false, + "MachinePolicyId": "MachinePolicies-1", + "HealthStatus": "Healthy", + "HasLatestCalamari": false, + "StatusSummary": "Octopus was able to successfully establish a connection with this machine on Wednesday", + "IsInProcess": false, + "Endpoint": { + "CommunicationStyle": "TentaclePassive", + "ProxyId": null, + "Thumbprint": "test-footprint", + "Uri": "hostname-test:10933/", + "TentacleVersionDetails": { + "UpgradeLocked": false, + "Version": "8.2.2517", + "UpgradeSuggested": false, + "UpgradeRequired": false, + "UpgradeAvailable": false + }, + "CertificateSignatureAlgorithm": "sha256RSA", + "Id": null, + "LastModifiedOn": null, + "LastModifiedBy": null, + "Links": {} + }, + "OperatingSystem": "Ubuntu 24.04.1 LTS", + "ShellName": "Bash", + "ShellVersion": "5.2.21(1)-release", + "Architecture": "x86_64", + "Slug": "test-machine", + "SkipInitialHealthCheck": false, + "Links": { + "Self": "/api/Spaces-1/machines/Machines-1", + "Connection": "/api/Spaces-1/machines/Machines-1/connection", + "TasksTemplate": "/api/Spaces-1/machines/Machines-1/tasks{?skip,take,type}", + "SinglyScopedVariableDetails": "/api/Spaces-1/machines/Machines-1/singlyScopedVariableDetails" + } + } + ], + "Links": { + "Self": "/api/Spaces-1/machines?skip=0&take=30", + "Template": "/api/Spaces-1/machines{?skip,take,name,ids,partialName,roles,isDisabled,healthStatuses,commStyles,tenantIds,tenantTags,environmentIds,shellNames,deploymentTargetTypes}", + "Page.All": "/api/Spaces-1/machines?skip=0&take=2147483647", + "Page.Current": "/api/Spaces-1/machines?skip=0&take=30", + "Page.Last": "/api/Spaces-1/machines?skip=0&take=30" + } +} \ No newline at end of file diff --git a/octopus_deploy/tests/test_unit.py b/octopus_deploy/tests/test_unit.py index c1162953d1473..b2fbc15d2289a 100644 --- a/octopus_deploy/tests/test_unit.py +++ b/octopus_deploy/tests/test_unit.py @@ -1272,3 +1272,107 @@ def test_paginated_limit_tasks( skip_take_args += [(list(args), skip, take)] assert skip_take_args == expected_skip_take_args + + +@pytest.mark.usefixtures('mock_http_get') +@mock.patch("datadog_checks.octopus_deploy.check.get_current_datetime") +def test_machines_metrics( + get_current_datetime, + dd_run_check, + aggregator, +): + instance = {'octopus_endpoint': 'http://localhost:80'} + + check = OctopusDeployCheck('octopus_deploy', {}, [instance]) + + get_current_datetime.return_value = MOCKED_TIME1 + dd_run_check(check) + aggregator.assert_metric( + "octopus_deploy.machine.count", + 1, + tags=[ + "machine_id:Machines-1", + "machine_name:test-machine", + "machine_slug:test-machine", + "health_status:Healthy", + ], + ) + aggregator.assert_metric( + "octopus_deploy.machine.is_healthy", + 1, + tags=[ + "machine_id:Machines-1", + "machine_name:test-machine", + "machine_slug:test-machine", + "health_status:Healthy", + ], + ) + + +@pytest.mark.parametrize( + ('paginated_limit, expected_skip_take_args'), + [ + pytest.param( + 30, + [ + (['http://localhost:80/api/Spaces-1/machines'], 0, 30), + ], + id='high limit', + ), + pytest.param( + 2, + [ + (['http://localhost:80/api/Spaces-1/machines'], 0, 2), + ], + id='low limit', + ), + ], +) +@pytest.mark.usefixtures('mock_http_get') +@mock.patch("datadog_checks.octopus_deploy.check.get_current_datetime") +def test_machines_pagination( + get_current_datetime, + dd_run_check, + aggregator, + expected_skip_take_args, + mock_http_get, + paginated_limit, +): + instance = {'octopus_endpoint': 'http://localhost:80'} + instance['paginated_limit'] = paginated_limit + + check = OctopusDeployCheck('octopus_deploy', {}, [instance]) + + get_current_datetime.return_value = MOCKED_TIME1 + dd_run_check(check) + + skip_take_args = [] + for call in mock_http_get.call_args_list: + args, kwargs = call + take = kwargs.get('params', {}).get('take') + skip = kwargs.get('params', {}).get('skip') + if 'http://localhost:80/api/Spaces-1/machines' == args[0]: + skip_take_args += [(list(args), skip, take)] + + assert skip_take_args == expected_skip_take_args + + aggregator.assert_metric( + "octopus_deploy.machine.count", + 1, + tags=[ + "machine_id:Machines-1", + "machine_name:test-machine", + "machine_slug:test-machine", + "health_status:Healthy", + ], + ) + aggregator.assert_metric( + "octopus_deploy.machine.is_healthy", + 1, + tags=[ + "machine_id:Machines-1", + "machine_name:test-machine", + "machine_slug:test-machine", + "health_status:Healthy", + ], + ) From 9e4b6b5f84e782834f23e476ce5fd5f204102ae3 Mon Sep 17 00:00:00 2001 From: Sarah Witt Date: Wed, 18 Dec 2024 16:31:20 -0500 Subject: [PATCH 2/6] add role tags --- octopus_deploy/datadog_checks/octopus_deploy/check.py | 2 ++ octopus_deploy/tests/test_unit.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/octopus_deploy/datadog_checks/octopus_deploy/check.py b/octopus_deploy/datadog_checks/octopus_deploy/check.py index 67cb8d05a6bd4..0f822292dfa1f 100644 --- a/octopus_deploy/datadog_checks/octopus_deploy/check.py +++ b/octopus_deploy/datadog_checks/octopus_deploy/check.py @@ -352,6 +352,7 @@ def _collect_machine_metrics(self, space_id): machine_id = machine.get("Id") machine_name = machine.get("Name") machine_slug = machine.get("Slug") + roles = machine.get("Roles", []) health_status = machine.get("HealthStatus", None) is_healthy = health_status == "Healthy" machine_tags = [ @@ -360,6 +361,7 @@ def _collect_machine_metrics(self, space_id): f"machine_slug:{machine_slug}", f"health_status:{health_status}", ] + machine_tags += roles self.gauge("machine.count", 1, tags=self._base_tags + machine_tags) self.gauge("machine.is_healthy", is_healthy, tags=self._base_tags + machine_tags) diff --git a/octopus_deploy/tests/test_unit.py b/octopus_deploy/tests/test_unit.py index b2fbc15d2289a..fa691b5b5337a 100644 --- a/octopus_deploy/tests/test_unit.py +++ b/octopus_deploy/tests/test_unit.py @@ -1295,6 +1295,7 @@ def test_machines_metrics( "machine_name:test-machine", "machine_slug:test-machine", "health_status:Healthy", + "test-tag", ], ) aggregator.assert_metric( @@ -1305,6 +1306,7 @@ def test_machines_metrics( "machine_name:test-machine", "machine_slug:test-machine", "health_status:Healthy", + "test-tag", ], ) @@ -1364,6 +1366,7 @@ def test_machines_pagination( "machine_name:test-machine", "machine_slug:test-machine", "health_status:Healthy", + "test-tag", ], ) aggregator.assert_metric( @@ -1374,5 +1377,6 @@ def test_machines_pagination( "machine_name:test-machine", "machine_slug:test-machine", "health_status:Healthy", + "test-tag", ], ) From caae890551b44dccb5acb0e347e4fc962c8f52da Mon Sep 17 00:00:00 2001 From: Sarah Witt Date: Thu, 19 Dec 2024 14:54:33 -0500 Subject: [PATCH 3/6] change to startswith --- octopus_deploy/datadog_checks/octopus_deploy/check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octopus_deploy/datadog_checks/octopus_deploy/check.py b/octopus_deploy/datadog_checks/octopus_deploy/check.py index 0f822292dfa1f..805fcbc88dede 100644 --- a/octopus_deploy/datadog_checks/octopus_deploy/check.py +++ b/octopus_deploy/datadog_checks/octopus_deploy/check.py @@ -354,7 +354,7 @@ def _collect_machine_metrics(self, space_id): machine_slug = machine.get("Slug") roles = machine.get("Roles", []) health_status = machine.get("HealthStatus", None) - is_healthy = health_status == "Healthy" + is_healthy = health_status.startswith("Healthy") machine_tags = [ f"machine_id:{machine_id}", f"machine_name:{machine_name}", From cf47801c9a2e59bb22644e4874fe5fdc59b79ea5 Mon Sep 17 00:00:00 2001 From: Sarah Witt Date: Fri, 20 Dec 2024 10:06:54 -0500 Subject: [PATCH 4/6] validate metadata --- octopus_deploy/metadata.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/octopus_deploy/metadata.csv b/octopus_deploy/metadata.csv index be124c204daad..904d80cddf278 100644 --- a/octopus_deploy/metadata.csv +++ b/octopus_deploy/metadata.csv @@ -4,11 +4,11 @@ octopus_deploy.deployment.completed_time,gauge,,second,,Duration of deployment., octopus_deploy.deployment.count,gauge,,,,Number of deployments monitored.,-1,octopus_deploy,octopus_deploy deploy count,, octopus_deploy.deployment.executing_time,gauge,,second,,How long the deployment has been executing.,-1,octopus_deploy,octopus_deploy deploy dur,, octopus_deploy.deployment.queued_time,gauge,,second,,Time deployment was in queue.,-1,octopus_deploy,octopus_deploy deploy queue,, -octopus_deploy.machine.count,gauge,,,,Number of machines discovered.,-1,octopus_deploy,octopus_deploy machine count,, -octopus_deploy.machine.is_healthy,gauge,,,,Whether or not the machine is healthy.,-1,octopus_deploy,octopus_deploy machine health,, octopus_deploy.environment.allow_dynamic_infrastructure,gauge,,,,Whether or not the environment allows dynamic infrastructure.,-1,octopus_deploy,octopus_deploy env infra,, octopus_deploy.environment.count,gauge,,,,Number of environments discovered.,-1,octopus_deploy,octopus_deploy env count,, octopus_deploy.environment.use_guided_failure,gauge,,,,Whether or not the environment is in guided failure mode.,-1,octopus_deploy,octopus_deploy env guided failure,, +octopus_deploy.machine.count,gauge,,,,Number of machines discovered.,-1,octopus_deploy,octopus_deploy machine count,, +octopus_deploy.machine.is_healthy,gauge,,,,Whether or not the machine is healthy.,-1,octopus_deploy,octopus_deploy machine health,, octopus_deploy.project.count,gauge,,,,Number of projects discovered.,-1,octopus_deploy,octopus_deploy projects count,, octopus_deploy.project_group.count,gauge,,,,Number of project groups discovered.,-1,octopus_deploy,octopus_deploy project group count,, octopus_deploy.server_node.count,gauge,,,,Number of Octopus server nodes discovered.,-1,octopus_deploy,octopus_deploy server count,, From 69d8d131888c503d4e9ae7291878c5f113e4f035 Mon Sep 17 00:00:00 2001 From: Sarah Witt Date: Thu, 26 Dec 2024 10:51:55 -0500 Subject: [PATCH 5/6] Address comments --- .../datadog_checks/octopus_deploy/check.py | 4 +- .../machines/skip=0/take=2/response.json | 57 +++++++++- .../machines/skip=0/take=30/response.json | 105 +++++++++++++++++ .../machines/skip=2/take=2/response.json | 68 +++++++++++ octopus_deploy/tests/test_unit.py | 107 ++++++++++++++++++ 5 files changed, 338 insertions(+), 3 deletions(-) create mode 100644 octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=2/take=2/response.json diff --git a/octopus_deploy/datadog_checks/octopus_deploy/check.py b/octopus_deploy/datadog_checks/octopus_deploy/check.py index ed615c056723d..c44be512bcbef 100644 --- a/octopus_deploy/datadog_checks/octopus_deploy/check.py +++ b/octopus_deploy/datadog_checks/octopus_deploy/check.py @@ -452,13 +452,15 @@ def _collect_machine_metrics(self, space_id): machine_name = machine.get("Name") machine_slug = machine.get("Slug") roles = machine.get("Roles", []) - health_status = machine.get("HealthStatus", None) + os = machine.get("OperatingSystem") + health_status = machine.get("HealthStatus") is_healthy = health_status.startswith("Healthy") machine_tags = [ f"machine_id:{machine_id}", f"machine_name:{machine_name}", f"machine_slug:{machine_slug}", f"health_status:{health_status}", + f"operating_system:{os}", ] machine_tags += roles self.gauge("machine.count", 1, tags=self._base_tags + machine_tags) diff --git a/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=2/response.json b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=2/response.json index 93b4d1dfe10df..9f637f4095aa5 100644 --- a/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=2/response.json +++ b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=2/response.json @@ -1,8 +1,8 @@ { "ItemType": "Machine", - "TotalResults": 1, + "TotalResults": 3, "ItemsPerPage": 2, - "NumberOfPages": 1, + "NumberOfPages": 2, "LastPageNumber": 0, "Items": [ { @@ -56,6 +56,59 @@ "TasksTemplate": "/api/Spaces-1/machines/Machines-1/tasks{?skip,take,type}", "SinglyScopedVariableDetails": "/api/Spaces-1/machines/Machines-1/singlyScopedVariableDetails" } + }, + { + "Id": "Machines-2", + "EnvironmentIds": [ + "Environments-1" + ], + "Roles": [ + "test", + "tag" + ], + "TenantedDeploymentParticipation": "Untenanted", + "TenantIds": [], + "TenantTags": [], + "SpaceId": "Spaces-1", + "Name": "test-machine1", + "Thumbprint": "test-footprint1", + "Uri": "hostname-test1:10933/", + "IsDisabled": false, + "MachinePolicyId": "MachinePolicies-1", + "HealthStatus": "Healthy with warnings", + "HasLatestCalamari": false, + "StatusSummary": "Octopus was able to successfully establish a connection with this machine on Wednesday", + "IsInProcess": false, + "Endpoint": { + "CommunicationStyle": "TentaclePassive", + "ProxyId": null, + "Thumbprint": "test-footprint1", + "Uri": "hostname-test1:10933/", + "TentacleVersionDetails": { + "UpgradeLocked": false, + "Version": "8.2.2517", + "UpgradeSuggested": false, + "UpgradeRequired": false, + "UpgradeAvailable": false + }, + "CertificateSignatureAlgorithm": "sha256RSA", + "Id": null, + "LastModifiedOn": null, + "LastModifiedBy": null, + "Links": {} + }, + "OperatingSystem": "Ubuntu 24.04.1 LTS", + "ShellName": "Bash", + "ShellVersion": "5.2.21(1)-release", + "Architecture": "x86_64", + "Slug": "test-machine1", + "SkipInitialHealthCheck": false, + "Links": { + "Self": "/api/Spaces-1/machines/Machines-1", + "Connection": "/api/Spaces-1/machines/Machines-1/connection", + "TasksTemplate": "/api/Spaces-1/machines/Machines-1/tasks{?skip,take,type}", + "SinglyScopedVariableDetails": "/api/Spaces-1/machines/Machines-1/singlyScopedVariableDetails" + } } ], "Links": { diff --git a/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=30/response.json b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=30/response.json index 18b7818ffe166..095aa3518d39a 100644 --- a/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=30/response.json +++ b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=0/take=30/response.json @@ -56,6 +56,111 @@ "TasksTemplate": "/api/Spaces-1/machines/Machines-1/tasks{?skip,take,type}", "SinglyScopedVariableDetails": "/api/Spaces-1/machines/Machines-1/singlyScopedVariableDetails" } + }, + { + "Id": "Machines-2", + "EnvironmentIds": [ + "Environments-1" + ], + "Roles": [ + "test", + "tag" + ], + "TenantedDeploymentParticipation": "Untenanted", + "TenantIds": [], + "TenantTags": [], + "SpaceId": "Spaces-1", + "Name": "test-machine1", + "Thumbprint": "test-footprint1", + "Uri": "hostname-test1:10933/", + "IsDisabled": false, + "MachinePolicyId": "MachinePolicies-1", + "HealthStatus": "Healthy with warnings", + "HasLatestCalamari": false, + "StatusSummary": "Octopus was able to successfully establish a connection with this machine on Wednesday", + "IsInProcess": false, + "Endpoint": { + "CommunicationStyle": "TentaclePassive", + "ProxyId": null, + "Thumbprint": "test-footprint1", + "Uri": "hostname-test1:10933/", + "TentacleVersionDetails": { + "UpgradeLocked": false, + "Version": "8.2.2517", + "UpgradeSuggested": false, + "UpgradeRequired": false, + "UpgradeAvailable": false + }, + "CertificateSignatureAlgorithm": "sha256RSA", + "Id": null, + "LastModifiedOn": null, + "LastModifiedBy": null, + "Links": {} + }, + "OperatingSystem": "Ubuntu 24.04.1 LTS", + "ShellName": "Bash", + "ShellVersion": "5.2.21(1)-release", + "Architecture": "x86_64", + "Slug": "test-machine1", + "SkipInitialHealthCheck": false, + "Links": { + "Self": "/api/Spaces-1/machines/Machines-1", + "Connection": "/api/Spaces-1/machines/Machines-1/connection", + "TasksTemplate": "/api/Spaces-1/machines/Machines-1/tasks{?skip,take,type}", + "SinglyScopedVariableDetails": "/api/Spaces-1/machines/Machines-1/singlyScopedVariableDetails" + } + }, + { + "Id": "Machines-3", + "EnvironmentIds": [ + "Environments-1" + ], + "Roles": [ + "test" + ], + "TenantedDeploymentParticipation": "Untenanted", + "TenantIds": [], + "TenantTags": [], + "SpaceId": "Spaces-1", + "Name": "test-machine3", + "Thumbprint": "test-footprint2", + "Uri": "hostname-test2:10933/", + "IsDisabled": false, + "MachinePolicyId": "MachinePolicies-1", + "HealthStatus": "Unhealthy", + "HasLatestCalamari": false, + "StatusSummary": "Octopus was unable to successfully establish a connection with this machine on Wednesday", + "IsInProcess": false, + "Endpoint": { + "CommunicationStyle": "TentaclePassive", + "ProxyId": null, + "Thumbprint": "test-footprint3", + "Uri": "hostname-test3:10933/", + "TentacleVersionDetails": { + "UpgradeLocked": false, + "Version": "8.2.2517", + "UpgradeSuggested": false, + "UpgradeRequired": false, + "UpgradeAvailable": false + }, + "CertificateSignatureAlgorithm": "sha256RSA", + "Id": null, + "LastModifiedOn": null, + "LastModifiedBy": null, + "Links": {} + }, + "OperatingSystem": "Ubuntu 24.04.1 LTS", + "ShellName": "Bash", + "ShellVersion": "5.2.21(1)-release", + "Architecture": "x86_64", + "Slug": "test-machine3", + "SkipInitialHealthCheck": false, + "Links": { + "Self": "/api/Spaces-1/machines/Machines-1", + "Connection": "/api/Spaces-1/machines/Machines-1/connection", + "TasksTemplate": "/api/Spaces-1/machines/Machines-1/tasks{?skip,take,type}", + "SinglyScopedVariableDetails": "/api/Spaces-1/machines/Machines-1/singlyScopedVariableDetails" + } } ], "Links": { diff --git a/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=2/take=2/response.json b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=2/take=2/response.json new file mode 100644 index 0000000000000..f6d0aa5d31643 --- /dev/null +++ b/octopus_deploy/tests/fixtures/GET/api/Spaces-1/machines/skip=2/take=2/response.json @@ -0,0 +1,68 @@ +{ + "ItemType": "Machine", + "TotalResults": 1, + "ItemsPerPage": 2, + "NumberOfPages": 2, + "LastPageNumber": 0, + "Items": [ + { + "Id": "Machines-3", + "EnvironmentIds": [ + "Environments-1" + ], + "Roles": [ + "test" + ], + "TenantedDeploymentParticipation": "Untenanted", + "TenantIds": [], + "TenantTags": [], + "SpaceId": "Spaces-1", + "Name": "test-machine3", + "Thumbprint": "test-footprint2", + "Uri": "hostname-test2:10933/", + "IsDisabled": false, + "MachinePolicyId": "MachinePolicies-1", + "HealthStatus": "Unhealthy", + "HasLatestCalamari": false, + "StatusSummary": "Octopus was unable to successfully establish a connection with this machine on Wednesday", + "IsInProcess": false, + "Endpoint": { + "CommunicationStyle": "TentaclePassive", + "ProxyId": null, + "Thumbprint": "test-footprint3", + "Uri": "hostname-test3:10933/", + "TentacleVersionDetails": { + "UpgradeLocked": false, + "Version": "8.2.2517", + "UpgradeSuggested": false, + "UpgradeRequired": false, + "UpgradeAvailable": false + }, + "CertificateSignatureAlgorithm": "sha256RSA", + "Id": null, + "LastModifiedOn": null, + "LastModifiedBy": null, + "Links": {} + }, + "OperatingSystem": "Ubuntu 24.04.1 LTS", + "ShellName": "Bash", + "ShellVersion": "5.2.21(1)-release", + "Architecture": "x86_64", + "Slug": "test-machine3", + "SkipInitialHealthCheck": false, + "Links": { + "Self": "/api/Spaces-1/machines/Machines-1", + "Connection": "/api/Spaces-1/machines/Machines-1/connection", + "TasksTemplate": "/api/Spaces-1/machines/Machines-1/tasks{?skip,take,type}", + "SinglyScopedVariableDetails": "/api/Spaces-1/machines/Machines-1/singlyScopedVariableDetails" + } + } + ], + "Links": { + "Self": "/api/Spaces-1/machines?skip=0&take=30", + "Template": "/api/Spaces-1/machines{?skip,take,name,ids,partialName,roles,isDisabled,healthStatuses,commStyles,tenantIds,tenantTags,environmentIds,shellNames,deploymentTargetTypes}", + "Page.All": "/api/Spaces-1/machines?skip=0&take=2147483647", + "Page.Current": "/api/Spaces-1/machines?skip=0&take=30", + "Page.Last": "/api/Spaces-1/machines?skip=0&take=30" + } +} \ No newline at end of file diff --git a/octopus_deploy/tests/test_unit.py b/octopus_deploy/tests/test_unit.py index 52a9ba689a66a..14e82015b5e14 100644 --- a/octopus_deploy/tests/test_unit.py +++ b/octopus_deploy/tests/test_unit.py @@ -2280,6 +2280,7 @@ def test_machines_metrics( "machine_name:test-machine", "machine_slug:test-machine", "health_status:Healthy", + "operating_system:Ubuntu 24.04.1 LTS", "test-tag", ], ) @@ -2291,9 +2292,61 @@ def test_machines_metrics( "machine_name:test-machine", "machine_slug:test-machine", "health_status:Healthy", + "operating_system:Ubuntu 24.04.1 LTS", "test-tag", ], ) + aggregator.assert_metric( + "octopus_deploy.machine.count", + 1, + tags=[ + "machine_id:Machines-2", + "machine_name:test-machine1", + "machine_slug:test-machine1", + "health_status:Healthy with warnings", + "operating_system:Ubuntu 24.04.1 LTS", + "tag", + "test", + ], + ) + aggregator.assert_metric( + "octopus_deploy.machine.is_healthy", + 1, + tags=[ + "machine_id:Machines-2", + "machine_name:test-machine1", + "machine_slug:test-machine1", + "health_status:Healthy with warnings", + "operating_system:Ubuntu 24.04.1 LTS", + "test", + "tag", + ], + ) + + aggregator.assert_metric( + "octopus_deploy.machine.count", + 1, + tags=[ + "machine_id:Machines-3", + "machine_name:test-machine3", + "machine_slug:test-machine3", + "health_status:Unhealthy", + "operating_system:Ubuntu 24.04.1 LTS", + "test", + ], + ) + aggregator.assert_metric( + "octopus_deploy.machine.is_healthy", + 0, + tags=[ + "machine_id:Machines-3", + "machine_name:test-machine3", + "machine_slug:test-machine3", + "health_status:Unhealthy", + "operating_system:Ubuntu 24.04.1 LTS", + "test", + ], + ) @pytest.mark.parametrize( @@ -2310,6 +2363,7 @@ def test_machines_metrics( 2, [ (['http://localhost:80/api/Spaces-1/machines'], 0, 2), + (['http://localhost:80/api/Spaces-1/machines'], 2, 2), ], id='low limit', ), @@ -2351,6 +2405,7 @@ def test_machines_pagination( "machine_name:test-machine", "machine_slug:test-machine", "health_status:Healthy", + "operating_system:Ubuntu 24.04.1 LTS", "test-tag", ], ) @@ -2362,6 +2417,58 @@ def test_machines_pagination( "machine_name:test-machine", "machine_slug:test-machine", "health_status:Healthy", + "operating_system:Ubuntu 24.04.1 LTS", "test-tag", ], ) + aggregator.assert_metric( + "octopus_deploy.machine.count", + 1, + tags=[ + "machine_id:Machines-2", + "machine_name:test-machine1", + "machine_slug:test-machine1", + "health_status:Healthy with warnings", + "operating_system:Ubuntu 24.04.1 LTS", + "tag", + "test", + ], + ) + aggregator.assert_metric( + "octopus_deploy.machine.is_healthy", + 1, + tags=[ + "machine_id:Machines-2", + "machine_name:test-machine1", + "machine_slug:test-machine1", + "health_status:Healthy with warnings", + "operating_system:Ubuntu 24.04.1 LTS", + "test", + "tag", + ], + ) + + aggregator.assert_metric( + "octopus_deploy.machine.count", + 1, + tags=[ + "machine_id:Machines-3", + "machine_name:test-machine3", + "machine_slug:test-machine3", + "health_status:Unhealthy", + "operating_system:Ubuntu 24.04.1 LTS", + "test", + ], + ) + aggregator.assert_metric( + "octopus_deploy.machine.is_healthy", + 0, + tags=[ + "machine_id:Machines-3", + "machine_name:test-machine3", + "machine_slug:test-machine3", + "health_status:Unhealthy", + "operating_system:Ubuntu 24.04.1 LTS", + "test", + ], + ) From caac3f6869e0adc4d4c92f6db29dc07cdcab99d3 Mon Sep 17 00:00:00 2001 From: Sarah Witt Date: Fri, 27 Dec 2024 10:38:27 -0500 Subject: [PATCH 6/6] Add octopus server tag --- .../datadog_checks/octopus_deploy/check.py | 4 +- octopus_deploy/tests/constants.py | 96 ++--- octopus_deploy/tests/test_unit.py | 335 ++++++++++++++++-- 3 files changed, 354 insertions(+), 81 deletions(-) diff --git a/octopus_deploy/datadog_checks/octopus_deploy/check.py b/octopus_deploy/datadog_checks/octopus_deploy/check.py index c44be512bcbef..079918f4e6d0f 100644 --- a/octopus_deploy/datadog_checks/octopus_deploy/check.py +++ b/octopus_deploy/datadog_checks/octopus_deploy/check.py @@ -49,7 +49,9 @@ def __init__(self, name, init_config, instances): self._environments_cache = {} self._deployments_cache = TTLCache(maxsize=TTL_CACHE_MAXSIZE, ttl=TTL_CACHE_TTL) self._releases_cache = TTLCache(maxsize=TTL_CACHE_MAXSIZE, ttl=TTL_CACHE_TTL) - self._base_tags = self.instance.get("tags", []) + endpoint = self.instance.get("octopus_endpoint") + octopus_server_tag = [f"octopus_server:{endpoint}"] + self._base_tags = self.instance.get("tags", []) + octopus_server_tag self.collect_events = self.instance.get("collect_events", False) def check(self, _): diff --git a/octopus_deploy/tests/constants.py b/octopus_deploy/tests/constants.py index eec3647f7244f..dfd012313788a 100644 --- a/octopus_deploy/tests/constants.py +++ b/octopus_deploy/tests/constants.py @@ -47,7 +47,7 @@ ALL_DEPLOYMENT_LOGS = [ { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The deployment failed because one or more steps failed. Please see the deployment log for details.', @@ -56,7 +56,7 @@ 'stage_name': 'Deploy test release 0.0.2 to Development', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'hello', @@ -65,7 +65,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': "The step failed: Activity Run a Script on the Octopus Server failed with error " @@ -75,7 +75,7 @@ 'stage_name': 'Step 2: Run a Script', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'ParserError: At /home/octopus/.octopus/OctopusServer/Server/Work/' @@ -85,7 +85,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': '+ echo "stop', @@ -94,7 +94,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': '+ ~~~~~', @@ -103,7 +103,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The string is missing the terminator: ".', @@ -112,7 +112,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'At /home/octopus/.octopus/OctopusServer/Server/Work/09234928998123-1847-68/Script.ps1:1 char:6', @@ -121,7 +121,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': '+ echo "stop', @@ -130,7 +130,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': '+ ~~~~~', @@ -139,7 +139,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , : line 1', @@ -148,7 +148,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , /home/octopus/.octopus/OctopusServer/Server/Work/' @@ -158,7 +158,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , /home/octopus/.octopus/OctopusServer/Server/Work/' @@ -168,7 +168,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , : line 1', @@ -177,7 +177,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , : line 1', @@ -186,7 +186,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The remote script failed with exit code 1', @@ -195,7 +195,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The action Run a Script on the Octopus Server failed', @@ -204,7 +204,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-18,release_version:0.0.1,environment_name:staging,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-18,release_version:0.0.1,environment_name:staging,' 'space_name:Default,project_name:test,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The deployment completed successfully.', @@ -213,7 +213,7 @@ 'stage_name': 'Deploy test release 0.0.1 to Staging', }, { - 'ddtags': 'deployment_id:Deployments-18,release_version:0.0.1,environment_name:staging,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-18,release_version:0.0.1,environment_name:staging,' 'space_name:Default,project_name:test,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'hello', @@ -222,7 +222,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-17,release_version:0.0.1,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-17,release_version:0.0.1,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The deployment completed successfully.', @@ -231,7 +231,7 @@ 'stage_name': 'Deploy test release 0.0.1 to Development', }, { - 'ddtags': 'deployment_id:Deployments-17,release_version:0.0.1,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-17,release_version:0.0.1,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'hello', @@ -240,7 +240,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-16,release_version:0.1.5,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-16,release_version:0.1.5,environment_name:dev,' 'space_name:Default,project_name:test-api,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The deployment completed successfully.', @@ -249,7 +249,7 @@ 'stage_name': 'Deploy test-api release 0.1.5 to Development', }, { - 'ddtags': 'deployment_id:Deployments-16,release_version:0.1.5,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-16,release_version:0.1.5,environment_name:dev,' 'space_name:Default,project_name:test-api,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'Testing', @@ -258,7 +258,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-16,release_version:0.1.5,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-16,release_version:0.1.5,environment_name:dev,' 'space_name:Default,project_name:test-api,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'test', @@ -270,7 +270,7 @@ ONLY_TEST_LOGS = [ { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The deployment failed because one or more steps failed. Please see the deployment log for details.', @@ -279,7 +279,7 @@ 'stage_name': 'Deploy test release 0.0.2 to Development', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'hello', @@ -288,7 +288,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': "The step failed: Activity Run a Script on the Octopus Server failed with error" @@ -298,7 +298,7 @@ 'stage_name': 'Step 2: Run a Script', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'ParserError: At /home/octopus/.octopus/OctopusServer/Server/Work/' @@ -308,7 +308,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': '+ echo "stop', @@ -317,7 +317,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': '+ ~~~~~', @@ -326,7 +326,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The string is missing the terminator: ".', @@ -335,7 +335,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'At /home/octopus/.octopus/OctopusServer/Server/Work/' '09234928998123-1847-68/Script.ps1:1 char:6', @@ -344,7 +344,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': '+ echo "stop', @@ -353,7 +353,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': '+ ~~~~~', @@ -362,7 +362,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , : line 1', @@ -371,7 +371,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , /home/octopus/.octopus/OctopusServer/Server/Work/' @@ -381,7 +381,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , /home/octopus/.octopus/OctopusServer/Server/Work/' @@ -391,7 +391,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , : line 1', @@ -400,7 +400,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'at , : line 1', @@ -409,7 +409,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The remote script failed with exit code 1', @@ -418,7 +418,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-19,release_version:0.0.2,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Failed,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The action Run a Script on the Octopus Server failed', @@ -427,7 +427,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-18,release_version:0.0.1,environment_name:staging,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-18,release_version:0.0.1,environment_name:staging,' 'space_name:Default,project_name:test,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The deployment completed successfully.', @@ -436,7 +436,7 @@ 'stage_name': 'Deploy test release 0.0.1 to Staging', }, { - 'ddtags': 'deployment_id:Deployments-18,release_version:0.0.1,environment_name:staging,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-18,release_version:0.0.1,environment_name:staging,' 'space_name:Default,project_name:test,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'hello', @@ -445,7 +445,7 @@ 'stage_name': 'Octopus Server', }, { - 'ddtags': 'deployment_id:Deployments-17,release_version:0.0.1,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-17,release_version:0.0.1,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'The deployment completed successfully.', @@ -454,7 +454,7 @@ 'stage_name': 'Deploy test release 0.0.1 to Development', }, { - 'ddtags': 'deployment_id:Deployments-17,release_version:0.0.1,environment_name:dev,' + 'ddtags': 'octopus_server:http://localhost:80,deployment_id:Deployments-17,release_version:0.0.1,environment_name:dev,' 'space_name:Default,project_name:test,task_state:Success,' 'server_node:OctopusServerNodes-50c3dfbarc82', 'message': 'hello', @@ -467,14 +467,14 @@ ALL_EVENTS = [ { 'message': 'Machine test is unhealthy', - 'tags': ['space_name:Default'], + 'tags': ['octopus_server:http://localhost:80', 'space_name:Default'], }, { 'message': 'Deploy to dev failed for new-project-from-group release 0.0.2 to dev', - 'tags': ['space_name:Default'], + 'tags': ['octopus_server:http://localhost:80', 'space_name:Default'], }, { 'message': 'Deploy to dev failed for project-new-2 release 0.0.2 to dev', - 'tags': ['space_name:Default'], + 'tags': ['octopus_server:http://localhost:80', 'space_name:Default'], }, ] diff --git a/octopus_deploy/tests/test_unit.py b/octopus_deploy/tests/test_unit.py index 14e82015b5e14..454cdc4b28b00 100644 --- a/octopus_deploy/tests/test_unit.py +++ b/octopus_deploy/tests/test_unit.py @@ -112,7 +112,11 @@ def test_one_space(get_current_datetime, dd_run_check, aggregator): dd_run_check(check) - aggregator.assert_metric('octopus_deploy.space.count', 1, tags=['space_id:Spaces-1', 'space_name:Default']) + aggregator.assert_metric( + 'octopus_deploy.space.count', + 1, + tags=['octopus_server:http://localhost:80', 'space_id:Spaces-1', 'space_name:Default'], + ) @pytest.mark.usefixtures('mock_http_get') @@ -127,17 +131,32 @@ def test_project_groups(get_current_datetime, dd_run_check, aggregator): aggregator.assert_metric( 'octopus_deploy.project_group.count', 1, - tags=['project_group_id:ProjectGroups-1', 'project_group_name:Default Project Group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-1', + 'project_group_name:Default Project Group', + 'space_name:Default', + ], ) aggregator.assert_metric( 'octopus_deploy.project_group.count', 1, - tags=['project_group_id:ProjectGroups-2', 'project_group_name:test-group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-2', + 'project_group_name:test-group', + 'space_name:Default', + ], ) aggregator.assert_metric( 'octopus_deploy.project_group.count', 1, - tags=['project_group_id:ProjectGroups-3', 'project_group_name:hello', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-3', + 'project_group_name:hello', + 'space_name:Default', + ], ) @@ -154,6 +173,7 @@ def test_projects(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.project.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'project_id:Projects-1', 'project_name:test-api', 'project_group_name:Default Project Group', @@ -164,6 +184,7 @@ def test_projects(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.project.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'project_id:Projects-2', 'project_name:my-project', 'project_group_name:Default Project Group', @@ -174,6 +195,7 @@ def test_projects(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.project.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'project_id:Projects-3', 'project_name:test', 'project_group_name:Default Project Group', @@ -183,7 +205,13 @@ def test_projects(get_current_datetime, dd_run_check, aggregator): aggregator.assert_metric( 'octopus_deploy.project.count', 1, - tags=['project_id:Projects-4', 'project_name:hi', 'project_group_name:test-group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_id:Projects-4', + 'project_name:hi', + 'project_group_name:test-group', + 'space_name:Default', + ], ) @@ -200,6 +228,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 'octopus_deploy.deployment.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Executing', 'project_name:my-project', 'space_name:Default', @@ -213,6 +242,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 'octopus_deploy.deployment.queued_time', 30, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Executing', 'project_name:my-project', 'space_name:Default', @@ -226,6 +256,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 'octopus_deploy.deployment.executing_time', 150, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Executing', 'project_name:my-project', 'space_name:Default', @@ -240,6 +271,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 0, count=0, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Executing', 'project_name:my-project', 'space_name:Default', @@ -254,6 +286,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 1, count=1, tags=[ + 'octopus_server:http://localhost:80', 'deployment_id:Deployments-18', 'release_version:0.0.1', 'environment_name:staging', @@ -268,6 +301,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 0, count=1, tags=[ + 'octopus_server:http://localhost:80', 'deployment_id:Deployments-18', 'release_version:0.0.1', 'environment_name:staging', @@ -282,6 +316,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 1, count=1, tags=[ + 'octopus_server:http://localhost:80', 'deployment_id:Deployments-18', 'release_version:0.0.1', 'environment_name:staging', @@ -295,6 +330,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 'octopus_deploy.deployment.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Queued', 'project_name:test', 'space_name:Default', @@ -308,6 +344,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 'octopus_deploy.deployment.queued_time', 60, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Queued', 'project_name:test', 'space_name:Default', @@ -322,6 +359,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 0, count=0, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Queued', 'project_name:test', 'space_name:Default', @@ -336,6 +374,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 0, count=0, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Queued', 'project_name:test', 'space_name:Default', @@ -350,6 +389,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 0, count=1, tags=[ + 'octopus_server:http://localhost:80', 'deployment_id:Deployments-19', 'release_version:0.0.2', 'environment_name:dev', @@ -364,6 +404,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 1, count=1, tags=[ + 'octopus_server:http://localhost:80', 'deployment_id:Deployments-19', 'release_version:0.0.2', 'environment_name:dev', @@ -378,6 +419,7 @@ def test_queued_or_running_tasks(get_current_datetime, dd_run_check, aggregator) 0, count=1, tags=[ + 'octopus_server:http://localhost:80', 'deployment_id:Deployments-19', 'release_version:0.0.2', 'environment_name:dev', @@ -400,6 +442,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'project_name:test', 'space_name:Default', 'server_node:None', @@ -413,6 +456,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'project_name:my-project', 'server_node:OctopusServerNodes-50c3dfbarc82', @@ -433,6 +477,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -446,6 +491,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.queued_time', 110, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -459,6 +505,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.executing_time', 50, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -472,6 +519,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.completed_time', 5, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -485,6 +533,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -498,6 +547,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.queued_time', 90, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -511,6 +561,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.executing_time', 54, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -524,6 +575,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.completed_time', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -536,6 +588,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -549,6 +602,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.queued_time', 18, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -562,6 +616,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.executing_time', 41, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -575,6 +630,7 @@ def test_completed_tasks(get_current_datetime, dd_run_check, aggregator): 'octopus_deploy.deployment.completed_time', 14, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -627,8 +683,15 @@ def test_discovery_spaces(get_current_datetime, dd_run_check, aggregator): get_current_datetime.return_value = MOCKED_TIME1 dd_run_check(check) - aggregator.assert_metric('octopus_deploy.space.count', tags=['space_name:Default', 'space_name:First'], count=0) - aggregator.assert_metric('octopus_deploy.space.count', tags=['space_id:Spaces-2', 'space_name:Second']) + aggregator.assert_metric( + 'octopus_deploy.space.count', + tags=['octopus_server:http://localhost:80', 'space_name:Default', 'space_name:First'], + count=0, + ) + aggregator.assert_metric( + 'octopus_deploy.space.count', + tags=['octopus_server:http://localhost:80', 'space_id:Spaces-2', 'space_name:Second'], + ) @pytest.mark.usefixtures('mock_http_get') @@ -647,18 +710,33 @@ def test_discovery_default_project_groups(get_current_datetime, dd_run_check, ag aggregator.assert_metric( 'octopus_deploy.project_group.count', - tags=['project_group_id:ProjectGroups-1', 'project_group_name:Default Project Group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-1', + 'project_group_name:Default Project Group', + 'space_name:Default', + ], count=0, ) aggregator.assert_metric( 'octopus_deploy.project_group.count', - tags=['project_group_id:ProjectGroups-2', 'project_group_name:test-group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-2', + 'project_group_name:test-group', + 'space_name:Default', + ], count=0, ) aggregator.assert_metric( 'octopus_deploy.project_group.count', 1, - tags=['project_group_id:ProjectGroups-3', 'project_group_name:hello', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-3', + 'project_group_name:hello', + 'space_name:Default', + ], ) @@ -686,18 +764,33 @@ def test_discovery_space_project_groups(get_current_datetime, dd_run_check, aggr aggregator.assert_metric( 'octopus_deploy.project_group.count', - tags=['project_group_id:ProjectGroups-1', 'project_group_name:Default Project Group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-1', + 'project_group_name:Default Project Group', + 'space_name:Default', + ], count=0, ) aggregator.assert_metric( 'octopus_deploy.project_group.count', - tags=['project_group_id:ProjectGroups-2', 'project_group_name:test-group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-2', + 'project_group_name:test-group', + 'space_name:Default', + ], count=0, ) aggregator.assert_metric( 'octopus_deploy.project_group.count', 1, - tags=['project_group_id:ProjectGroups-3', 'project_group_name:hello', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-3', + 'project_group_name:hello', + 'space_name:Default', + ], ) @@ -719,6 +812,7 @@ def test_discovery_default_projects(get_current_datetime, dd_run_check, aggregat 'octopus_deploy.project.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'project_id:Projects-1', 'project_name:test-api', 'project_group_name:Default Project Group', @@ -728,6 +822,7 @@ def test_discovery_default_projects(get_current_datetime, dd_run_check, aggregat aggregator.assert_metric( 'octopus_deploy.project.count', tags=[ + 'octopus_server:http://localhost:80', 'project_id:Projects-2', 'project_name:my-project', 'project_group_name:Default Project Group', @@ -738,6 +833,7 @@ def test_discovery_default_projects(get_current_datetime, dd_run_check, aggregat aggregator.assert_metric( 'octopus_deploy.project.count', tags=[ + 'octopus_server:http://localhost:80', 'project_name:test', 'project_name:test', 'project_group_name:Default Project Group', @@ -747,7 +843,13 @@ def test_discovery_default_projects(get_current_datetime, dd_run_check, aggregat ) aggregator.assert_metric( 'octopus_deploy.project.count', - tags=['project_id:Projects-4', 'project_name:hi', 'project_group_name:test-group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_id:Projects-4', + 'project_name:hi', + 'project_group_name:test-group', + 'space_name:Default', + ], count=0, ) @@ -784,18 +886,33 @@ def test_discovery_space_project_group_projects(get_current_datetime, dd_run_che aggregator.assert_metric( 'octopus_deploy.project_group.count', - tags=['project_group_id:ProjectGroups-1', 'project_group_name:Default Project Group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-1', + 'project_group_name:Default Project Group', + 'space_name:Default', + ], count=0, ) aggregator.assert_metric( 'octopus_deploy.project_group.count', - tags=['project_group_id:ProjectGroups-2', 'project_group_name:test-group', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-2', + 'project_group_name:test-group', + 'space_name:Default', + ], count=0, ) aggregator.assert_metric( 'octopus_deploy.project_group.count', 1, - tags=['project_group_id:ProjectGroups-3', 'project_group_name:hello', 'space_name:Default'], + tags=[ + 'octopus_server:http://localhost:80', + 'project_group_id:ProjectGroups-3', + 'project_group_name:hello', + 'space_name:Default', + ], ) @@ -939,6 +1056,7 @@ def test_server_node_metrics(get_current_datetime, dd_run_check, aggregator): 1, count=1, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -948,6 +1066,7 @@ def test_server_node_metrics(get_current_datetime, dd_run_check, aggregator): 5, count=1, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -957,6 +1076,7 @@ def test_server_node_metrics(get_current_datetime, dd_run_check, aggregator): 0, count=1, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -992,6 +1112,7 @@ def test_server_node_endpoint_failed(get_current_datetime, dd_run_check, aggrega 1, count=0, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -1001,6 +1122,7 @@ def test_server_node_endpoint_failed(get_current_datetime, dd_run_check, aggrega 5, count=0, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -1010,6 +1132,7 @@ def test_server_node_endpoint_failed(get_current_datetime, dd_run_check, aggrega 5, count=0, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -1081,12 +1204,19 @@ def test_environment_metrics(get_current_datetime, dd_run_check, aggregator): aggregator.assert_metric( 'octopus_deploy.environment.count', value=1, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.count', value=1, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1097,12 +1227,19 @@ def test_environment_metrics(get_current_datetime, dd_run_check, aggregator): aggregator.assert_metric( 'octopus_deploy.environment.use_guided_failure', value=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.use_guided_failure', value=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1113,12 +1250,19 @@ def test_environment_metrics(get_current_datetime, dd_run_check, aggregator): aggregator.assert_metric( 'octopus_deploy.environment.allow_dynamic_infrastructure', value=1, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.allow_dynamic_infrastructure', value=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1138,12 +1282,19 @@ def test_environments_discovery_one_include(get_current_datetime, dd_run_check, aggregator.assert_metric( 'octopus_deploy.environment.count', value=1, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.count', value=1, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1155,12 +1306,19 @@ def test_environments_discovery_one_include(get_current_datetime, dd_run_check, aggregator.assert_metric( 'octopus_deploy.environment.use_guided_failure', value=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.use_guided_failure', value=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1172,12 +1330,19 @@ def test_environments_discovery_one_include(get_current_datetime, dd_run_check, aggregator.assert_metric( 'octopus_deploy.environment.allow_dynamic_infrastructure', value=1, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.allow_dynamic_infrastructure', value=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1202,12 +1367,19 @@ def test_environments_discovery_exclude_dev(get_current_datetime, dd_run_check, 'octopus_deploy.environment.count', value=1, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.count', value=1, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1219,12 +1391,19 @@ def test_environments_discovery_exclude_dev(get_current_datetime, dd_run_check, 'octopus_deploy.environment.use_guided_failure', value=0, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.use_guided_failure', value=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1236,12 +1415,19 @@ def test_environments_discovery_exclude_dev(get_current_datetime, dd_run_check, 'octopus_deploy.environment.allow_dynamic_infrastructure', value=1, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.allow_dynamic_infrastructure', value=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1266,13 +1452,20 @@ def test_environments_discovery_include_invalid(get_current_datetime, dd_run_che 'octopus_deploy.environment.count', value=1, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.count', value=1, count=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1284,13 +1477,20 @@ def test_environments_discovery_include_invalid(get_current_datetime, dd_run_che 'octopus_deploy.environment.use_guided_failure', value=0, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.use_guided_failure', value=0, count=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1302,13 +1502,20 @@ def test_environments_discovery_include_invalid(get_current_datetime, dd_run_che 'octopus_deploy.environment.allow_dynamic_infrastructure', value=1, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.allow_dynamic_infrastructure', value=0, count=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1350,13 +1557,20 @@ def test_environments_metrics_http_failure(get_current_datetime, dd_run_check, a 'octopus_deploy.environment.count', value=1, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.count', value=1, count=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1368,13 +1582,20 @@ def test_environments_metrics_http_failure(get_current_datetime, dd_run_check, a 'octopus_deploy.environment.use_guided_failure', value=0, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.use_guided_failure', value=0, count=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1386,13 +1607,20 @@ def test_environments_metrics_http_failure(get_current_datetime, dd_run_check, a 'octopus_deploy.environment.allow_dynamic_infrastructure', value=1, count=0, - tags=['space_name:Default', 'environment_name:dev', 'environment_slug:dev', 'environment_id:Environments-1'], + tags=[ + 'octopus_server:http://localhost:80', + 'space_name:Default', + 'environment_name:dev', + 'environment_slug:dev', + 'environment_id:Environments-1', + ], ) aggregator.assert_metric( 'octopus_deploy.environment.allow_dynamic_infrastructure', value=0, count=0, tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'environment_name:staging', 'environment_slug:staging', @@ -1429,6 +1657,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'project_name:test', 'space_name:Default', 'server_node:None', @@ -1442,6 +1671,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'project_name:my-project', 'server_node:OctopusServerNodes-50c3dfbarc82', @@ -1462,6 +1692,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -1475,6 +1706,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.queued_time', 110, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -1488,6 +1720,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.executing_time', 50, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -1501,6 +1734,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.completed_time', 5, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -1514,6 +1748,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1527,6 +1762,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.queued_time', 90, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1540,6 +1776,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.executing_time', 54, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1553,6 +1790,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.completed_time', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1565,6 +1803,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1578,6 +1817,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.queued_time', 18, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1591,6 +1831,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.executing_time', 41, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1604,6 +1845,7 @@ def test_deployment_metrics_releases_http_failure(get_current_datetime, dd_run_c 'octopus_deploy.deployment.completed_time', 14, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1645,6 +1887,7 @@ def test_deployment_metrics_deployments_http_failure( aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'project_name:test', 'space_name:Default', 'server_node:None', @@ -1658,6 +1901,7 @@ def test_deployment_metrics_deployments_http_failure( aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'space_name:Default', 'project_name:my-project', 'server_node:OctopusServerNodes-50c3dfbarc82', @@ -1678,6 +1922,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -1691,6 +1936,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.queued_time', 110, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -1704,6 +1950,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.executing_time', 50, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -1717,6 +1964,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.completed_time', 5, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Failed', 'project_name:test', 'space_name:Default', @@ -1730,6 +1978,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.count', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1744,6 +1993,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.queued_time', 90, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1758,6 +2008,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.executing_time', 54, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1772,6 +2023,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.completed_time', 1, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1785,6 +2037,7 @@ def test_deployment_metrics_deployments_http_failure( aggregator.assert_metric( 'octopus_deploy.deployment.count', tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1798,6 +2051,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.queued_time', 18, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1811,6 +2065,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.executing_time', 41, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1824,6 +2079,7 @@ def test_deployment_metrics_deployments_http_failure( 'octopus_deploy.deployment.completed_time', 14, tags=[ + 'octopus_server:http://localhost:80', 'task_state:Success', 'project_name:test', 'space_name:Default', @@ -1934,6 +2190,7 @@ def test_paginated_limit_octopusservernodes( 1, count=1, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -1943,6 +2200,7 @@ def test_paginated_limit_octopusservernodes( 5, count=1, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -1952,6 +2210,7 @@ def test_paginated_limit_octopusservernodes( 0, count=1, tags=[ + 'octopus_server:http://localhost:80', 'server_node_id:OctopusServerNodes-octopus-i8932-79236734bc234-09h234n', 'server_node_name:octopus-i8932-79236734bc234-09h234n', ], @@ -2276,6 +2535,7 @@ def test_machines_metrics( "octopus_deploy.machine.count", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-1", "machine_name:test-machine", "machine_slug:test-machine", @@ -2288,6 +2548,7 @@ def test_machines_metrics( "octopus_deploy.machine.is_healthy", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-1", "machine_name:test-machine", "machine_slug:test-machine", @@ -2300,6 +2561,7 @@ def test_machines_metrics( "octopus_deploy.machine.count", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-2", "machine_name:test-machine1", "machine_slug:test-machine1", @@ -2313,6 +2575,7 @@ def test_machines_metrics( "octopus_deploy.machine.is_healthy", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-2", "machine_name:test-machine1", "machine_slug:test-machine1", @@ -2327,6 +2590,7 @@ def test_machines_metrics( "octopus_deploy.machine.count", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-3", "machine_name:test-machine3", "machine_slug:test-machine3", @@ -2339,6 +2603,7 @@ def test_machines_metrics( "octopus_deploy.machine.is_healthy", 0, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-3", "machine_name:test-machine3", "machine_slug:test-machine3", @@ -2401,6 +2666,7 @@ def test_machines_pagination( "octopus_deploy.machine.count", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-1", "machine_name:test-machine", "machine_slug:test-machine", @@ -2413,6 +2679,7 @@ def test_machines_pagination( "octopus_deploy.machine.is_healthy", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-1", "machine_name:test-machine", "machine_slug:test-machine", @@ -2425,6 +2692,7 @@ def test_machines_pagination( "octopus_deploy.machine.count", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-2", "machine_name:test-machine1", "machine_slug:test-machine1", @@ -2438,6 +2706,7 @@ def test_machines_pagination( "octopus_deploy.machine.is_healthy", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-2", "machine_name:test-machine1", "machine_slug:test-machine1", @@ -2452,6 +2721,7 @@ def test_machines_pagination( "octopus_deploy.machine.count", 1, tags=[ + 'octopus_server:http://localhost:80', "machine_id:Machines-3", "machine_name:test-machine3", "machine_slug:test-machine3", @@ -2464,6 +2734,7 @@ def test_machines_pagination( "octopus_deploy.machine.is_healthy", 0, tags=[ + "octopus_server:http://localhost:80", "machine_id:Machines-3", "machine_name:test-machine3", "machine_slug:test-machine3",