Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

put metric action #400

Closed
kapilt opened this issue Aug 27, 2016 · 3 comments
Closed

put metric action #400

kapilt opened this issue Aug 27, 2016 · 3 comments

Comments

@kapilt
Copy link
Collaborator

kapilt commented Aug 27, 2016

for given expression evaluate and publish per resource metric for given attribute, or the collection's aggregate attributes (size, etc).

@calvinhp calvinhp self-assigned this Feb 14, 2017
@calvinhp calvinhp moved this from BackLog to In Progress in blue team Feb 14, 2017
@calvinhp
Copy link
Contributor

Are you envisioning something like this:

policies:
  - name: track-bucket-size
    resource: s3
    comment: |
      Put the sum of the size of all keys in an S3 bucket into CloudWatch Metrics
    filter:
      - Name: metric-tracked-bucket
    actions:
      - type: put-metric
        key: Contents[].Size
        metric_name: Bucket Size
        op: sum

Or something like this:

  - name: track-attached-ebs
    resource: ec2
    comment: |
      Put the count of the number of EBS attached disks to an instance
    filter:
      - Name: tracked-ec2-instance
    actions:
      - type: put-metric
        key: Reservations[].Instances[].BlockDeviceMappings[].DeviceName
        metric_name: Attached Disks
        op: count

The action can figure out based on the resource, operation and the key handed to it what to put into CloudWatch.

Operations could be:

  • count
  • sum
  • average
  • duration (is this even possible?)

@kapilt
Copy link
Collaborator Author

kapilt commented Feb 16, 2017

That looks good to me, thanks

@gfranxman
Copy link
Contributor

gfranxman commented Mar 23, 2017

Count, Sum and Average are definitely doable as Operations. Duration is really a question of the units for the value being recorded. I think the right thing to do here is to add one more key to the action calls 'units' and accept values of
`

durations

'Seconds','Microseconds','Milliseconds',

bytes

'Bytes','Kilobytes','Megabytes','Gigabytes','Terabytes',

bits

'Bits','Kilobits','Megabits','Gigabits','Terabits',

rates

'Bytes/Second','Kilobytes/Second','Megabytes/Second','Gigabytes/Second','Terabytes/Second'

'Bits/Second','Kilobits/Second','Megabits/Second','Gigabits/Second','Terabits/Second'

'Count/Second',

other

'Percent',
'Count',
'None'

`
This offers a way to interpret the values that graph as lines or area charts, or as values in a table.

Cloud watch can also record statistical values at a point in time. In that case, rather than a value, it accepts statistical metadata about a sample set ( min, max, sum, and sample count ). I've not used that yet, but we could support that style as an additional op value called 'stats'.

@gfranxman gfranxman self-assigned this Apr 21, 2017
@kapilt kapilt moved this from In Progress to Review in blue team May 4, 2017
kapilt pushed a commit that referenced this issue May 5, 2017
* inital draft of put metric action

* Build the schema for PutMetric and register the PutMetric action as 'put-metric'a

* Adding PutMetricAction operations for count, distinct_count, average, and sum.

* Adding all of the putmetric units supprted by AWS.

* This is the meat of the aws cloudwatch PutMetricData action, put-metric.

* Moved the imports, switched some print-logging to real logging.

* PutMetrics tests and placebo tests data.

* Updates per Kapil ( logging instead of prints, using the project's safe loader,
metric dimensions passing through. )

* Updated placebo test data for latest ec2 put-metrics test with dimensions.

* PutMetric schema adjustment and added a test in response to a travis ci
failure I ran into after the previous changes.
@kapilt kapilt closed this as completed May 22, 2017
@kapilt kapilt moved this from Review to Done in blue team May 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants