forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Asset Manager] implicit collection telemetry (elastic#157474)
## Summary Closes elastic#157377 Records performances of implicit collection queries using apm transactions ### Testing - configure implicit collection in kibana settings ``` xpack.assetManager: implicitCollection: enabled: true interval: 30s # elasticsearch cluster we should extract signals from input: hosts: http://input:9200 username: ... password: ... # elasticsearch cluster we should write assets to output: hosts: http://output:9200 username: ... password: ... ``` - (for elastic maintainers) start kibana with `ELASTIC_APM_ACTIVE=true yarn start` - look for `transaction.type : "asset_manager-implicit_collection"` in dev cluster --------- Co-authored-by: Jason Rhodes <[email protected]>
- Loading branch information
1 parent
0b23894
commit 45079fb
Showing
7 changed files
with
183 additions
and
118 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
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/asset_manager/server/lib/implicit_collection/collectors/helpers.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,22 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { Transaction } from 'elastic-apm-node'; | ||
|
||
type CollectorSpan = 'processing_response'; | ||
|
||
interface SpanOptions { | ||
name: CollectorSpan; | ||
transaction: Transaction | null; | ||
} | ||
|
||
export function withSpan<T>(options: SpanOptions, fn: () => T) { | ||
const span = options.transaction?.startSpan(options.name); | ||
const result = fn(); | ||
span?.end(); | ||
return result; | ||
} |
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
Oops, something went wrong.