-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Blocked] Query-Service config and runtime configuration of URL path-prefix #151
Changes from 4 commits
09d91e6
f397a31
26f3fd9
7779eb5
f7fef18
8bccc2f
cddac1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
const webpack = require('webpack'); | ||
|
||
module.exports = function override(config, env) { | ||
if (env === 'production') { | ||
config.plugins.push( | ||
// prevent code-splitting to allow the URL path-prefix for the site to be | ||
// configurable at runtime | ||
// https://github.com/jaegertracing/jaeger-ui/issues/42 | ||
new webpack.optimize.LimitChunkCountPlugin({ | ||
maxChunks: 1, | ||
}) | ||
); | ||
} | ||
return config; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,13 +14,24 @@ | |
<script> | ||
// Jaeger UI config data is embedded by the query-service. This is | ||
// later merged with defaults into the redux `state.config` via | ||
// src/utils/config/get-config.js. The default provided by the query | ||
// service should be an empty object or it can leave `DEFAULT_CONFIG` | ||
// src/utils/config#getUiConfig. The default provided by the query | ||
// service should be an empty object or it can leave `DEFAULT_UI_CONFIG` | ||
// unchanged. | ||
function getJaegerUiConfig() { | ||
const DEFAULT_CONFIG = null; | ||
const JAEGER_CONFIG = DEFAULT_CONFIG; | ||
return JAEGER_CONFIG; | ||
const DEFAULT_UI_CONFIG = null; | ||
const JAEGER_UI_CONFIG = DEFAULT_UI_CONFIG; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need DEFAULT_ constants? When I originally proposed them I thought they would have some concrete values, and it was easier to search&replace the string There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could do that. I think tweaking the name a bit to imply it might be over-written has some value, though: // use `null` as a fallback value if the query-service does not embed a value
const __INJECTED_UI_CONFIG__ = null;
const JAEGER_UI_CONFIG = __INJECTED_UI_CONFIG__; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great. Done. |
||
return JAEGER_UI_CONFIG; | ||
} | ||
|
||
// Query-service config data is embedded by the query-service. This is | ||
// later merged with defaults into the redux `state.config.queryService` | ||
// via src/utils/config#getQuerySvcConfig. The default provided by the | ||
// query service should be an empty object or it can leave | ||
// `DEFAULT_QS_CONFIG` unchanged. | ||
function getJaegerQuerySvcConfig() { | ||
const DEFAULT_QS_CONFIG = null; | ||
const JAEGER_QS_CONFIG = DEFAULT_QS_CONFIG; | ||
return JAEGER_QS_CONFIG; | ||
} | ||
</script> | ||
</head> | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -116,7 +116,7 @@ export default class SearchTracePage extends Component { | |||
!hasTraceResults && ( | ||||
<div className="ui middle aligned center aligned grid" style={{ marginTop: 100 }}> | ||||
<div className="column"> | ||||
<img className="js-test-logo" alt="presentation" src={JaegerLogo} width="400" /> | ||||
<img className="js-test-logo" alt="presentation" src={prefixUrl(JaegerLogo)} width="400" /> | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was it using relative url before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it uses an absolute path. The image is imported in JS:
That does two things:
The absolute path is then used in the JSX as you excerpted. The |
||||
</div> | ||||
</div> | ||||
)} | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import deepFreeze from 'deep-freeze'; | ||
|
||
export default deepFreeze({ | ||
pathPrefix: null, | ||
}); | ||
|
||
export const deprecations = []; |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so which way are we going, global search&replace of the path in the query service or using this plugin to not split the js files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yurishkuro Still up for debate.
The main considerations:
Note: every *.js file, not just main.NNNN.js, must be checked for the
static/js
path and prefixed if foundSo, my main concern is around maintainability.
The above inconveniences allow us to avert a likely hit on initial page-load time, possibly a ~5% increase.
The ideal scenario, IMO, is to do the global replace and if maintaining it is a PITA then revert and go with the plugin approach to not split the files. Not sure how feasible that approach is on the query-service side.
Would that work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would suggest trying global replace first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. This PR needs some rework, then.