Skip to content

Missing element in aggregation for prometheus format #113

@outscale-mdr

Description

@outscale-mdr

Hello team,

I end up with a strange bug, when I was testing aggregation of resources I found that the prometheus format was missing some resources.

Here is the output for other format:

outscale:~/Sources$ osc-cost --profile cloud-gouv-1  --aggregate
Summary:
╭───────────────────────┬──────────────╮
│ Account Id            ┆ XXX │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Total price per hour  ┆ 0.106027395€ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Total price per month ┆ 77.4€        │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Total price per year  ┆ 928.80005€   │
╰───────────────────────┴──────────────╯

Details:
╭───────────────┬───────┬──────────────────────┬───────────────────────┬──────────────────────╮
│ Resource Type ┆ Count ┆ Total price per hour ┆ Total price per month ┆ Total price per year │
╞═══════════════╪═══════╪══════════════════════╪═══════════════════════╪══════════════════════╡
│ Snapshot      ┆ 31    ┆ 0.028027391€         ┆ 20.459997€            ┆ 245.51996€           │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ PublicIp      ┆ 13    ┆ 0.078€               ┆ 56.94001€             ┆ 683.28015€           │
╰───────────────┴───────┴──────────────────────┴───────────────────────┴──────────────────────╯
outscale:~/Sources$ osc-cost --profile cloud-gouv-1  --aggregate --format json
{"resource_type":"Aggregate","osc_cost_version":"0.2.0","account_id":"XXX","read_date_rfc3339":"2023-10-11T11:25:45.159124566+00:00","region":"cloudgouv-eu-west-1","price_per_hour":0.028027391,"price_per_month":20.459997,"aggregated_resource_type":"Snapshot","count":31}
{"resource_type":"Aggregate","osc_cost_version":"0.2.0","account_id":"XXX","read_date_rfc3339":"2023-10-11T11:25:45.159124566+00:00","region":"cloudgouv-eu-west-1","price_per_hour":0.078,"price_per_month":56.94001,"aggregated_resource_type":"PublicIp","count":13}

But in the prometheus format, PublicIpis missing:

outscale:~/Sources$ osc-cost --profile cloud-gouv-1  --aggregate --format prometheus
# HELP Aggregate_price_hour Aggregate price by hour
# TYPE Aggregate_price_hour gauge
Aggregate_price_hour{account_id="XXX",aggregated_resource_type="Snapshot",osc_cost_version="0.2.0",region="cloudgouv-eu-west-1",resource_type="Aggregate"} 0.028027391
# HELP Aggregate_price_month Aggregate price by month
# TYPE Aggregate_price_month gauge
Aggregate_price_month{account_id="XXX",aggregated_resource_type="Snapshot",osc_cost_version="0.2.0",region="cloudgouv-eu-west-1",resource_type="Aggregate"} 20.459997

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions