Skip to content

Commit

Permalink
merging with main
Browse files Browse the repository at this point in the history
  • Loading branch information
gizas committed Mar 14, 2024
2 parents d83ee12 + 7490558 commit 4c20caf
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/add-issues-to-ingest-board.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ env:
AREA_FIELD_ID: 'PVTSSF_lADOAGc3Zs4AEzn4zgEgZSo'
ELASTIC_AGENT_OPTION_ID: 'c1e1a30a'

permissions:
contents: read

jobs:
add_to_ingest_project:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.21.5
1.21.8
8 changes: 4 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ linters-settings:

gosimple:
# Select the Go version to target. The default is '1.13'.
go: "1.21.5"
go: "1.21.8"

nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
Expand Down Expand Up @@ -121,15 +121,15 @@ linters-settings:

staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.21.5"
go: "1.21.8"

stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.21.5"
go: "1.21.8"

unused:
# Select the Go version to target. The default is '1.13'.
go: "1.21.5"
go: "1.21.8"

gosec:
excludes:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Enhance GenerateHints function to check supported list of hints for multiple datastreams and metricsets


[0.6.10]: https://github.com/elastic/elastic-agent-autodiscover/compare/v0.6.8...v0.6.9
[0.6.10]: https://github.com/elastic/elastic-agent-autodiscover/compare/v0.6.8...v0.6.9
8 changes: 8 additions & 0 deletions kubernetes/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type Watcher interface {
// AddEventHandler add event handlers for corresponding event type watched
AddEventHandler(ResourceEventHandler)

// GetEventHandler returns the event handlers for corresponding event type watched
GetEventHandler() ResourceEventHandler

// Store returns the store object for the watcher
Store() cache.Store

Expand Down Expand Up @@ -181,6 +184,11 @@ func (w *watcher) AddEventHandler(h ResourceEventHandler) {
w.handler = h
}

// GetEventHandler returns the watcher's event handler
func (w *watcher) GetEventHandler() ResourceEventHandler {
return w.handler
}

// Store returns the store object for the resource that is being watched
func (w *watcher) Store() cache.Store {
return w.store
Expand Down
1 change: 1 addition & 0 deletions utils/hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func GenerateHints(annotations mapstr.M, container, prefix string, allSupportedH
datastreamlist := GetHintAsList(entries, logName+"/"+"data_streams", "")
metricsetlist := GetHintAsList(entries, "metrics"+"/"+"metricsets", "")
for key, rawValue := range entries {

// If there are top level hints like co.elastic.logs/ then just add the values after the /
// Only consider namespaced annotations
parts := strings.Split(key, "/")
Expand Down
5 changes: 4 additions & 1 deletion utils/hints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ func TestGetProcessors(t *testing.T) {

func TestGenerateHints(t *testing.T) {

<<<<<<< HEAD

Check failure on line 54 in utils/hints_test.go

View workflow job for this annotation

GitHub Actions / lint

expected statement, found '<<' (typecheck)
var allSupportedHints = []string{"enabled", "package", "module", "integration", "data_streams", "metricsets", "host", "period", "timeout", "metrics_path", "username", "password", "stream", "processors", "multiline", "json", "disable"}
=======

Check failure on line 56 in utils/hints_test.go

View workflow job for this annotation

GitHub Actions / lint

expected statement, found '==' (typecheck)
var allSupportedHints = []string{"enabled", "module", "integration", "datas_treams", "host", "period", "timeout", "metrics_path", "username", "password", "stream", "processors", "multiline", "json", "disable"}
>>>>>>> 7490558445cb8d3248462255edc8ac64bc18b8eb

Check failure on line 58 in utils/hints_test.go

View workflow job for this annotation

GitHub Actions / lint

expected statement, found '>>' (typecheck)

tests := []struct {
name string
Expand Down Expand Up @@ -285,7 +289,6 @@ func TestGenerateHints(t *testing.T) {
}

generateHints, incorrectHints := GenerateHints(annMap, "foobar", "co.elastic", allSupportedHints)
t.Log(incorrectHints)
assert.Equal(t, test.expectedIncorrectHints, len(incorrectHints)) // We validate how many incorrect hints are provided per test case.
assert.Equal(t, test.result, generateHints)
}
Expand Down

0 comments on commit 4c20caf

Please sign in to comment.