| 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..104d0f65a00139969860d0447802da5c4187c739
|
| --- /dev/null
|
| +++ b/appengine_module/gae_ts_mon/README
|
| @@ -0,0 +1,58 @@
|
| +# 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,
|
| + 'request_path': key,
|
| + 'request_type': 'GET'})
|
| +gae_ts_mon.request_bytes.add(48)
|
| +
|
| +See __init__.py for list of predefined metrics.
|
| +
|
| +# 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)
|
|
|