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 ###### 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 ###### 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 The domain for each axis is also customized to account for the scale difference
between column values. 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 ## 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: 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. 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 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) In the Histogram visualization options, select `_time` as the [X Column](#data)
and `severity` as the [Group By](#data) option: 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 ###### Use a scatter plot to visualize correlation
In the Scatter visualization controls, points are differentiated based on their group keys. 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 ## 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: 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. 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 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 ###### 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 ###### 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. Description: Lambda function performing request URI rewriting.
Code: Code:
ZipFile: | ZipFile: |
const config = { 'use strict';
suffix: '.html',
appendToDirs: 'index.html',
removeTrailingSlash: false,
};
const regexSuffixless = /\/[a-z0-9]+([0-9\.]+)?$/; // e.g. "/some/page" but not "/", "/some/" or "/some.jpg" exports.handler = (event, context, callback) => {
const regexTrailingSlash = /.+\/$/; // e.g. "/some/" or "/some/page/" but not root "/"
exports.handler = function handler(event, context, callback) {
const { request } = event.Records[0].cf; const { request } = event.Records[0].cf;
const { uri } = request; const { uri, headers, origin } = request;
const { suffix, appendToDirs, removeTrailingSlash } = config; const extension = uri.substr(uri.lastIndexOf('.') + 1);
// Append ".html" to origin request const validExtensions = ['.html', '.css', '.js', '.xml', '.png', '.jpg', '.svg', '.otf', '.eot', '.ttf', '.woff'];
if (suffix && uri.match(regexSuffixless)) { const indexPath = 'index.html';
request.uri = uri + suffix; const defaultPath = '/v2.0/'
callback(null, request);
return; // 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 const pathsV1 = ['/influxdb', '/telegraf', '/chronograf', '/kapacitor', '/enterprise_influxdb', '/enterprise_kapacitor'];
if (appendToDirs && uri.match(regexTrailingSlash)) { const originV1 = process.env.ORIGIN_V1;
request.uri = uri + appendToDirs;
callback(null, request);
return;
}
// Redirect (301) non-root requests ending in "/" to URI without trailing slash // Send to v1 origin if start of path matches
if (removeTrailingSlash && uri.match(/.+\/$/)) { if (pathsV1.filter((path) => uri.startsWith(path)) > 0) {
const response = { headers['host'] = [{key: 'host', value: originV1}];
// body: '', origin.s3.domainName = originV1;
// bodyEncoding: 'text',
headers: {
'location': [{
key: 'Location',
value: uri.slice(0, -1)
}]
},
status: '301',
statusDescription: 'Moved Permanently'
};
callback(null, response);
return;
} }
// If nothing matches, return request unchanged // If nothing matches, return request unchanged
callback(null, request); callback(null, request);
}; };
Handler: index.handler Handler: index.handler
MemorySize: 128 MemorySize: 128
Role: !Sub ${DocsOriginRequestRewriteLambdaRole.Arn} 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