forked from elastic/beats
-
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.
Add monitoring information about functions to Functionbeat (elastic#1…
…4876) This PR adds a new counter which returns the number of triggered functions of Functionbeat. Example snippet of the telemetry message containing info about function: ```json { "state": { "functionbeat": { "functions": { "count": 1, } } } ``` Follow-up work is required on Kibana side to process the reported information correctly to get telemetry data. (cherry picked from commit 9ce1c26)
- Loading branch information
Showing
14 changed files
with
117 additions
and
37 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package telemetry | ||
|
||
import ( | ||
"github.com/elastic/beats/libbeat/monitoring" | ||
) | ||
|
||
// T is a telemetry instance | ||
type T interface { | ||
AddTriggeredFunction() | ||
} | ||
|
||
type telemetry struct { | ||
registry *monitoring.Registry | ||
countFunctions *monitoring.Int | ||
} | ||
|
||
// New returns a new telemetry registry. | ||
func New(r *monitoring.Registry) T { | ||
return &telemetry{ | ||
registry: r.NewRegistry("functions"), | ||
countFunctions: monitoring.NewInt(r, "count"), | ||
} | ||
} | ||
|
||
// Ignored is used when the package is not monitored. | ||
func Ignored() T { | ||
return nil | ||
} | ||
|
||
// AddTriggeredFunction adds a triggered function data to the registry. | ||
func (t *telemetry) AddTriggeredFunction() { | ||
t.countFunctions.Inc() | ||
} |
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.