diff --git a/docs/api.html b/docs/api.html new file mode 100644 index 0000000..77aac10 --- /dev/null +++ b/docs/api.html @@ -0,0 +1,485 @@ + + + + + + + + + + + + StackTach.v3 + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+
+

StackTach.v3 REST API

+
+
+

GET /v1/streams

+
+
+

Retrieves streams.

+

Date filters use the first_event and last_event attributes on the stream for comparisons.

+

Query filter parameters:

+
    +
  • older_than - returns streams where first_event is older than supplied date (in ISO 8601 format). ie: 01-31-2015T13:30
  • +
  • younger_than - returns streams where last_event is younger than supplied date (in ISO 8601 format). ie: 01-31-2015T13:30
  • +
  • state - returns streams where state is one of:
  • +
      +
    • active
    • +
    • firing
    • +
    • expiring
    • +
    • error
    • +
    • expire_error
    • +
    • completed
    • +
    • retry_fire
    • +
    • retry_expire
    • +
    +
  • trigger_name - returns streams with a specific trigger_name
  • +
  • distinguishing_traits - returns streams with matching distinguishing_traits. Trait format is trait_name:trait_value;trait_name:trait_value
  • +
  • mark - returns streams starting from a previously supplied mark. The mark is part of the return value from a previous /streams query. All filter criteria must match the previous query.
  • +
  • limit - specifies the number of streams to return in this query. The default is 200 streams. Limit should be kept low to reduce load on the API server.
  • +
+ +

Sample return data

+

Note the __type__ keys that give hints to the data type of the return values

+
+
+curl http://localhost:8000/v1/streams 
+
+[
+    {
+        "_mark": "2",
+        "distinguishing_traits": {
+            "instance_id": "8f81562e-70c9-4541-b054-3826121dc75b",
+            "timestamp": {
+                "__type__": "timex.TimeRange",
+                "begin": "2015-02-27T00:00:00",
+                "end": "2015-02-28T00:00:00"
+            }
+        },
+        "expire_timestamp": {
+            "__type__": "datetime",
+            "datetime": "2015-03-02T00:27:18.603932"
+        },
+        "fire_timestamp": {
+            "__type__": "datetime",
+            "datetime": "2015-02-27T14:57:32.731196"
+        },
+        "first_event": {
+            "__type__": "datetime",
+            "datetime": "2015-02-27T18:27:18.603932"
+        },
+        "id": 2,
+        "last_event": {
+            "__type__": "datetime",
+            "datetime": "2015-02-28T00:27:18.603932"
+        },
+        "name": "test_trigger",
+        "state": "completed"
+    },
+    {
+        "_mark": "1",
+        "distinguishing_traits": {
+            "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+            "timestamp": {
+                "__type__": "timex.TimeRange",
+                "begin": "2015-02-27T00:00:00",
+                "end": "2015-02-28T00:00:00"
+            }
+        },
+        "expire_timestamp": {
+            "__type__": "datetime",
+            "datetime": "2015-03-02T00:27:18.603932"
+        },
+        "fire_timestamp": {
+            "__type__": "datetime",
+            "datetime": "2015-02-27T14:57:32.330963"
+        },
+        "first_event": {
+            "__type__": "datetime",
+            "datetime": "2015-02-27T15:27:18.603932"
+        },
+        "id": 1,
+        "last_event": {
+            "__type__": "datetime",
+            "datetime": "2015-02-28T00:27:18.603932"
+        },
+        "name": "test_trigger",
+        "state": "completed"
+    }
+]
+               
+
+
+ +
+
+

GET /v1/streams/<stream_id>

+
+
+

Retrieves a particular stream. stream_id is the id of the desired stream.

+

Optional parameters:

+
    +
  • details - true/false: returns the event data in a stream if true. +
+ +

Sample return data

+
+curl http://localhost:8000/v1/streams/1 
+
+[
+    {
+        "_mark": "1",
+        "distinguishing_traits": {
+            "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+            "timestamp": {
+                "__type__": "timex.TimeRange",
+                "begin": "2015-02-27T00:00:00",
+                "end": "2015-02-28T00:00:00"
+            }
+        },
+        "expire_timestamp": {
+            "__type__": "datetime",
+            "datetime": "2015-03-02T00:27:18.603932"
+        },
+        "fire_timestamp": {
+            "__type__": "datetime",
+            "datetime": "2015-02-27T14:57:32.330963"
+        },
+        "first_event": {
+            "__type__": "datetime",
+            "datetime": "2015-02-27T15:27:18.603932"
+        },
+        "id": 1,
+        "last_event": {
+            "__type__": "datetime",
+            "datetime": "2015-02-28T00:27:18.603932"
+        },
+        "name": "test_trigger",
+        "state": "completed"
+    }
+]
+               
+ +

And with event details

+
+curl http://localhost:8000/v1/streams/1?detail=true
+
+[
+    {
+        "_mark": "1",
+        "distinguishing_traits": {
+            "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+            "timestamp": {
+                "__type__": "timex.TimeRange",
+                "begin": "2015-02-27T00:00:00",
+                "end": "2015-02-28T00:00:00"
+            }
+        },
+        "events": [
+            {
+                "disk_gb": 20,
+                "ephemeral_gb": 0,
+                "event_type": "compute.instance.update",
+                "instance_flavor": "512MB Standard Instance",
+                "instance_flavor_id": 2,
+                "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+                "instance_type": "512MB Standard Instance",
+                "memory_mb": 512,
+                "message_id": "936a849a-6eb3-4750-a431-7ca1aec9d611",
+                "os_architecture": "x64",
+                "os_distro": "com.ubuntu",
+                "os_version": "12.04",
+                "request_id": "req-028c51c6-e26e-4fd7-9347-bc1b2a7eb11a",
+                "root_gb": 20,
+                "service": "publisher-482147",
+                "state": "building",  
+                "tenant_id": "408577",
+                "timestamp": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:27:18.603932"
+                },
+                "user_id": "863985",  
+                "vcpus": 1
+            },
+            {
+                "disk_gb": 20,
+                "ephemeral_gb": 0,
+                "event_type": "compute.instance.create.start",
+                "instance_flavor": "512MB Standard Instance",
+                "instance_flavor_id": 2,
+                "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+                "instance_type": "512MB Standard Instance",
+                "memory_mb": 512,
+                "message": "",
+                "message_id": "d359a6db-a488-4522-8b94-2ad17fb7ac38",
+                "os_architecture": "x64",
+                "os_distro": "com.ubuntu",
+                "os_version": "12.04",
+                "request_id": "req-028c51c6-e26e-4fd7-9347-bc1b2a7eb11a",
+                "root_gb": 20,
+                "service": "publisher-482147",
+                "state": "building",  
+                "tenant_id": "408577",
+                "timestamp": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:33:22.667932"
+                },
+                "user_id": "863985",  
+                "vcpus": 1
+            },
+            {
+                "disk_gb": 20,
+                "ephemeral_gb": 0,
+                "event_type": "compute.instance.update",
+                "instance_flavor": "512MB Standard Instance",
+                "instance_flavor_id": 2,
+                "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+                "instance_type": "512MB Standard Instance",
+                "launched_at": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:31:24.473932"
+                },
+                "memory_mb": 512,
+                "message_id": "fa6f6302-e35e-4c21-a69d-5322497526ed",
+                "os_architecture": "x64",
+                "os_distro": "com.ubuntu",
+                "os_version": "12.04",
+                "request_id": "req-028c51c6-e26e-4fd7-9347-bc1b2a7eb11a",
+                "root_gb": 20,
+                "service": "publisher-482147",
+                "state": "active",
+                "tenant_id": "408577",
+                "timestamp": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:33:24.565932"
+                },
+                "user_id": "863985",  
+                "vcpus": 1
+            },
+            {
+                "disk_gb": 20,
+                "ephemeral_gb": 0,
+                "event_type": "compute.instance.create.end",
+                "instance_flavor": "512MB Standard Instance",
+                "instance_flavor_id": 2,
+                "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+                "instance_type": "512MB Standard Instance",
+                "launched_at": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:31:24.473932"
+                },
+                "memory_mb": 512,
+                "message": "Success", 
+                "message_id": "379cbd38-cae6-44cd-ae8e-5fb05777d1e0",
+                "os_architecture": "x64",
+                "os_distro": "com.ubuntu",
+                "os_version": "12.04",
+                "request_id": "req-028c51c6-e26e-4fd7-9347-bc1b2a7eb11a",
+                "root_gb": 20,
+                "service": "publisher-482147",
+                "state": "active",
+                "tenant_id": "408577",
+                "timestamp": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:33:56.771932"
+                },
+                "user_id": "863985",  
+                "vcpus": 1
+            },
+            {
+                "disk_gb": 20,
+                "ephemeral_gb": 0,
+                "event_type": "compute.instance.update",
+                "instance_flavor": "512MB Standard Instance",
+                "instance_flavor_id": 2,
+                "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+                "instance_type": "512MB Standard Instance",
+                "memory_mb": 512,
+                "message_id": "c0784af6-deb7-452d-b09e-5a1dc1ac138f",
+                "os_architecture": "x64",
+                "os_distro": "com.ubuntu",
+                "os_version": "12.04",
+                "request_id": "req-028c51c6-e26e-4fd7-9347-bc1b2a7eb11a",
+                "root_gb": 20,
+                "service": "publisher-482147",
+                "state": "building",  
+                "tenant_id": "408577",
+                "timestamp": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:40:34.186932"
+                },
+                "user_id": "863985",  
+                "vcpus": 1
+            },
+            {
+                "disk_gb": 20,
+                "ephemeral_gb": 0,
+                "event_type": "compute.instance.update",
+                "instance_flavor": "512MB Standard Instance",
+                "instance_flavor_id": 2,
+                "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+                "instance_type": "512MB Standard Instance",
+                "memory_mb": 512,
+                "message_id": "e1c5ec1c-946d-422f-a890-3248fdf58cc0",
+                "os_architecture": "x64",
+                "os_distro": "com.ubuntu",
+                "os_version": "12.04",
+                "request_id": "req-028c51c6-e26e-4fd7-9347-bc1b2a7eb11a",
+                "root_gb": 20,
+                "service": "publisher-482147",
+                "state": "building",  
+                "tenant_id": "408577",
+                "timestamp": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:42:34.939932"
+                },
+                "user_id": "863985",  
+                "vcpus": 1
+            },
+            {
+                "disk_gb": 20,
+                "ephemeral_gb": 0,
+                "event_type": "compute.instance.update",
+                "instance_flavor": "512MB Standard Instance",
+                "instance_flavor_id": 2,
+                "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+                "instance_type": "512MB Standard Instance",
+                "memory_mb": 512,
+                "message_id": "6df0588b-2cf2-4f0b-96f3-98c2046f29ff",
+                "os_architecture": "x64",
+                "os_distro": "com.ubuntu",
+                "os_version": "12.04",
+                "request_id": "req-028c51c6-e26e-4fd7-9347-bc1b2a7eb11a",
+                "root_gb": 20,
+                "service": "publisher-482147",
+                "state": "building",  
+                "tenant_id": "408577",
+                "timestamp": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T15:43:25.091932"
+                },
+                "user_id": "863985",  
+                "vcpus": 1
+            },
+            {
+                "audit_period_beginning": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-27T00:00:00"
+                },
+                "audit_period_ending": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-28T00:00:00"
+                },
+                "disk_gb": 620,
+                "ephemeral_gb": 0,
+                "event_type": "compute.instance.exists",
+                "instance_flavor": "15GB Standard Instance",
+                "instance_flavor_id": 7,
+                "instance_id": "86def971-f2a2-4b1d-b379-fca1b0ddf0d7",
+                "instance_type": "15GB Standard Instance",
+                "launched_at": {
+                    "__type__": "datetime",
+                    "datetime": "2014-12-15T13:22:12.015932"
+                },
+                "memory_mb": 15360,
+                "message_id": "a16aa892-6e62-47fd-8aee-5183ef71d605",
+                "os_architecture": "x64",
+                "os_distro": "com.ubuntu",
+                "os_version": "12.04",
+                "request_id": "req-d14c8981-db18-4d1e-b17c-e7931fd2a0e9",
+                "root_gb": 620,
+                "service": "publisher-262311",
+                "state": "active",
+                "tenant_id": "714200",
+                "timestamp": {
+                    "__type__": "datetime",
+                    "datetime": "2015-02-28T00:27:18.603932"
+                },
+                "user_id": "960064",
+                "vcpus": 6
+            }
+        ],
+        "expire_timestamp": {
+            "__type__": "datetime",
+            "datetime": "2015-03-02T00:27:18.603932"
+        },
+        "fire_timestamp": {
+            "__type__": "datetime",
+            "datetime": "2015-02-27T14:57:32.330963"
+        },
+        "first_event": {
+            "__type__": "datetime",
+            "datetime": "2015-02-27T15:27:18.603932"
+        },
+        "id": 1,
+        "last_event": {
+            "__type__": "datetime",
+            "datetime": "2015-02-28T00:27:18.603932"
+        },
+        "name": "test_trigger",
+        "state": "completed"
+    }
+]
+               
+ +
+
+ + +
+

© Dark Secret Software Inc. 2014

+
+ +
+ + + + + + diff --git a/docs/contribute.html b/docs/contribute.html index 7c47d75..52e4e3f 100644 --- a/docs/contribute.html +++ b/docs/contribute.html @@ -46,7 +46,7 @@
  • Home
  • Docs
  • Getting Started
  • -
  • API
  • +
  • API
  • Screencasts
  • diff --git a/docs/glossary.html b/docs/glossary.html index 7e93307..b6c76b2 100644 --- a/docs/glossary.html +++ b/docs/glossary.html @@ -46,7 +46,7 @@
  • Home
  • Docs
  • Getting Started
  • -
  • API
  • +
  • API
  • Screencasts
  • Contribute
  • diff --git a/docs/index.html b/docs/index.html index 81a1573..194ef30 100644 --- a/docs/index.html +++ b/docs/index.html @@ -46,7 +46,7 @@
  • Docs
  • Getting Started
  • -
  • API
  • +
  • API
  • Screencasts
  • Contribute
  • diff --git a/docs/install.html b/docs/install.html index f6f2bac..ab5b10b 100644 --- a/docs/install.html +++ b/docs/install.html @@ -46,7 +46,7 @@
  • Home
  • Docs
  • -
  • API
  • +
  • API
  • Screencasts
  • Contribute
  • diff --git a/docs/screencasts.html b/docs/screencasts.html index 1043186..dfd5642 100644 --- a/docs/screencasts.html +++ b/docs/screencasts.html @@ -46,7 +46,7 @@
  • Home
  • Docs
  • Getting Started
  • -
  • API
  • +
  • API
  • Contribute