-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
542 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/server_integration/__fixtures__/plugins/analytics_plugin_a/kibana.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "analyticsPluginA", | ||
"owner": { "name": "Core", "githubTeam": "kibana-core" }, | ||
"version": "0.0.1", | ||
"kibanaVersion": "kibana", | ||
"server": true, | ||
"ui": false | ||
} |
14 changes: 14 additions & 0 deletions
14
test/server_integration/__fixtures__/plugins/analytics_plugin_a/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "analytics_plugin_a", | ||
"version": "1.0.0", | ||
"main": "target/test/server_integration/__fixtures__/plugins/analytics_plugin_a", | ||
"kibana": { | ||
"version": "kibana", | ||
"templateVersion": "1.0.0" | ||
}, | ||
"license": "SSPL-1.0 OR Elastic License 2.0", | ||
"scripts": { | ||
"kbn": "node ../../../../../../scripts/kbn.js", | ||
"build": "rm -rf './target' && ../../../../../../node_modules/.bin/tsc" | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
test/server_integration/__fixtures__/plugins/analytics_plugin_a/server/custom_shipper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { Subject } from 'rxjs'; | ||
import type { IShipper, Event, EventContext, TelemetryCounter } from 'src/core/server'; | ||
|
||
export interface Action { | ||
action: string; | ||
meta: any; | ||
} | ||
|
||
export class CustomShipper implements IShipper { | ||
public static shipperName = 'FTR-shipper'; | ||
|
||
public telemetryCounter$ = new Subject<TelemetryCounter>(); | ||
|
||
constructor(private readonly actions$: Subject<Action>) {} | ||
|
||
public reportEvents(events: Event[]) { | ||
this.actions$.next({ action: 'reportEvents', meta: events }); | ||
events.forEach((event) => { | ||
this.telemetryCounter$.next({ | ||
type: 'succeed', | ||
event_type: event.event_type, | ||
code: '200', | ||
count: 1, | ||
source: 'random_value', | ||
}); | ||
}); | ||
} | ||
optIn(isOptedIn: boolean) { | ||
this.actions$.next({ action: 'optIn', meta: isOptedIn }); | ||
} | ||
extendContext(newContext: EventContext) { | ||
this.actions$.next({ action: 'extendContext', meta: newContext }); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
test/server_integration/__fixtures__/plugins/analytics_plugin_a/server/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { AnalyticsPluginAPlugin } from './plugin'; | ||
|
||
export const plugin = () => new AnalyticsPluginAPlugin(); |
Oops, something went wrong.