Skip to content

Feature/delete service stats#78

Merged
bors[bot] merged 44 commits intomasterfrom
feature/delete-service-stats-integration
Mar 4, 2019
Merged

Feature/delete service stats#78
bors[bot] merged 44 commits intomasterfrom
feature/delete-service-stats-integration

Conversation

@eguzki
Copy link
Copy Markdown
Member

@eguzki eguzki commented Mar 1, 2019

Given a Service, delete all its Stats

The number of stats from a given service A can be huge. It is roughly estimated that there are 300K keys of stats per metric, application, user and year. Deleting all stat keys at once is not a good idea.

Stats deletion task partitioning system has been implemented using resque async background jobs

Internal endpoint has been published for that task:

DELETE /internal/services/#{service_id}/stats

Request body

openAPIV3Schema:
  properties:
    deletejobdef:
        properties:
          applications:
            type: array
          metrics:
            type: array
          users:
            type: array
          from:
            type: int64
          to:
            type: int64
        required:
        -  applications
        -  metrics
        -  users
        -  from
        -  to

Example

$ cat delete_job.json
{ 
  "deletejobdef": {
     "applications": ["1"],
     "metrics": ["5"],
     "from": 1483228800,
     "to": 1483228800, 
     "users": []
  }
}

$ curl -v -X DELETE -d '@delete_job.json' -H "Content-Type: application/json" http://127.0.0.1:3000/internal/services/c2f28d6c-aa75-46d4-b5d8-5bc8d2dc0cff/stats

Doc about implementation design is included

eguzki and others added 30 commits March 1, 2019 15:45
@eguzki eguzki requested review from davidor, mikz and unleashed March 1, 2019 15:10
@davidor
Copy link
Copy Markdown
Contributor

davidor commented Mar 1, 2019

This is the integration branch that contains #72 , #73 and #74 .

@eguzki Have you introduced any new changes in this branch? Just so we know if there's anything new that we should review.

@eguzki
Copy link
Copy Markdown
Member Author

eguzki commented Mar 1, 2019

@davidor I have squashed several commit as @mikz requested

@eguzki eguzki changed the title Feature/delete service stats integration Feature/delete service stats Mar 1, 2019
Copy link
Copy Markdown
Contributor

@davidor davidor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good 👍

There are a few things that we discussed in other PRs that can be addressed in future PRs.

@davidor
Copy link
Copy Markdown
Contributor

davidor commented Mar 4, 2019

bors r+

@bors
Copy link
Copy Markdown
Contributor

bors Bot commented Mar 4, 2019

👎 Rejected by PR status

@davidor
Copy link
Copy Markdown
Contributor

davidor commented Mar 4, 2019

bors r+

bors Bot added a commit that referenced this pull request Mar 4, 2019
78: Feature/delete service stats r=davidor a=eguzki

Given a Service, delete all its Stats


The number of stats from a given service A can be huge. It is roughly estimated that there are 300K keys of stats per metric, application, user and year. Deleting all stat keys at once is not a good idea.

Stats deletion task partitioning system has been implemented using resque async background jobs

Internal endpoint has been published for that task:
```
DELETE /internal/services/#{service_id}/stats
```
Request body
```yaml
openAPIV3Schema:
  properties:
    deletejobdef:
        properties:
          applications:
            type: array
          metrics:
            type: array
          users:
            type: array
          from:
            type: int64
          to:
            type: int64
        required:
        -  applications
        -  metrics
        -  users
        -  from
        -  to
```

Example
```sh
$ cat delete_job.json
{ 
  "deletejobdef": {
     "applications": ["1"],
     "metrics": ["5"],
     "from": 1483228800,
     "to": 1483228800, 
     "users": []
  }
}

$ curl -v -X DELETE -d '@delete_job.json' -H "Content-Type: application/json" http://127.0.0.1:3000/internal/services/c2f28d6c-aa75-46d4-b5d8-5bc8d2dc0cff/stats
```

Doc about implementation design is included




Co-authored-by: Eguzki Astiz Lezaun <eastizle@redhat.com>
Co-authored-by: Eguzki Astiz Lezaun <eguzki.astiz@gmail.com>
@bors
Copy link
Copy Markdown
Contributor

bors Bot commented Mar 4, 2019

Build succeeded

@bors bors Bot merged commit b78c603 into master Mar 4, 2019
@bors bors Bot deleted the feature/delete-service-stats-integration branch March 4, 2019 13:52
@davidor
Copy link
Copy Markdown
Contributor

davidor commented Mar 4, 2019

@eguzki I just tried this in staging and noticed a problem.

Some jobs fail with KeyErrorlib in /3scale/backend/stats/codes_commons.rb:12

The problem is that this raises an exception when a user reports a response code that Apisonator does not track, for example, 304.

Instead of raising, we should just ignore the code.

@eguzki
Copy link
Copy Markdown
Member Author

eguzki commented Mar 4, 2019

thnx @davidor for reporting.

Fix: #82

bors Bot added a commit that referenced this pull request Mar 5, 2019
82: Fix/response code processing r=davidor a=eguzki

* Fix #78 (comment)
Do not raise an exception when a user reports a response code that Apisonator does not track, for example, 304.

* Do not account for untracked http response codes, currently, for example 304

Co-authored-by: Eguzki Astiz Lezaun <eastizle@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants