Chromium Code Reviews| Index: appengine_module/gae_ts_mon/README |
| diff --git a/appengine_module/gae_ts_mon/README b/appengine_module/gae_ts_mon/README |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..56c8036a121470f62934cce501824712536aa39a |
| --- /dev/null |
| +++ b/appengine_module/gae_ts_mon/README |
| @@ -0,0 +1,56 @@ |
| +# SETTING UP GAE_TS_MON WITH APPENGINE |
| + |
| +Symlink this directory to your appengine app. |
| + |
| +Add a cron job to the cron.yaml file |
| +cron: |
| +- description: flush alerts metrics |
| + url: /monitoring |
| + schedule: every 5 minutes |
| + target: monitoring |
| + |
| +Add a dispatch.yaml file |
| +dispatch: |
| +- url: "*/monitoring" |
| + module: monitoring |
| + |
| +- url: "*/monitoring/*" |
| + module: monitoring |
| + |
| +- url: "*/_ah/start" |
| + module: monitoring |
| + |
| +- url: "*/*" |
| + module: default |
| + |
| +# INCREMENTING OR SETTING A PROVIDED METRIC |
| + |
| +import gae_ts_mon |
| +url = app_identity.get_default_version_hostname() |
| +gae_ts_mon.access_count.increment(fields={'url_path': url + '/' + key, |
|
Sergey Berezin
2015/08/18 00:40:37
nit: It would be great to list all predefined metr
|
| + 'request_path': key, |
| + 'request_type': 'GET'}) |
| +gae_ts_mon.request_bytes.set(48) |
|
Sergey Berezin
2015/08/18 00:40:37
nit: misleading example, since request_bytes is a
|
| + |
| +# SENDING A SPECIFIC METRIC TO MONARCH |
| + |
| +gae_ts_mon.send(gae_ts_mon.access_count) |
| + |
| +# MANUALLY FLUSHING (SEND TO MONARCH) ALL METRICS |
| + |
| +gae_ts_mon.flush() |
| + |
| +All metrics will already flush automatically every five minutes. |
| + |
| +# ADDING A NEW METRIC |
| + |
| +alerts_count = gae_ts_mon.CounterMetric('gae/alerts') |
| + |
| +This may raise a MonitoringDuplicateRegistrationError if the name is already |
| +registered with a metric of a different type. |
| + |
| +# ADDING A NEW METRIC WITH CUSTOM TARGET: |
| + |
| +service, job, region, hostname, task = 'service', 'job', 'reg', 'host', 1 |
| +custom_target = gae_ts_mon.TaskTarget(service, job, region, hostname, task) |
| +cats_metric = gae_ts_mon.CounterMetric('gae/cats', target=custom_target) |