Skip to content

Some times OCI usage api currency getting empty #771

Description

@Gopichand-Heeddata

I am facing an issue with the Usage API currency field. Sometimes, the currency value returns as None. Please let me know if any changes are required—I will make them accordingly.
@adizohar

{
  "ad": null,
  "attributed_cost": "0",
  "attributed_usage": "0",
  "compartment_id": null,
  "compartment_name": "Infolob",
  "compartment_path": null,
  "computed_amount": 0.93,
  "computed_quantity": 0.0,
  "currency": " ",
  "discount": null,
  "is_forecast": false,
  "list_rate": null,
  "overage": null,
  "overages_flag": null,
  "platform": null,
  "region": null,
  "resource_id": "ocid1.bootvolume.oc1.ap-hyderabad-1.abuhsljrv776x6swqtdpzskszcrs6dni6i4pmm755sp4pylg34twke2h2rqa",
  "resource_name": null,
  "service": "Block Storage",
  "shape": null,
  "sku_name": null,
  "sku_part_number": null,
  "subscription_id": null,
  "tags": [
    {
      "key": null,
      "namespace": null,
      "value": null
    }
  ],
  "tenant_id": null,
  "tenant_name": null,
  "time_usage_ended": "2025-06-0500:00:00+00:00",
  "time_usage_started": "2025-06-04T00:00:00+00:00",
  "unit": null,
  "unit_price": null,
  "weight": null
}
--------
{
  "ad": null,
  "attributed_cost": "0",
  "attributed_usage": "0",
  "compartment_id": null,
  "compartment_name": "Infolob",
  "compartment_path": null,
  "computed_amount": null,
  "computed_quantity": 0.0,
  "currency": " ",
  "discount": null,
  "is_forecast": false,
  "list_rate": null,
  "overage": null,
  "overages_flag": null,
  "platform": null,
  "region": null,
  "resource_id": "ocid1.bootvolume.oc1.ap-hyderabad-1.abuhsljrv776x6swqtdpzskszcrs6dni6i4pmm755sp4pylg34twke2h2rqa",
  "resource_name": null,
  "service": "Block Storage",
  "shape": null,
  "sku_name": null,
  "sku_part_number": null,
  "subscription_id": null,
  "tags": [
    {
      "key": null,
      "namespace": null,
      "value": null
    }
  ],
  "tenant_id": null,
  "tenant_name": null,
  "time_usage_ended": "2025-06-04T00:00:00+00:00",
  "time_usage_started": "2025-06-03T00:00:00+00:00",
  "unit": null,
  "unit_price": null,
  "weight": null
}

Activity

  1. adizohar commented on Jun 5, 2025

    @adizohar
    Member

    Hi Gopi,

    Please specify the call to the API including the parameters

  2. Gopichand-Heeddata commented on Jun 6, 2025

    @Gopichand-Heeddata
    Author

    Hi @adizohar
    I am using below api call to get the usage data

    import oci

    config = oci.config.from_file()
    tenant_id = config['tenancy']
    time_usage_started = "2024-04-01T00:00:00Z"
    time_usage_ended = "2024-04-21T00:00:00Z"
    lis=[]
    usage_client = oci.usage_api.UsageapiClient(config,timeout=(10,3000))

    requestSummarizedUsagesDetails = oci.usage_api.models.RequestSummarizedUsagesDetails(
    tenant_id=tenant_id,
    granularity='DAILY',
    query_type='USAGE',
    group_by=[ 'resourceId','service','compartmentName'],
    time_usage_started=time_usage_started,
    time_usage_ended=time_usage_ended,
    compartment_depth=2
    )

    Retrieve summarized usage data

    request_summarized_usages = usage_client.request_summarized_usages(
    requestSummarizedUsagesDetails,
    retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY
    )

    for item in request_summarized_usages.data.items:
    print(len(item.resource_id))

    print("---------------------------------------------------------------------------------")

  3. adizohar commented on Jun 6, 2025

    @adizohar
    Member

    Gopi, customer sign with one currency, this not an SDK issue but service issue, if you want quicker respond, I would suggest to open SR using Oracle Support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UsageIssue pertains to the Usage service

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions