Skip to content

Commit 32654c5

Browse files
added js to auto
1 parent 56d2d35 commit 32654c5

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

content/graphing.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@ title: Graphing Primer
33
kind: documentation
44
has_snippets: True
55
---
6+
<script type="text/javascript">
7+
$(document).ready(function () {
8+
location.hash && $(location.hash + '.collapse').collapse('show');
9+
});
10+
$(document).ready(function () {
11+
var targetloc = window.location.hash;
12+
if ($(targetloc).is(":hidden"))
13+
{
14+
var collapseparent = $(targetloc).closest('div[class^="collapse"]');
15+
// $('#section').html(collapseparent);
16+
$(collapseparent).show();
17+
$('#'+collapseparent.attr('id')+'Open').hide();
18+
$('#'+collapseparent.attr('id')+'Close').hide();
19+
window.location.hash = targetloc;
20+
21+
};
22+
});
23+
$(function(){
24+
$(document).on('click', 'a[href^="#"]', function(ev){
25+
var targetId = $(ev.target).attr('href'),
26+
$target = $(targetId);
27+
28+
$target.parents('.collapse').addClass('in').css({height: ''});
29+
});
30+
})
31+
</script>
632

733
## Find the Graph Editor
834
{: #editor}
@@ -347,14 +373,15 @@ jQuery(function(){
347373
<div class="collapse" id="collapseJSON" markdown="1">
348374

349375
## Graphing with the JSON editor
376+
{: #jgraphing}
350377

351378

352379
[Close JSON tab details](#collapseJSON){: role="button" data-toggle="collapse" aria-controls="collapseJSON" id="collapseJSONClose"}
353380

354381
![JSON Editor](/static/images/references-graphing-jsoneditor.png)
355382

356383
### Grammar
357-
{: #grammar}
384+
{: #jgrammar}
358385

359386

360387
The graph definition language is well-formed JSON and is structured in four parts:
@@ -393,6 +420,7 @@ In other words at the highest level the JSON structure is a dictionary with two,
393420
\* *only requests and viz are required.*
394421

395422
## Requests
423+
{: #jrequests}
396424

397425
The general format for a series is:
398426

@@ -409,6 +437,7 @@ A Series can be further combined together via binary operators (+, -, /, *):
409437
metric{scope} [by {group}] operator metric{scope} [by {group}]
410438

411439
#### Functions
440+
{: #jfunctions}
412441

413442
You can apply functions to the result of each query. <a href="/examples/graphing functions/">Examples</a>
414443

@@ -630,14 +659,17 @@ future. For more on <code>.as_count()</code> please see our blog post
630659
<a target="_blank" href="https://www.datadoghq.com/2014/05/visualize-statsd-metrics-counts-graphing/">here</a>.
631660

632661
#### Aggregation Method
662+
{: #jaggregation}
633663

634664
In most cases, the number of data points available outnumbers the maximum number that can be shown on screen. To overcome this, the data is aggregated using one of 4 available methods: average, max, min, and sum.
635665

636666
#### Metrics
667+
{: #jmetrics}
637668

638669
The metric is the main focus of the graph. You can find the list of metrics available to you in the [Metrics Summary](https://app.datadoghq.com/metric/summary). Click on any metric to see more detail about that metric, including the type of data collected, units, tags, hosts, and more.
639670

640671
#### Scope
672+
{: #jscope}
641673

642674
A scope lets you filter a Series. It can be a host, a device on a host
643675
or any arbitrary tag you can think of that contains only alphanumeric
@@ -653,10 +685,12 @@ Examples of scope (meaning in parentheses):
653685
* (wildcard for everything)
654686

655687
#### Groups
688+
{: #jgroups}
656689

657690
For any given metric, data may come from a number of hosts. The data will normally be aggregated from all these hosts to a single value for each time slot. If you wish to split this out, you can by any tag. To include a data point seperated out by each host, use {host} for your group.
658691

659692
#### Arithmetic
693+
{: #jmath}
660694

661695
You can apply simple arithmetic to a Series (+, -, * and /). In this
662696
example we graph 5-minute load and its double:
@@ -688,6 +722,7 @@ apples by oranges.
688722

689723

690724
### Events
725+
{: #jevents}
691726

692727
You can overlay any event from Datadog. The general format is:
693728

@@ -715,6 +750,7 @@ or if you're looking to display all errors:
715750

716751

717752
### Visualization
753+
{: #jviz}
718754

719755
Data can be visualized in a few different ways:
720756

@@ -733,6 +769,7 @@ The Time Series can be further broken down to:
733769
4. as bar charts
734770

735771
#### Line Charts
772+
{: #jlinecharts}
736773

737774
<img src="/static/images/multi-lines.png" style="width:100%; border:1px solid #777777"/>
738775

@@ -751,6 +788,7 @@ The representation is automatically derived from having multiple `requests` valu
751788
]
752789

753790
#### Stacked Series
791+
{: #jstacked}
754792

755793
<img src="/static/images/slice-n-stack.png" style="width:100%; border:1px solid #777777"/>
756794

@@ -765,6 +803,7 @@ In the case of related Time Series, you can easily draw them as stacked areas by
765803
Instead of one query per chart you can aggregate all queries into one and simply concatenate the queries.
766804

767805
#### Slice-n-Stack
806+
{: #jslice}
768807

769808
A useful visualization is to represent a metric shared across
770809
hosts and stack the results. For instance, when selecting a tag that
@@ -794,7 +833,7 @@ to get traffic for all the tagged hosts, split by host and network device.
794833

795834

796835
### Y-Axis Controls
797-
{: #yaxis}
836+
{: #jyaxis}
798837

799838
The Datadog y-axis controls (currently just via the JSON editor) allow you to:
800839
<ul>
@@ -841,6 +880,7 @@ Examples:
841880
}
842881

843882
#### Filtering
883+
{: #jfilter}
844884

845885
Filter configuration allows you to automatically change y-axis bounds based on a
846886
threshold. Thresholds can be a percentage or an absolute value, and it can apply to
@@ -915,6 +955,7 @@ Here is a full JSON example:
915955

916956

917957
#### Examples
958+
{: #jexamples}
918959

919960
Here is an example using the <code>rate()</code> function, which takes only a single metric as a parameter. Other functions, with the exception of <code>top()</code> and <code>top_offset()</code>, have identical syntax.
920961

0 commit comments

Comments
 (0)