Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit c78db8d

Browse files
rashmigottipatiIzabellaRaulin
authored andcommitted
Add streaming documentation (#1728)
* Add streaming documentation * Address comments
1 parent 2615d8e commit c78db8d

File tree

5 files changed

+134
-6
lines changed

5 files changed

+134
-6
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ These and other terminology are explained in the [glossary](docs/GLOSSARY.md).
6666

6767
The key features of Snap are:
6868

69-
* **Plugin Architecture**: Snap has a simple and smart modular design. The three types of plugins (collectors, processors, and publishers) allow Snap to mix and match functionality based on user need. All plugins are designed with versioning, signing and deployment at scale in mind. The **open plugin model** allows for loading built-in, community, or proprietary plugins into Snap.
69+
* **Plugin Architecture**: Snap has a simple and smart modular design. The four types of plugins (collectors, processors, publishers and streaming collectors) allow Snap to mix and match functionality based on user need. All plugins are designed with versioning, signing and deployment at scale in mind. The **open plugin model** allows for loading built-in, community, or proprietary plugins into Snap.
7070
* **Collectors** - Collectors consume telemetry data. Collectors are plugins for leveraging existing telemetry solutions (Facter, CollectD, Ohai) as well as specific plugins for consuming Intel telemetry (Node, DCM, NIC, Disk) and can reach into new architectures through additional plugins (see [Plugin Authoring below](#author-a-plugin)). Telemetry data is organized into a dynamically generated catalog of available data points.
7171
* **Processors** - Extensible workflow injection. Convert telemetry into another data model for consumption by existing systems. Allows encryption of all or part of the telemetry payload before publishing. Inject remote queries into workflow for tokens, filtering, or other external calls. Implement filtering at an agent level reducing injection load on telemetry consumer.
7272
* **Publishers** - Store telemetry into a wide array of systems. Snap decouples the collection of telemetry from the implementation of where to send it. Snap comes with a large library of publisher plugins that allow exposure to telemetry analytics systems both custom and common. This flexibility allows Snap to be valuable to open source and commercial ecosystems alike by writing a publisher for their architectures.
73+
* **Streaming Collectors** - Streaming collectors act just like collectors, but rather than waiting for a specified duration before sending the collected data, they send it immediately over a grpc stream to snaptel. Check out [STREAMING.md](/docs/STREAMING.md) for more details on the differences between collectors and streaming collectors.
7374

7475
* **Dynamic Updates**: Snap is designed to evolve. Each scheduled workflow automatically uses the most mature plugin for that step, unless the collection is pinned to a specific version (e.g. get `/intel/psutil/load/load1/v1`). Loading a new plugin automatically upgrades running workflows in tasks. Load plugins dynamically, without a restart to the service or server. This dynamically extends the metric catalog when loaded, giving access to new measurements immediately. Swapping a newer version plugin for an old one in a safe transaction. All of these behaviors allow for simple and secure bug fixes, security patching, and improving accuracy in production.
7576

@@ -304,7 +305,7 @@ When you're ready to move on, walk through other uses of Snap available in the [
304305
Documentation for building a task can be found [here](docs/TASKS.md).
305306

306307
### Plugin Catalog
307-
All known plugins are tracked in the [plugin catalog](https://github.com/intelsdi-x/snap/blob/master/docs/PLUGIN_CATALOG.md) and are tagged as collectors, processors and publishers.
308+
All known plugins are tracked in the [plugin catalog](https://github.com/intelsdi-x/snap/blob/master/docs/PLUGIN_CATALOG.md) and are tagged as collectors, processors, publishers and streaming collectors.
308309

309310
If you would like to write your own, read through [Author a Plugin](#author-a-plugin) to get started. Let us know if you begin to write one by [joining our Slack channel](https://intelsdi-x.herokuapp.com/). When you finish, please open a Pull Request to add yours to the catalog!
310311

docs/PLUGIN_AUTHORING.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ Before writing a new Snap plugin, please check out the [Plugin Catalog](./PLUGIN
3939

4040
### Plugin Type
4141

42-
Snap supports three type of plugins:
42+
Snap supports four types of plugins:
4343

44-
* collector: gathering metrics
44+
* collector: gathering metrics based on the specified interval
4545
* processor: transforming metrics
4646
* publisher: publishing metrics
47+
* streaming collector: gathering metrics when they are available
4748

4849
### Plugin Name
4950

docs/STREAMING.md

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Streaming
2+
3+
4+
Streaming plugins use grpc streams to allow the plugin to send data immediately or after a certain period of time instead of on an interval governed by Snap.
5+
Streaming by snap enables -
6+
* Improved performance by enabling event based data flows
7+
* Runtime configuration controlling event throughput
8+
* Buffer configurations which dispatch events after a given duration and/or when a given event count has been reached
9+
10+
Currently there are two plugins that support streaming - [snap relay](https://github.com/intelsdi-x/snap-relay) and [snap-plugin-collector-rand-streaming](https://github.com/intelsdi-x/snap-plugin-lib-go/tree/master/examples/snap-plugin-collector-rand-streaming).
11+
12+
# Configuration options
13+
MaxCollectDuration and MaxMetricsBuffer are two configuration options that can be set through streaming task manifest or flags.
14+
* MaxCollectDuration sets the maximum duration between collections before metrics are sent. It is always greater than 0 and defaults to 10s which means that after 10 seconds if no new metrics are received, the plugin should send whatever data it has in the buffer.
15+
* MaxMetricsBuffer is the maximum number of metrics the plugin is buffering before sending metrics. It defaults to 0 which means the metrics are sent immediately.
16+
17+
# Streaming task schedule
18+
```
19+
---
20+
version: 1
21+
schedule:
22+
type: "streaming"
23+
workflow:
24+
collect:
25+
metrics:
26+
/random/integer: {}
27+
config:
28+
/random/integer:
29+
MaxCollectDuration: "6s"
30+
MaxMetricsBuffer: 600
31+
```
32+
33+
# Streaming configuration flags
34+
Below is an example of the how to run the snap-relay using the configurable flags.
35+
1. Start the Snap daemon:
36+
* Run
37+
```
38+
$ snapteld -l 1 -t 0
39+
```
40+
The option "-l 1" is for setting the debugging log level and "-t 0" is for disabling plugin signing.
41+
42+
2. Start the relay using flags:
43+
* Run snap-relay plugin
44+
```
45+
$ go run main.go --stand-alone --stand-alone-port 8182 --log-level 5 --max-collect-duration 10s --max-metrics-buffer 50
46+
47+
Output: Preamble URL: [::]:8182
48+
```
49+
50+
3. Obtain meta information:
51+
* Curl preamble
52+
```
53+
$ curl localhost:8182
54+
{"Meta":{"Type":3,"Name":"plugin-relay","Version":1,"RPCType":3,"RPCVersion":1,"ConcurrencyCount":5,"Exclusive":false,"Unsecure":true,"CacheTTL":0,"RoutingStrategy":0,"CertPath":"","KeyPath":"","TLSEnabled":false,"RootCertPaths":""},"ListenAddress":"127.0.0.1:54541","PprofAddress":"0","Type":3,"State":0,"ErrorMessage":""}
55+
```
56+
57+
4. Start client in snap-relay:
58+
* Run client (from a different terminal) using the listen address obtained from the previous step
59+
```
60+
$ go run client/main.go 127.0.0.1:54541
61+
```
62+
63+
5. Load plugin:
64+
```
65+
$ snaptel plugin load http://localhost:8182
66+
Plugin loaded
67+
Name: plugin-relay
68+
Version: 1
69+
Type: streaming-collector
70+
Signed: false
71+
Loaded Time: Tue, 05 Sep 2017 17:41:42 PDT
72+
```
73+
74+
* List the metric catalog by running:
75+
```
76+
$ snaptel metric list
77+
NAMESPACE VERSIONS
78+
/intel/relay/collectd 1
79+
/intel/relay/statsd 1
80+
```
81+
82+
6. Create a task manifest for snap-relay (see [exemplary files](https://github.com/intelsdi-x/snap-relay/tree/master/examples/tasks)):
83+
```
84+
---
85+
version: 1
86+
schedule:
87+
type: "streaming"
88+
workflow:
89+
collect:
90+
metrics:
91+
/intel/relay/collectd: {}
92+
```
93+
94+
7. Create a task:
95+
```
96+
$ snaptel task create -t collectd.yaml
97+
Using task manifest to create task
98+
Task created
99+
ID: c168b992-8aaf-4eec-8e3c-883510962789
100+
Name: Task-c168b992-8aaf-4eec-8e3c-883510962789
101+
State: Running
102+
```
103+
104+
# Metrics exposed by streaming collectors
105+
Below are some of the metrics collected by the streaming plugins currently:
106+
```
107+
/intel/relay/collectd
108+
/intel/relay/statsd
109+
/random/integer
110+
/random/float
111+
/random/string
112+
```
113+
114+
115+
116+

docs/TASKS.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ The schedule describes the schedule type and interval for running the task. At t
5252
- [simple](#simple-schedule)
5353
- [windowed](#windowed-schedule)
5454
- [cron](#cron-schedule)
55+
- [streaming] (#streaming-schedule)
5556

5657
Snap is designed in a way where custom schedulers can easily be dropped in. If a custom schedule is used, it may require more key/value pairs in the schedule section of the manifest.
5758

@@ -176,8 +177,16 @@ Snap is designed in a way where custom schedulers can easily be dropped in. If a
176177
"max-failures": 10,
177178
```
178179

179-
180-
180+
##### Streaming Schedule
181+
```yaml
182+
---
183+
version: 1
184+
schedule:
185+
type: "streaming"
186+
```
187+
The streaming schedule doesn't support fields such as `interval` and `count`. If those fields are provided as part of the schedule, they will simply be skipped.
188+
For more details on streaming, visit [STREAMING.md](STREAMING.md)
189+
181190
#### Max-Failures
182191

183192
By default, Snap will disable a task if there are 10 consecutive errors from any plugins within the workflow. The configuration

examples/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ For additional examples of using Snap, checkout the examples in these repositori
3333
- [snap-plugin-publisher-influxdb](https://github.com/intelsdi-x/snap-plugin-publisher-influxdb)
3434
- [snap-plugin-publisher-graphite](https://github.com/intelsdi-x/snap-plugin-publisher-graphite)
3535
- [snap-plugin-publisher-file](https://github.com/intelsdi-x/snap-plugin-publisher-file)
36+
- [snap-relay](https://github.com/intelsdi-x/snap-relay) (streaming collector plugin to retrieve data from collectd or statsd and include them into Snap workflow)

0 commit comments

Comments
 (0)