Skip to content

Commit

Permalink
add proxyPath config for graphite web endpoint (#3893)
Browse files Browse the repository at this point in the history
* add proxyPath config for graphite web endpoint

* fix lint
  • Loading branch information
Shalankwa committed Jun 27, 2023
1 parent 2480fd7 commit 404ce00
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/documentation/sitespeed.io/configuration/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ Graphite
--graphite.auth The Graphite user and password used for authentication. Format: user:password
--graphite.httpPort The Graphite port used to access the user interface and send annotations event [default: 8080]
--graphite.webHost The graphite-web host. If not specified graphite.host will be used.
--graphite.proxyPath The added path to graphite-web api when behind a proxy. [default: ""]
--graphite.namespace The namespace key added to all captured metrics. [default: "sitespeed_io.default"]
--graphite.includeQueryParams Whether to include query parameters from the URL in the Graphite keys or not [boolean] [default: false]
--graphite.arrayTags Send the tags as Array or a String. In Graphite 1.0 the tags is a array. Before a String [boolean] [default: true]
Expand Down
5 changes: 5 additions & 0 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,11 @@ export async function parseCommandLine() {
'The graphite-web host. If not specified graphite.host will be used.',
group: 'Graphite'
})
.option('graphite.proxyPath', {
describe: 'The added path to graphite-web when behind a proxy.',
default: '',
group: 'Graphite'
})
.option('graphite.namespace', {
default: 'sitespeed_io.default',
describe: 'The namespace key added to all captured metrics.',
Expand Down
1 change: 1 addition & 0 deletions lib/plugins/graphite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default class GraphitePlugin extends SitespeedioPlugin {
this.receivedTypesThatFireAnnotations = {};
this.make = context.messageMaker('graphite').make;
this.sendAnnotation = options_.sendAnnotation;
this.proxyPath = options_.proxyPath;
this.alias = {};
this.wptExtras = {};
this.usingBrowsertime = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/graphite/send-annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function send(
const postOptions = {
hostname: options.graphite.webHost || options.graphite.host,
port: options.graphite.httpPort || 8080,
path: '/events/',
path: options.graphite.proxyPath + '/events/',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Expand Down

0 comments on commit 404ce00

Please sign in to comment.