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

[7.x] Move apm tutorial from apm plugin into apm_oss plugin (#66432) #67100

Closed
Closed
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
3 changes: 2 additions & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"visTypeVislib": "src/plugins/vis_type_vislib",
"visTypeXy": "src/plugins/vis_type_xy",
"visualizations": "src/plugins/visualizations",
"visualize": "src/plugins/visualize"
"visualize": "src/plugins/visualize",
"apmOss": "src/plugins/apm_oss"
},
"exclude": [
"src/legacy/ui/ui_render/ui_render_mixin.js"
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/apm_oss/common/index_pattern_constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you 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.
*/

export const APM_STATIC_INDEX_PATTERN_ID = 'apm_static_index_pattern_id';
4 changes: 2 additions & 2 deletions src/plugins/apm_oss/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"configPath": [
"apm_oss"
],
"ui": false,
"requiredPlugins": []
"ui": true,
"requiredPlugins": ["home"]
}
29 changes: 29 additions & 0 deletions src/plugins/apm_oss/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you 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 { ApmOssPlugin } from './plugin';

// This exports static code and TypeScript types,
// as well as, Kibana Platform `plugin()` initializer.
export function plugin() {
return new ApmOssPlugin();
}
export { ApmOssPluginSetup, ApmOssPluginStart } from './types';

export { APM_STATIC_INDEX_PATTERN_ID } from '../common/index_pattern_constants';
33 changes: 33 additions & 0 deletions src/plugins/apm_oss/public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you 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 { CoreSetup, CoreStart, Plugin } from 'kibana/public';
import { ApmOssPluginSetup, ApmOssPluginStart } from './types';

export class ApmOssPlugin implements Plugin<ApmOssPluginSetup, ApmOssPluginStart> {
public setup(core: CoreSetup): ApmOssPluginSetup {
return {};
}

public start(core: CoreStart): ApmOssPluginStart {
return {};
}

public stop() {}
}
27 changes: 27 additions & 0 deletions src/plugins/apm_oss/public/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you 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 @typescript-eslint/no-empty-interface
export interface ApmOssPluginSetup {}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ApmOssPluginStart {}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AppPluginStartDependencies {}
15 changes: 15 additions & 0 deletions src/plugins/apm_oss/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { schema, TypeOf } from '@kbn/config-schema';
import apmIndexPattern from './tutorial/index_pattern.json';
import { PluginInitializerContext } from '../../../core/server';
import { APMOSSPlugin } from './plugin';

Expand All @@ -41,3 +42,17 @@ export function plugin(initializerContext: PluginInitializerContext) {
export type APMOSSConfig = TypeOf<typeof config.schema>;

export { APMOSSPluginSetup } from './plugin';

export { apmIndexPattern };

export {
createNodeAgentInstructions,
createDjangoAgentInstructions,
createFlaskAgentInstructions,
createRailsAgentInstructions,
createRackAgentInstructions,
createJsAgentInstructions,
createGoAgentInstructions,
createJavaAgentInstructions,
createDotNetAgentInstructions,
} from './tutorial/instructions/apm_agent_instructions';
22 changes: 20 additions & 2 deletions src/plugins/apm_oss/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,35 @@
*/
import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/server';
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { APMOSSConfig } from './';
import { HomeServerPluginSetup, TutorialProvider } from '../../home/server';
import { tutorialProvider } from './tutorial';

export class APMOSSPlugin implements Plugin<APMOSSPluginSetup> {
constructor(private readonly initContext: PluginInitializerContext) {
this.initContext = initContext;
}

public setup(core: CoreSetup) {
public async setup(core: CoreSetup, plugins: { home: HomeServerPluginSetup }) {
const config$ = this.initContext.config.create<APMOSSConfig>();

const config = await config$.pipe(take(1)).toPromise();

const apmTutorialProvider = tutorialProvider({
indexPatternTitle: config.indexPattern,
indices: {
errorIndices: config.errorIndices,
metricsIndices: config.metricsIndices,
onboardingIndices: config.onboardingIndices,
sourcemapIndices: config.sourcemapIndices,
transactionIndices: config.transactionIndices,
},
});
plugins.home.tutorials.registerTutorial(apmTutorialProvider);

return {
config$,
getRegisteredTutorialProvider: () => apmTutorialProvider,
};
}

Expand All @@ -39,4 +56,5 @@ export class APMOSSPlugin implements Plugin<APMOSSPluginSetup> {

export interface APMOSSPluginSetup {
config$: Observable<APMOSSConfig>;
getRegisteredTutorialProvider(): TutorialProvider;
}
Loading