Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-2158

When a re-tally includes a previous month, remittance records continue to grow sending duplicate usage to producers.

    XMLWordPrintable

Details

    • False
    • Hide

      None

      Show
      None
    • False

    Description

      When an hourly re-tally occurs that includes an Event in a previous month, a billable usage record is created for this usage, no matter if it has been already remitted.

       

      To reproduce:

      Insert an event into the DB that is in the previous month.

      INSERT INTO public.events VALUES ('3588f50a-9014-4d6a-b542-566717398ade', '2023-12-29 15:00:00-04', '{"sla": "Premium", "role": "osd", "org_id": "org123", "event_id": "3588f50a-9014-4d6a-b542-566717398ade", "timestamp": "2023-12-29T19:00:00+00:00", "event_type": "snapshot_redhat.com:openshift_dedicated:4cpu_hour", "expiration": "2023-12-29T20:00:00+00:00", "instance_id": "bcc0576f-9f59-403f-8c84-90135009b8a9", "product_tag": ["OpenShift-dedicated-metrics"], "record_date": "2023-12-29T19:35:10.045193+00:00", "display_name": "bcc0576f-9f59-403f-8c84-90135009b8a9", "event_source": "prometheus", "measurements": [{"uom": "Cores", "value": 4.1}], "service_type": "OpenShift Cluster", "account_number": "account_org123", "billing_provider": "red hat", "billing_account_id": "redhat1"}', 'snapshot_redhat.com:openshift_dedicated:4cpu_hour', 'prometheus', 'bcc0576f-9f59-403f-8c84-90135009b8a9', 'org123', DEFAULT, NULL, '2023-12-29 15:35:10.045193-04'); 

       

       

      Run an hourly tally and check the resulting remittance records. Then repeat this process a few more times. Notice that after each re-tally, an extra remittance record gets added to the DB.

      http POST ":8000/api/rhsm-subscriptions/v1/internal/tally/hourly?org=org123&start=2023-12-13T00:00Z&end=2024-01-29T20:00Z" x-rh-swatch-psk:placeholder 

       

      psql -U rhsm-subscriptions rhsm-subscriptions -c "select * from billable_usage_remittance where org_id='org123'" 

      Attachments

        Activity

          People

            mstead@redhat.com Michael Stead
            mstead@redhat.com Michael Stead
            Aurobinda Nayak Aurobinda Nayak
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: