Skip to content

Commit

Permalink
refactor: prefix metrics with aws_
Browse files Browse the repository at this point in the history
  • Loading branch information
js-timbirkett committed Jun 21, 2021
1 parent 7088d0f commit 4afa8d6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,61 +35,61 @@ Configuration with environment variables:
### Exported Metrics
The metrics currently exported are:

#### `ecr_repository_count`
#### `aws_ecr_repository_count`
- **Type:** Gauge
- **Description:** The count of all repositories in this ECR registry
- **Example:**
```
# HELP ecr_repository_count Total count of all ECR repositories
# TYPE ecr_repository_count gauge
ecr_repository_count{registry_id="112233445566"} 171.0
# HELP aws_ecr_repository_count Total count of all ECR repositories
# TYPE aws_ecr_repository_count gauge
aws_ecr_repository_count{registry_id="112233445566"} 171.0
```

#### `ecr_repository_info`
#### `aws_ecr_repository_info`
- **Type:** Info (Gauge)
- **Description:** Key/value labels relating to each repository
- **Example:**
```
# HELP ecr_repository_info ECR repository information
# TYPE ecr_repository_info gauge
ecr_repository_info{encryption_type="AES256",name="flimflam",registry_id="112233445566",repository_uri="112233445566.dkr.ecr.eu-west-1.amazonaws.com/flimflam",scan_on_push="false",tag_mutability="MUTABLE"} 1.0
ecr_repository_info{encryption_type="AES256",name="flipflop",registry_id="112233445566",repository_uri="112233445566.dkr.ecr.eu-west-1.amazonaws.com/flipflop",scan_on_push="true",tag_mutability="IMMUTABLE"} 1.0
ecr_repository_info{encryption_type="AES256",name="parcel-bird",registry_id="112233445566",repository_uri="112233445566.dkr.ecr.eu-west-1.amazonaws.com/parcel-bird",scan_on_push="true",tag_mutability="MUTABLE"} 1.0
# HELP aws_ecr_repository_info ECR repository information
# TYPE aws_ecr_repository_info gauge
aws_ecr_repository_info{encryption_type="AES256",name="flimflam",registry_id="112233445566",repository_uri="112233445566.dkr.ecr.eu-west-1.amazonaws.com/flimflam",scan_on_push="false",tag_mutability="MUTABLE"} 1.0
aws_ecr_repository_info{encryption_type="AES256",name="flipflop",registry_id="112233445566",repository_uri="112233445566.dkr.ecr.eu-west-1.amazonaws.com/flipflop",scan_on_push="true",tag_mutability="IMMUTABLE"} 1.0
aws_ecr_repository_info{encryption_type="AES256",name="parcel-bird",registry_id="112233445566",repository_uri="112233445566.dkr.ecr.eu-west-1.amazonaws.com/parcel-bird",scan_on_push="true",tag_mutability="MUTABLE"} 1.0
....
....
```

#### `ecr_image_size_in_bytes`
#### `aws_ecr_image_size_in_bytes`
- **Type:** Gauge
- **Description:** The size in bytes of each TAGGED image in each repository
- **Example:**
```
# HELP ecr_image_size_in_bytes The size of an image in bytes
# TYPE ecr_image_size_in_bytes gauge
ecr_image_size_in_bytes{digest="sha256:046c3c95cfd4ab660947885571130d34fef6fd5ddabb3ef84ac7fd7b79e4b8f1",name="flimflam",registry_id="112233445566",tag="1df508a3"} 9.1320109e+07
ecr_image_size_in_bytes{digest="sha256:10bcbc280f1bc017e767a2fc1ecb37085979dd0807fe312411ee9d3abc78f0b6",name="flimflam",registry_id="112233445566",tag="v1.0.41"} 9.1054438e+07
ecr_image_size_in_bytes{digest="sha256:b869d1ffa62b8aba6ac3e26056acacf276425287513bcc77317fa9d2b607c054",name="flimflam",registry_id="112233445566",tag="8fd066ee"} 9.1161959e+07
ecr_image_size_in_bytes{digest="sha256:9f47a709e9bea292ce1906f216df5f080493403b45c5b3e9fbe43e1c10733da6",name="flipflop",registry_id="112233445566",tag="v0.0.2"} 2.46800685e+08
ecr_image_size_in_bytes{digest="sha256:9f47a709e9bea292ce1906f216df5f080493403b45c5b3e9fbe43e1c10733da6",name="flipflop",registry_id="112233445566",tag="v0.0.1"} 2.46800685e+08
# HELP aws_ecr_image_size_in_bytes The size of an image in bytes
# TYPE aws_ecr_image_size_in_bytes gauge
aws_ecr_image_size_in_bytes{digest="sha256:046c3c95cfd4ab660947885571130d34fef6fd5ddabb3ef84ac7fd7b79e4b8f1",name="flimflam",registry_id="112233445566",tag="1df508a3"} 9.1320109e+07
aws_ecr_image_size_in_bytes{digest="sha256:10bcbc280f1bc017e767a2fc1ecb37085979dd0807fe312411ee9d3abc78f0b6",name="flimflam",registry_id="112233445566",tag="v1.0.41"} 9.1054438e+07
aws_ecr_image_size_in_bytes{digest="sha256:b869d1ffa62b8aba6ac3e26056acacf276425287513bcc77317fa9d2b607c054",name="flimflam",registry_id="112233445566",tag="8fd066ee"} 9.1161959e+07
aws_ecr_image_size_in_bytes{digest="sha256:9f47a709e9bea292ce1906f216df5f080493403b45c5b3e9fbe43e1c10733da6",name="flipflop",registry_id="112233445566",tag="v0.0.2"} 2.46800685e+08
aws_ecr_image_size_in_bytes{digest="sha256:9f47a709e9bea292ce1906f216df5f080493403b45c5b3e9fbe43e1c10733da6",name="flipflop",registry_id="112233445566",tag="v0.0.1"} 2.46800685e+08
....
....
```

#### `ecr_image_scan_severity_count`
#### `aws_ecr_image_scan_severity_count`
- **Type:** Gauge
- **Description:** Scan result counts per image/tag/ by severity
- **Example:**
```
# HELP ecr_image_scan_severity_count ECR image scan summary results
# TYPE ecr_image_scan_severity_count gauge
ecr_image_scan_severity_count{digest="sha256:0b26628c113374546c4790e01bce65c3f4642db063286f16fe13e256923b2689",name="flimflam",registry_id="112233445566",severity="MEDIUM",tag="5a35d50d"} 5.0
ecr_image_scan_severity_count{digest="sha256:a910ed7e15cb5fc7e5f0f2294f8028b56689be563bd1d352a4254197739dfa8e",name="flipflop",registry_id="112233445566",severity="MEDIUM",tag="2faa6445"} 3.0
ecr_image_scan_severity_count{digest="sha256:a910ed7e15cb5fc7e5f0f2294f8028b56689be563bd1d352a4254197739dfa8e",name="flipflop",registry_id="112233445566",severity="INFORMATIONAL",tag="2faa6445"} 5.0
ecr_image_scan_severity_count{digest="sha256:a910ed7e15cb5fc7e5f0f2294f8028b56689be563bd1d352a4254197739dfa8e",name="flipflop",registry_id="112233445566",severity="LOW",tag="2faa6445"} 14.0
ecr_image_scan_severity_count{digest="sha256:981a9c17106eee1099d815f82dfb45f4e8d016a63816fec92f290f1af0117c37",name="birdbath",registry_id="112233445566",severity="MEDIUM",tag="227c8031"} 4.0
ecr_image_scan_severity_count{digest="sha256:981a9c17106eee1099d815f82dfb45f4e8d016a63816fec92f290f1af0117c37",name="birdbath",registry_id="112233445566",severity="INFORMATIONAL",tag="227c8031"} 5.0
ecr_image_scan_severity_count{digest="sha256:981a9c17106eee1099d815f82dfb45f4e8d016a63816fec92f290f1af0117c37",name="birdbath",registry_id="112233445566",severity="LOW",tag="227c8031"} 16.0
ecr_image_scan_severity_count{digest="sha256:f340879c042e88e08d7540c7ec26fb0895814743aefbdd4e62f63b5e41e9f1cf",name="birdbath",registry_id="112233445566",severity="MEDIUM",tag="77b36acb"} 4.0
# HELP aws_ecr_image_scan_severity_count ECR image scan summary results
# TYPE aws_ecr_image_scan_severity_count gauge
aws_ecr_image_scan_severity_count{digest="sha256:0b26628c113374546c4790e01bce65c3f4642db063286f16fe13e256923b2689",name="flimflam",registry_id="112233445566",severity="MEDIUM",tag="5a35d50d"} 5.0
aws_ecr_image_scan_severity_count{digest="sha256:a910ed7e15cb5fc7e5f0f2294f8028b56689be563bd1d352a4254197739dfa8e",name="flipflop",registry_id="112233445566",severity="MEDIUM",tag="2faa6445"} 3.0
aws_ecr_image_scan_severity_count{digest="sha256:a910ed7e15cb5fc7e5f0f2294f8028b56689be563bd1d352a4254197739dfa8e",name="flipflop",registry_id="112233445566",severity="INFORMATIONAL",tag="2faa6445"} 5.0
aws_ecr_image_scan_severity_count{digest="sha256:a910ed7e15cb5fc7e5f0f2294f8028b56689be563bd1d352a4254197739dfa8e",name="flipflop",registry_id="112233445566",severity="LOW",tag="2faa6445"} 14.0
aws_ecr_image_scan_severity_count{digest="sha256:981a9c17106eee1099d815f82dfb45f4e8d016a63816fec92f290f1af0117c37",name="birdbath",registry_id="112233445566",severity="MEDIUM",tag="227c8031"} 4.0
aws_ecr_image_scan_severity_count{digest="sha256:981a9c17106eee1099d815f82dfb45f4e8d016a63816fec92f290f1af0117c37",name="birdbath",registry_id="112233445566",severity="INFORMATIONAL",tag="227c8031"} 5.0
aws_ecr_image_scan_severity_count{digest="sha256:981a9c17106eee1099d815f82dfb45f4e8d016a63816fec92f290f1af0117c37",name="birdbath",registry_id="112233445566",severity="LOW",tag="227c8031"} 16.0
aws_ecr_image_scan_severity_count{digest="sha256:f340879c042e88e08d7540c7ec26fb0895814743aefbdd4e62f63b5e41e9f1cf",name="birdbath",registry_id="112233445566",severity="MEDIUM",tag="77b36acb"} 4.0
....
....
```
Expand Down
8 changes: 4 additions & 4 deletions ecr_exporter/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ def collect(self):
self.logger.debug("fetched repositories from cache")

repository_count_metric = GaugeMetricFamily(
"ecr_repository_count",
"aws_ecr_repository_count",
"Total count of all ECR repositories",
labels=["registry_id"],
)

repository_count_metric.add_metric([self.registry_id], len(repositories))

repository_info_metrics = InfoMetricFamily(
"ecr_repository", "ECR repository information"
"aws_ecr_repository", "ECR repository information"
)

for repo in repositories:
Expand All @@ -62,13 +62,13 @@ def collect(self):
)

image_size_metrics = GaugeMetricFamily(
"ecr_image_size_in_bytes",
"aws_ecr_image_size_in_bytes",
"The size of an image in bytes",
labels=["name", "tag", "digest", "registry_id"],
)

image_scan_metrics = GaugeMetricFamily(
"ecr_image_scan_severity_count",
"aws_ecr_image_scan_severity_count",
"ECR image scan summary results",
labels=["name", "tag", "digest", "registry_id", "severity"],
)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name="ecr_exporter",
version="0.0.1",
version="0.1.0",
url="https://github.com/aws-exporters/ecr",
license="MIT",
author="Tim Birkett",
Expand Down

0 comments on commit 4afa8d6

Please sign in to comment.