Skip to content

Commit 5f2449f

Browse files
committed
init commit
1 parent d609068 commit 5f2449f

21 files changed

+1135
-890
lines changed

config/_default/config.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ enableGitInfo: true
2626

2727
# Allow to render HTML in markdown files
2828
markup:
29-
defaultMarkdownHandler: blackfriday
29+
goldmark:
30+
renderer:
31+
unsafe: true
3032
highlight:
3133
guessSyntax: true
3234

config/_default/params.yaml

+24-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,30 @@ imgix:
77
png: "?fm=png&auto=format&lossless=1"
88
gif: ""
99
code_languages:
10-
- display_name: Curl
11-
key: bash
12-
- display_name: Python
13-
key: python
14-
- display_name: Ruby
15-
key: ruby
10+
'py':
11+
extension: py
12+
name: python
13+
'rb':
14+
extension: rb
15+
name: ruby
16+
'sh':
17+
extension: sh
18+
name: curl
19+
'sh':
20+
extension: sh
21+
name: curl
22+
'go':
23+
extension: go
24+
name: go
25+
'java':
26+
extension: java
27+
name: java
28+
'cs':
29+
extension: cs
30+
name: csharp
31+
'php':
32+
extension: php
33+
name: php
1634

1735
branch: ""
1836

content/en/developers/events/dogstatsd.md

+36-33
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ event(<TITLE>, <TEXT>, <TIMESTAMP>, <HOSTNAME>, <AGGREGATION_KEY>, <PRIORITY>, <
4040

4141
View errors and exceptions in Datadog with a DogStatsD event:
4242

43-
{{< tabs >}}
44-
{{% tab "Python" %}}
4543

46-
{{< code-block lang="python" filename="event.py" >}}
44+
{{< code-lang-tabs langs="python,ruby,go,java,php,csharp">}}
45+
46+
47+
{{< code-wrapper lang="python" filename="event.py" >}}
48+
```python
4749
from datadog import initialize, statsd
4850

4951
options = {
@@ -54,23 +56,22 @@ options = {
5456
initialize(**options)
5557

5658
statsd.event('An error occurred', 'Error message', alert_type='error', tags=['env:dev'])
57-
{{< /code-block >}}
59+
```
5860

59-
{{% /tab %}}
60-
{{% tab "Ruby" %}}
61+
{{< /code-wrapper >}}
6162

62-
{{< code-block lang="ruby" filename="event.rb" >}}
63+
{{< code-wrapper lang="ruby" filename="event.rb" >}}
64+
```ruby
6365
require 'datadog/statsd'
6466

6567
statsd = Datadog::Statsd.new('localhost', 8125)
6668

6769
statsd.event('An error occurred', "Error message", alert_type: 'error', tags: ['env:dev'])
68-
{{< /code-block >}}
69-
70-
{{% /tab %}}
71-
{{% tab "Go" %}}
70+
```
71+
{{< /code-wrapper >}}
7272

73-
{{< code-block lang="go" filename="event.go" >}}
73+
{{< code-wrapper lang="go" filename="event.go" >}}
74+
```go
7475
package main
7576

7677
import (
@@ -92,12 +93,11 @@ func main() {
9293
time.Sleep(10 * time.Second)
9394
}
9495
}
95-
{{< /code-block >}}
96-
97-
{{% /tab %}}
98-
{{% tab "Java" %}}
96+
```
97+
{{< /code-wrapper >}}
9998

100-
{{< code-block lang="java" filename="event.java" >}}
99+
{{< code-wrapper lang="java" filename="event.java" >}}
100+
```java
101101
import com.timgroup.statsd.Event;
102102
import com.timgroup.statsd.NonBlockingStatsDClientBuilder;
103103
import com.timgroup.statsd.StatsDClient;
@@ -121,12 +121,11 @@ public class DogStatsdClient {
121121
Statsd.recordEvent(event);
122122
}
123123
}
124-
{{< /code-block >}}
125-
126-
{{% /tab %}}
127-
{{% tab ".NET" %}}
124+
```
125+
{{< /code-wrapper >}}
128126

129-
{{< code-block lang="csharp" filename="event.cs" >}}
127+
{{< code-wrapper lang="csharp" filename="event.cs" >}}
128+
```csharp
130129
using StatsdClient;
131130

132131
public class DogStatsdClient
@@ -146,12 +145,11 @@ public class DogStatsdClient
146145
}
147146
}
148147
}
149-
{{< /code-block >}}
150-
151-
{{% /tab %}}
152-
{{% tab "PHP" %}}
148+
```
149+
{{< /code-wrapper >}}
153150

154-
{{< code-block lang="php" filename="event.php" >}}
151+
{{< code-wrapper lang="php" filename="event.php" >}}
152+
```php
155153
<?php
156154

157155
require __DIR__ . '/vendor/autoload.php';
@@ -169,12 +167,17 @@ $statsd->event('An error occurred.',
169167
'alert_type' => 'error'
170168
)
171169
);
172-
{{< /code-block >}}
170+
```
173171

174172
With the DogStatsD-PHP library you can submit events via TCP directly to the Datadog API. It's slower but more reliable than using the Agent DogStatsD instance since events are forwarded from your application to the Agent using UDP.
175173
To use this, you must configure the library with your [Datadog API and application keys][1] instead of the local DogStatS instance:
176174

177-
{{< code-block lang="php" filename="event_through_api.php" >}}
175+
[1]: /developers/dogstatsd/
176+
177+
{{< /code-wrapper >}}
178+
179+
{{< code-wrapper lang="php" filename="event_through_api.php" >}}
180+
```php
178181
<?php
179182

180183
require __DIR__ . '/vendor/autoload.php';
@@ -192,21 +195,21 @@ $statsd->event('An error occurred.',
192195
'alert_type' => 'error'
193196
)
194197
);
195-
{{< /code-block >}}
198+
```
199+
{{< /code-wrapper >}}
200+
201+
{{< code-lang-tabs langs="python,ruby,go,java,php,csharp">}}
196202

197203
**Note**:
198204

199205
* Sending events with this method uses cURL for API requests.
200206
* You should use a `try`/`catch` code block to avoid warnings or errors on communication issues with the Datadog API.
201207

202208
[1]: https://app.datadoghq.com/account/settings#api
203-
{{% /tab %}}
204-
{{< /tabs >}}
205209

206210
## Further reading
207211

208212
{{< partial name="whats-next/whats-next.html" >}}
209213

210214

211-
[1]: /developers/dogstatsd/
212215
[2]: /events/

content/en/developers/service_checks/dogstatsd_service_checks_submission.md

+25-32
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Service check function parameters:
3838

3939
Choose your language for a service check code example:
4040

41-
{{< tabs >}}
42-
{{% tab "Python" %}}
41+
{{< code-lang-tabs langs="python,ruby,go,java,.NET,php">}}
4342

44-
{{< code-block lang="python" filename="service_check.py" >}}
43+
{{< code-wrapper lang="python" filename="service_check.py" >}}
44+
```python
4545
from datadog import initialize, statsd
4646

4747
options = {"statsd_host": "127.0.0.1", "statsd_port": 8125}
@@ -53,23 +53,21 @@ statsd.service_check(
5353
status="O",
5454
message="Application is OK",
5555
)
56-
{{< /code-block >}}
57-
58-
{{% /tab %}}
59-
{{% tab "Ruby" %}}
56+
```
57+
{{< /code-wrapper >}}
6058

61-
{{< code-block lang="ruby" filename="service_check.rb" >}}
59+
{{< code-wrapper lang="ruby" filename="service_check.rb" >}}
60+
```ruby
6261
require 'datadog/statsd'
6362

6463
statsd = Datadog::Statsd.new('localhost', 8125)
6564

6665
statsd.service_check('application.service_check', 0, {'message' => 'Application is OK'})
67-
{{< /code-block >}}
68-
69-
{{% /tab %}}
70-
{{% tab "Go" %}}
66+
```
67+
{{< /code-wrapper >}}
7168

72-
{{< code-block lang="go" filename="service_check.go" >}}
69+
{{< code-wrapper lang="go" filename="service_check.go" >}}
70+
```go
7371
package main
7472

7573
import (
@@ -92,12 +90,11 @@ func main() {
9290
time.Sleep(10 * time.Second)
9391
}
9492
}
95-
{{< /code-block >}}
96-
97-
{{% /tab %}}
98-
{{% tab "Java" %}}
93+
```
94+
{{< /code-wrapper >}}
9995

100-
{{< code-block lang="java" filename="service_check.java" >}}
96+
{{< code-wrapper lang="java" filename="service_check.java" >}}
97+
```java
10198
import com.timgroup.statsd.ServiceCheck;
10299
import com.timgroup.statsd.NonBlockingStatsDClientBuilder;
103100
import com.timgroup.statsd.StatsDClient;
@@ -120,12 +117,11 @@ public class DogStatsdClient {
120117
Statsd.serviceCheck(sc);
121118
}
122119
}
123-
{{< /code-block >}}
124-
125-
{{% /tab %}}
126-
{{% tab ".NET" %}}
120+
```
121+
{{< /code-wrapper >}}
127122

128-
{{< code-block lang="csharp" filename="service_check.cs" >}}
123+
{{< code-wrapper lang=".NET" filename="service_check.cs" >}}
124+
```csharp
129125
using StatsdClient;
130126

131127
public class DogStatsdClient
@@ -145,12 +141,11 @@ public class DogStatsdClient
145141
}
146142
}
147143
}
148-
{{< /code-block >}}
149-
150-
{{% /tab %}}
151-
{{% tab "PHP" %}}
144+
```
145+
{{< /code-wrapper >}}
152146

153-
{{< code-block lang="php" filename="service_check.php" >}}
147+
{{< code-wrapper lang="php" filename="service_check.php" >}}
148+
```php
154149
<?php
155150

156151
require __DIR__ . '/vendor/autoload.php';
@@ -164,10 +159,8 @@ $statsd = new DogStatsd(
164159
);
165160

166161
$statsd->service_check('Service.check.name', 0);
167-
{{< /code-block >}}
168-
169-
{{% /tab %}}
170-
{{< /tabs >}}
162+
```
163+
{{< /code-wrapper >}}
171164

172165
After a service check is reported, use it to trigger a [custom check monitor][2].
173166

layouts/_default/baseof.html

+13
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@
6060
</div>
6161
</div>
6262

63+
{{/* turns on code lang selector, off for now
64+
65+
block "code-lang" . }}
66+
<div class="code-lang-selector-container">
67+
<select class="js-code-lang-selector d-none" placeholder="Site">
68+
<option value="" disabled>Code Language</option>
69+
{{ range $key, $value := .Site.Params.code_languages }}
70+
<option value="{{ $value.name }}">{{ $value.name }}</option>
71+
{{ end }}
72+
</select>
73+
</div>
74+
{{ end */}}
75+
6376
<div class="region-selector-container">
6477
<select class="js-region-selector d-none" placeholder="Site">
6578
<option value="" disabled>Site</option>

0 commit comments

Comments
 (0)