Hotfix: Updated lambda function and visualization example images

pull/291/head
Scott Anderson 2019-06-25 09:07:48 -06:00
parent 014f659944
commit 560e0f0918
24 changed files with 61 additions and 47 deletions

View File

@ -64,4 +64,4 @@ from(bucket: "example-bucket")
```
###### Visualization options for pressure gauge
{{< img-hd src="/img/2-0-visualizations-guage-pressure.jpg" alt="Pressure guage example" />}}
{{< img-hd src="/img/2-0-visualizations-guage-pressure.png" alt="Pressure guage example" />}}

View File

@ -90,4 +90,4 @@ from(bucket: "example-bucket")
)
```
###### Memory usage visualization
{{< img-hd src="/img/2-0-visualizations-graph-single-stat-mem.jpg" alt="Graph + Single Stat Memory Usage Example" />}}
{{< img-hd src="/img/2-0-visualizations-graph-single-stat-mem.png" alt="Graph + Single Stat Memory Usage Example" />}}

View File

@ -96,7 +96,7 @@ and `_value_mem` is selected as the [Y Column](#data).
The domain for each axis is also customized to account for the scale difference
between column values.
{{< img-hd src="/img/2-0-visualizations-heatmap-correlation.jpg" alt="Heatmap correlation example" />}}
{{< img-hd src="/img/2-0-visualizations-heatmap-correlation.png" alt="Heatmap correlation example" />}}
## Important notes
@ -108,7 +108,7 @@ However, in certain cases, heatmaps provide better visibility into point density
For example, the dashboard cells below visualize the same query results:
{{< img-hd src="/img/2-0-visualizations-heatmap-vs-scatter.jpg" alt="Heatmap vs Scatter plot" />}}
{{< img-hd src="/img/2-0-visualizations-heatmap-vs-scatter.png" alt="Heatmap vs Scatter plot" />}}
The heatmap indicates isolated high point density, which isn't visible in the scatter plot.
In the scatter plot visualization, points that share the same X and Y coordinates

View File

@ -77,4 +77,4 @@ from(bucket: "example-bucket")
In the Histogram visualization options, select `_time` as the [X Column](#data)
and `severity` as the [Group By](#data) option:
{{< img-hd src="/img/2-0-visualizations-histogram-errors.jpg" alt="Errors histogram" />}}
{{< img-hd src="/img/2-0-visualizations-histogram-errors.png" alt="Errors histogram" />}}

View File

@ -91,7 +91,7 @@ union(tables: [cpu, mem])
###### Use a scatter plot to visualize correlation
In the Scatter visualization controls, points are differentiated based on their group keys.
{{< img-hd src="/img/2-0-visualizations-scatter-correlation.jpg" alt="Heatmap correlation example" />}}
{{< img-hd src="/img/2-0-visualizations-scatter-correlation.png" alt="Heatmap correlation example" />}}
## Important notes
@ -102,7 +102,7 @@ However, in certain cases, scatterplots can "hide" points if they share the same
For example, the dashboard cells below visualize the same query results:
{{< img-hd src="/img/2-0-visualizations-heatmap-vs-scatter.jpg" alt="Heatmap vs Scatter plot" />}}
{{< img-hd src="/img/2-0-visualizations-heatmap-vs-scatter.png" alt="Heatmap vs Scatter plot" />}}
The heatmap indicates isolated high point density, which isn't visible in the scatter plot.
In the scatter plot visualization, points that share the same X and Y coordinates

View File

@ -62,4 +62,4 @@ from(bucket: "example-bucket")
```
###### Memory usage as a single stat
{{< img-hd src="/img/2-0-visualizations-single-stat-memor.jpg" alt="Graph + Single Stat Memory Usage Example" />}}
{{< img-hd src="/img/2-0-visualizations-single-stat-memor.png" alt="Graph + Single Stat Memory Usage Example" />}}

View File

@ -80,4 +80,4 @@ from(bucket: "example-bucket")
```
###### Cluster metrics in a table
{{< img-hd src="/img/2-0-visualizations-table-human-readable.jpg" alt="Human readable metrics in a table" />}}
{{< img-hd src="/img/2-0-visualizations-table-human-readable.png" alt="Human readable metrics in a table" />}}

View File

@ -156,55 +156,69 @@ Resources:
Description: Lambda function performing request URI rewriting.
Code:
ZipFile: |
const config = {
suffix: '.html',
appendToDirs: 'index.html',
removeTrailingSlash: false,
};
'use strict';
const regexSuffixless = /\/[a-z0-9]+([0-9\.]+)?$/; // e.g. "/some/page" but not "/", "/some/" or "/some.jpg"
const regexTrailingSlash = /.+\/$/; // e.g. "/some/" or "/some/page/" but not root "/"
exports.handler = function handler(event, context, callback) {
exports.handler = (event, context, callback) => {
const { request } = event.Records[0].cf;
const { uri } = request;
const { suffix, appendToDirs, removeTrailingSlash } = config;
const { uri, headers, origin } = request;
const extension = uri.substr(uri.lastIndexOf('.') + 1);
// Append ".html" to origin request
if (suffix && uri.match(regexSuffixless)) {
request.uri = uri + suffix;
callback(null, request);
return;
const validExtensions = ['.html', '.css', '.js', '.xml', '.png', '.jpg', '.svg', '.otf', '.eot', '.ttf', '.woff'];
const indexPath = 'index.html';
const defaultPath = '/v2.0/'
// If path ends with '/', then append 'index.html', otherwise redirect to a
// path with '/' or ignore if the path ends with a valid file extension.
if ((uri == '/') || (uri.length < defaultPath.length)) {
callback(null, {
status: '302',
statusDescription: 'Found',
headers: {
location: [{
key: 'Location',
value: defaultPath,
}],
}
});
} else if (uri.endsWith('/')) {
request.uri = uri + indexPath;
} else if (uri.endsWith('/index.html')) {
callback(null, {
status: '302',
statusDescription: 'Found',
headers: {
location: [{
key: 'Location',
value: uri.substr(0, uri.length - indexPath.length),
}],
}
});
} else if (validExtensions.filter((ext) => uri.endsWith(ext)) == 0) {
callback(null, {
status: '302',
statusDescription: 'Found',
headers: {
location: [{
key: 'Location',
value: uri + '/',
}],
}
});
}
// Append "index.html" to origin request
if (appendToDirs && uri.match(regexTrailingSlash)) {
request.uri = uri + appendToDirs;
callback(null, request);
return;
}
const pathsV1 = ['/influxdb', '/telegraf', '/chronograf', '/kapacitor', '/enterprise_influxdb', '/enterprise_kapacitor'];
const originV1 = process.env.ORIGIN_V1;
// Redirect (301) non-root requests ending in "/" to URI without trailing slash
if (removeTrailingSlash && uri.match(/.+\/$/)) {
const response = {
// body: '',
// bodyEncoding: 'text',
headers: {
'location': [{
key: 'Location',
value: uri.slice(0, -1)
}]
},
status: '301',
statusDescription: 'Moved Permanently'
};
callback(null, response);
return;
// Send to v1 origin if start of path matches
if (pathsV1.filter((path) => uri.startsWith(path)) > 0) {
headers['host'] = [{key: 'host', value: originV1}];
origin.s3.domainName = originV1;
}
// If nothing matches, return request unchanged
callback(null, request);
};
Handler: index.handler
MemorySize: 128
Role: !Sub ${DocsOriginRequestRewriteLambdaRole.Arn}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB