Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scalr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG - Scalr

## 1.1.0 / 2026-11-23

***Added***:

* Report the number of AI-assisted runs in a Scalr account as `scalr.runs.ai_assisted.count`.

## 1.0.0 / 2022-12-07

***Added***:
Expand Down
2 changes: 1 addition & 1 deletion scalr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For the Datadog Agent v7.21 or v6.21 and later, follow these instructions to ins
1. Run the following command to install the Agent integration:

```shell
datadog-agent integration install -t datadog-scalr==1.0.0
datadog-agent integration install -t datadog-scalr==1.1.0
```

2. Configure your integration similar to an Agent-based [integration][3].
Expand Down
2 changes: 1 addition & 1 deletion scalr/datadog_checks/scalr/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.0'
__version__ = '1.1.0'
1 change: 1 addition & 0 deletions scalr/datadog_checks/scalr/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ScalrCheck(AgentCheck):
"environments-count": "environments.count",
"workspaces-count": "workspaces.count",
"runs-count": "runs.count",
"runs-ai-assisted-count": "runs.ai_assisted.count",
"runs-successful": "runs.successful",
"runs-failed": "runs.failed",
"runs-awaiting-confirmation": "runs.awaiting_confirmation",
Expand Down
1 change: 1 addition & 0 deletions scalr/metadata.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ metric_name,metric_type,interval,unit_name,per_unit_name,description,orientation
scalr.environments.count,gauge,,unit,,The number of environments.,0,scalr_community_version,environments count,
scalr.workspaces.count,gauge,,unit,,The number of workspaces.,0,scalr_community_version,workspaces count,
scalr.runs.count,gauge,,unit,,The number of runs.,0,scalr_community_version,runs count,
scalr.runs.ai_assisted.count,gauge,,unit,,The number of AI-assisted runs in the account.,0,scalr_community_version,AI-assisted runs count,
scalr.runs.successful,gauge,,unit,,The number of successful runs.,0,scalr_community_version,successful runs count,
scalr.runs.failed,gauge,,unit,,The number of failed runs.,0,scalr_community_version,failed runs count,
scalr.runs.awaiting_confirmation,gauge,,unit,,The number of runs awaiting confirmation.,0,scalr_community_version,waiting confirmation runs count,
Expand Down
49 changes: 30 additions & 19 deletions scalr/tests/test_scalr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Any, Callable, Dict # noqa: F401

import pytest

from datadog_checks.base import AgentCheck # noqa: F401
from datadog_checks.base.stubs.aggregator import AggregatorStub # noqa: F401
from datadog_checks.dev.utils import get_metadata_metrics
Expand Down Expand Up @@ -35,29 +37,30 @@
'''


def test_check(dd_run_check, aggregator, instance, requests_mock):
# type: (Callable[[AgentCheck, bool], None], AggregatorStub, Dict[str, Any]) -> None
@pytest.mark.parametrize('ai_metrics', [{}, {'runs-ai-assisted-count': 0}, {'runs-ai-assisted-count': 3}])
def test_check(dd_run_check, aggregator, instance, requests_mock, ai_metrics):
# type: (Callable[[AgentCheck, bool], None], AggregatorStub, Dict[str, Any], Any, Dict[str, int]) -> None

SCALR_METRICS_RESPONSE = '''
{
"billings-flex-runs-count": 0,
"billings-flex-runs-minutes-count": 0,
"billings-run-minutes-count": 50,
"billings-runs-count": 10,
"environments-count": 4,
"quota-max-concurrency": 10,
"runs-awaiting-confirmation": 1,
"runs-concurrency": 0,
"runs-count": 10,
"runs-failed": 2,
"runs-queue-size": 2,
"runs-successful": 6,
"workspaces-count": 3
}'''
metrics_response = {
"billings-flex-runs-count": 0,
"billings-flex-runs-minutes-count": 0,
"billings-run-minutes-count": 50,
"billings-runs-count": 10,
"environments-count": 4,
"quota-max-concurrency": 10,
"runs-awaiting-confirmation": 1,
"runs-concurrency": 0,
"runs-count": 10,
"runs-failed": 2,
"runs-queue-size": 2,
"runs-successful": 6,
"workspaces-count": 3,
**ai_metrics,
}

requests_mock.get(
'http://acc_name.localhost/api/iacp/v3/accounts/acc-test/metrics',
text=SCALR_METRICS_RESPONSE,
json=metrics_response,
)

requests_mock.get(
Expand All @@ -71,6 +74,14 @@ def test_check(dd_run_check, aggregator, instance, requests_mock):
for metric_name in SCALR_ACCOUNT_METRICS:
aggregator.assert_metric('scalr.' + metric_name)

metric = 'scalr.runs.ai_assisted.count'
if ai_metrics:
aggregator.assert_metric(
metric, value=ai_metrics['runs-ai-assisted-count'], metric_type=aggregator.GAUGE, count=1
)
else:
aggregator.assert_metric(metric, count=0)

aggregator.assert_all_metrics_covered()
aggregator.assert_metrics_using_metadata(get_metadata_metrics())
aggregator.assert_service_check('scalr.can_connect', ScalrCheck.OK)
Expand Down
Loading