-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs.html
executable file
·142 lines (111 loc) · 4.15 KB
/
docs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>MonDemand</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="keywords" content="mondemand,monitoring,instrumentation"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="main">
<div id="topmenu">
<a href="/">introduction</a><a href="/docs.html">documentation</a><a href="/download.html">download</a><a href="/contact.html">contact</a>
</div>
<div id="header">
<span class="title">Mon<span class="darktitle">Demand</span></span><br/>
</div>
<div id="lefty">
<div class="menu">
<a href="#Introduction">Event Types</a>
<a href="#Java">Java Example</a>
<a href="#C">C Example</a>
</div>
</div>
<div id="righty">
<h3>Useful Links</h3>
<div class="menu">
<a href="/docs/doxygen">C API Documentation</a>
<a href="/docs/javadoc">Java API Documentation</a>
<a href="http://github.com/mondemand">Source Code</a>
</div>
<br/>
<div>
<h3>Contributors</h3>
<a href="http://www.yahoo.com"><img src="/images/yahoo.jpg" border="0" width="100"></a><p/>
<a href="http://www.openx.org"><img src="/images/openx.jpg" border="0"></a>
</div>
</div>
<div id="content">
<a name="Introduction"><h1>Event Types</h1></a>
There are two basic types of events in MonDemand - log events and stats events. Log events are
text messages that represent something that has happened, stats events represent the numerical
state of an thread of control. Most applications provide a logging framework such as log4j that can be re-used for log events, however stats events are usually created from within the application.
<p/>
There is a third type of event that can be used to track workflow that is under development.
<a name="Java"><h1>Java Example</h1></a>
<div id="block">
<pre>
import java.net.InetAddress;
import org.mondemand.Client;
import org.mondemand.Transport;
public class MyApp {
private static Client client = null;
public static void main(String[] args) {
// or could be implemented as singleton if desired
client = new Client("MyApp");
// setup the transport. this also only needs to be done once, not per request
try {
Transport transport = new LWESTransport(InetAddress.getByName("224.1.11.111"),
9191, null);
client.addTransport(transport);
} catch(Exception e) {}
// set some optional persistent contexts
client.addContext("clusterID", "101");
client.addContext("partitionID", "202");
/* typically everything below this line would be done in the main event loop */
// log some messages
client.emerg("Emergency!");
// log some stats
client.setKey("responseTime", 101);
client.increment("counter");
// flush the messages to the network
client.flush()
}
}
</pre>
</div>
<a name="C"><h1>C Example</h1></a>
<div id="block">
<pre>
#include "mondemand.h"
int
main(void)
{
struct mondemand_client *client = NULL;
struct mondemand_transport *transport = NULL;
// create the client
client = mondemand_client_create("my_application");
// create a transport to send data
transport = mondemand_transport_lwes_create("224.1.11.111", 9191, NULL, 0, 60);
// attach the transport to the client
mondemand_add_transport(client, transport);
// add some contextual information to the client
mondemand_set_context(client, "cluster_id", "123");
// log some messages
mondemand_info(client, MONDEMAND_NULL_TRACE_ID, "Hello! I am %s", "123");
// log some stats
mondemand_set_key_by_val(client, "stat_1", 1234);
mondemand_increment_key(client, "stat_2");
// send it to the network
mondemand_flush(client);
return 0;
}
</pre>
</div>
<div id="footer">
© 2009-2015 MonDemand
</div>
</div>
</div>
</body>
</html>