Skip to content
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

[Infra UI] Consume log entry graphql api in the client #21706

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/kbn-dev-utils/src/proc_runner/observe_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ import { first, ignoreElements, map } from 'rxjs/operators';
*/
export function observeReadable(readable) {
return Rx.race(
Rx.fromEvent(readable, 'end').pipe(first(), ignoreElements()),
Rx.fromEvent(readable, 'end').pipe(
first(),
ignoreElements()
),

Rx.fromEvent(readable, 'error').pipe(first(), map(err => Rx.throwError(err)))
Rx.fromEvent(readable, 'error').pipe(
first(),
map(err => Rx.throwError(err))
)
);
}
3 changes: 1 addition & 2 deletions packages/kbn-es/src/utils/decompress.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ const tarFs = require('tar-fs');

function decompressTarball(archive, dirPath) {
return new Promise((resolve, reject) => {
fs
.createReadStream(archive)
fs.createReadStream(archive)
.on('error', reject)
.pipe(zlib.createGunzip())
.on('error', reject)
Expand Down
19 changes: 16 additions & 3 deletions packages/kbn-pm/src/utils/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,31 @@ function getWatchHandlers(
const typescriptHandler = buildOutput$.pipe(
first(data => data.includes('$ tsc')),
map(() =>
buildOutput$.pipe(first(data => data.includes('Compilation complete.')), mapTo('tsc'))
buildOutput$.pipe(
first(data => data.includes('Compilation complete.')),
mapTo('tsc')
)
)
);

const webpackHandler = buildOutput$.pipe(
first(data => data.includes('$ webpack')),
map(() => buildOutput$.pipe(first(data => data.includes('Chunk Names')), mapTo('webpack')))
map(() =>
buildOutput$.pipe(
first(data => data.includes('Chunk Names')),
mapTo('webpack')
)
)
);

const defaultHandler = Rx.of(undefined).pipe(
delay(handlerReadinessTimeout),
map(() => buildOutput$.pipe(timeout(handlerDelay), catchError(() => Rx.of('timeout'))))
map(() =>
buildOutput$.pipe(
timeout(handlerDelay),
catchError(() => Rx.of('timeout'))
)
)
);

return [typescriptHandler, webpackHandler, defaultHandler];
Expand Down
6 changes: 5 additions & 1 deletion packages/kbn-test/src/functional_tests/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ export async function startServers(options) {

async function silence(milliseconds, { log }) {
await Rx.fromEvent(log, 'data')
.pipe(startWith(null), switchMap(() => Rx.timer(milliseconds)), take(1))
.pipe(
startWith(null),
switchMap(() => Rx.timer(milliseconds)),
take(1)
)
.toPromise();
}

Expand Down
6 changes: 5 additions & 1 deletion src/core/lib/kbn_observable/operators/reduce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export function reduce<T, R>(
initialValue: R
): OperatorFunction<T, R> {
return function reduceOperation(source) {
return pipe(scan(accumulator, initialValue), ifEmpty(() => initialValue), last())(source);
return pipe(
scan(accumulator, initialValue),
ifEmpty(() => initialValue),
last()
)(source);
};
}
3 changes: 3 additions & 0 deletions x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@types/react-dom": "^16.0.5",
"@types/react-redux": "^6.0.2",
"@types/react-router-dom": "^4.2.6",
"@types/reduce-reducers": "^0.1.3",
"@types/sinon": "^5.0.0",
"@types/uuid": "^3.4.3",
"abab": "^1.0.4",
Expand All @@ -66,6 +67,7 @@
"enzyme-to-json": "3.3.1",
"expect.js": "0.3.1",
"graphql-code-generator": "^0.10.1",
"graphql-codegen-introspection-template": "^0.10.5",
"graphql-codegen-typescript-template": "^0.10.1",
"gulp": "3.9.1",
"gulp-load-plugins": "1.2.0",
Expand Down Expand Up @@ -184,6 +186,7 @@
"react-sticky": "^6.0.1",
"react-syntax-highlighter": "^5.7.0",
"react-vis": "^1.8.1",
"reduce-reducers": "^0.4.3",
"redux": "4.0.0",
"redux-actions": "2.2.1",
"redux-observable": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ function mapStateToProps(state = {}) {

const mapDispatchToProps = {};

export default connect(mapStateToProps, mapDispatchToProps)(ErrorGroupDetails);
export default connect(
mapStateToProps,
mapDispatchToProps
)(ErrorGroupDetails);
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ export default class WatcherFlyout extends Component {
href={_.get(ELASTIC_DOCS, 'watcher-get-started.url')}
>
documentation
</EuiLink>.
</EuiLink>
.
</p>

<EuiForm>
Expand Down Expand Up @@ -368,7 +369,8 @@ export default class WatcherFlyout extends Component {
href={_.get(ELASTIC_DOCS, 'x-pack-emails.url')}
>
documentation
</EuiLink>.
</EuiLink>
.
</span>
}
>
Expand Down Expand Up @@ -399,7 +401,8 @@ export default class WatcherFlyout extends Component {
href="https://get.slack.help/hc/en-us/articles/115005265063-Incoming-WebHooks-for-Slack"
>
documentation
</EuiLink>.
</EuiLink>
.
</span>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ function mapStateToProps(state = {}) {

const mapDispatchToProps = {};

export default connect(mapStateToProps, mapDispatchToProps)(ErrorGroupOverview);
export default connect(
mapStateToProps,
mapDispatchToProps
)(ErrorGroupOverview);
4 changes: 3 additions & 1 deletion x-pack/plugins/apm/public/components/app/Main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export default function Main() {
{routes.map((route, i) => {
return route.switch ? (
<Switch key={i}>
{route.routes.map((route, i) => <Route key={i} {...route} />)}
{route.routes.map((route, i) => (
<Route key={i} {...route} />
))}
</Switch>
) : (
<Route key={i} {...route} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ function mapStateToProps(state = {}) {
}

const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(ServiceOverview);
export default connect(
mapStateToProps,
mapDispatchToProps
)(ServiceOverview);
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const SamplingTooltip = () => (
<Tooltip>
<TooltipTitle>Sampling</TooltipTitle>
Each bucket will show a sample transaction. If there&apos;s no sample
available,<br />
available,
<br />
it&apos;s most likely because of the sampling limit set in the agent
configuration.
</Tooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ function mapStateToProps(state = {}) {
}

const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(Distribution);
export default connect(
mapStateToProps,
mapDispatchToProps
)(Distribution);
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class Span extends React.Component {
location
} = this.props;

const width = get({ span }, SPAN_DURATION) / totalDuration * 100;
const left = get({ span }, SPAN_START) / totalDuration * 100;
const width = (get({ span }, SPAN_DURATION) / totalDuration) * 100;
const left = (get({ span }, SPAN_START) / totalDuration) * 100;

const spanId = get({ span }, SPAN_ID);
const spanName = get({ span }, SPAN_NAME);
Expand All @@ -132,7 +132,9 @@ class Span extends React.Component {
}}
/>
<SpanLabel style={{ left: `${left}%`, width: `${100 - left}%` }}>
&lrm;{spanName}&lrm;
&lrm;
{spanName}
&lrm;
</SpanLabel>

<Modal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ function mapStateToProps(state = {}) {
}

const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(Spans);
export default connect(
mapStateToProps,
mapDispatchToProps
)(Spans);
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ function mapStateToProps(state = {}) {
}

const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(Transaction);
export default connect(
mapStateToProps,
mapDispatchToProps
)(Transaction);
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function mapStateToProps(state = {}) {
}

const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(
TransactionsDetails
);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TransactionsDetails);
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export default class DynamicBaselineFlyout extends Component {
text: (
<p>
There&apos;s already a job running for anomaly detection on{' '}
{serviceName} ({transactionType}).{' '}
{serviceName} ({transactionType}
).{' '}
<a href={getMlJobUrl(serviceName, transactionType, location)}>
View existing job
</a>
Expand All @@ -89,8 +90,8 @@ export default class DynamicBaselineFlyout extends Component {
color: 'success',
text: (
<p>
The analysis is now running for {serviceName} ({transactionType}).
It might take a while before results are added to the response
The analysis is now running for {serviceName} ({transactionType}
). It might take a while before results are added to the response
times graph.{' '}
<a href={getMlJobUrl(serviceName, transactionType, location)}>
View job
Expand Down Expand Up @@ -140,9 +141,9 @@ export default class DynamicBaselineFlyout extends Component {
iconType="check"
>
<p>
There is currently a job running for {serviceName} ({
transactionType
}).{' '}
There is currently a job running for {serviceName} (
{transactionType}
).{' '}
<a href={getMlJobUrl(serviceName, transactionType, location)}>
View existing job
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ const ImpactTooltip = () => (
trigger="hover"
overlay={
<Tooltip>
Impact shows the most used and<br />slowest endpoints in your service.
Impact shows the most used and
<br />
slowest endpoints in your service.
</Tooltip>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function mapStateToProps(state = {}) {

const mapDispatchToProps = {};

export default connect(mapStateToProps, mapDispatchToProps)(
TransactionOverview
);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TransactionOverview);
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ import { updateLocation } from '../../../store/location';
const mapDispatchToProps = {
updateLocation
};
export default connect(null, mapDispatchToProps)(view);
export default connect(
null,
mapDispatchToProps
)(view);
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ function mapStateToProps(state = {}) {
}

const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(TabNavigation);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TabNavigation);
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ function TabNavigation({ urlParams, location }) {
<TooltipOverlay
content={
<span>
Transaction type:<br />
Transaction type:
<br />
{label}
</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ function MoreSeries({ hiddenSeriesCount }) {
return null;
}

return <MoreSeriesContainer>(+{hiddenSeriesCount})</MoreSeriesContainer>;
return (
<MoreSeriesContainer>
(+
{hiddenSeriesCount})
</MoreSeriesContainer>
);
}

export default function Legends({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ const INITIAL_DATA = [];
const withInitialData = createInitialDataSelector(INITIAL_DATA);

const getRelativeImpact = (impact, impactMin, impactMax) =>
Math.max((impact - impactMin) / Math.max(impactMax - impactMin, 1) * 100, 1);
Math.max(
((impact - impactMin) / Math.max(impactMax - impactMin, 1)) * 100,
1
);

function getWithRelativeImpact(items) {
const impacts = items.map(({ impact }) => impact);
Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/apm/public/utils/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ export function KibanaLinkComponent({
return <EuiLink {...props} href={href} />;
}

const withLocation = connect(({ location }) => ({ location }), {});
const withLocation = connect(
({ location }) => ({ location }),
{}
);
export const RelativeLink = withLocation(RelativeLinkComponent);
export const KibanaLink = withLocation(KibanaLinkComponent);

Expand Down
Loading