Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: appengine_module/gae_ts_mon/README

Issue 1260293009: make version of ts_mon compatible with appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: take out deleted utils methods Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # SETTING UP GAE_TS_MON WITH APPENGINE
2
3 Symlink this directory to your appengine app.
4
5 Add a cron job to the cron.yaml file
6 cron:
7 - description: flush alerts metrics
8 url: /monitoring
9 schedule: every 5 minutes
10 target: monitoring
11
12 Add a dispatch.yaml file
13 dispatch:
14 - url: "*/monitoring"
15 module: monitoring
16
17 - url: "*/monitoring/*"
18 module: monitoring
19
20 - url: "*/_ah/start"
21 module: monitoring
22
23 - url: "*/*"
24 module: default
25
26 # INCREMENTING OR SETTING A PROVIDED METRIC
27
28 import gae_ts_mon
29 url = app_identity.get_default_version_hostname()
30 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
31 'request_path': key,
32 'request_type': 'GET'})
33 gae_ts_mon.request_bytes.set(48)
Sergey Berezin 2015/08/18 00:40:37 nit: misleading example, since request_bytes is a
34
35 # SENDING A SPECIFIC METRIC TO MONARCH
36
37 gae_ts_mon.send(gae_ts_mon.access_count)
38
39 # MANUALLY FLUSHING (SEND TO MONARCH) ALL METRICS
40
41 gae_ts_mon.flush()
42
43 All metrics will already flush automatically every five minutes.
44
45 # ADDING A NEW METRIC
46
47 alerts_count = gae_ts_mon.CounterMetric('gae/alerts')
48
49 This may raise a MonitoringDuplicateRegistrationError if the name is already
50 registered with a metric of a different type.
51
52 # ADDING A NEW METRIC WITH CUSTOM TARGET:
53
54 service, job, region, hostname, task = 'service', 'job', 'reg', 'host', 1
55 custom_target = gae_ts_mon.TaskTarget(service, job, region, hostname, task)
56 cats_metric = gae_ts_mon.CounterMetric('gae/cats', target=custom_target)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698