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

[Elastic Agent]-PR- Introduce log message for not supported annotations for Hints based autodiscover #4360

Merged
merged 56 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c60baaa
first commit with checks for hints vocabulary
gizas Mar 5, 2024
2148751
updating code to postition in correct place and to be triggered only …
gizas Mar 5, 2024
664ebea
fixing to retrieve only keys keys
gizas Mar 5, 2024
f44c16f
updating comment
gizas Mar 5, 2024
56d5015
adding changelog fragment
gizas Mar 5, 2024
ffa6e15
fixing linting issues
gizas Mar 5, 2024
b0fd369
moved checks in elastic-agent-autodicover
gizas Mar 6, 2024
ea314f9
correcting namespace and adding comment
gizas Mar 6, 2024
5da1316
Merge branch 'main' into logshints
gizas Mar 6, 2024
6536f3a
adding checks also to containers
gizas Mar 6, 2024
2aea421
udpating comment
gizas Mar 7, 2024
bae96be
fixing forloop error with value
gizas Mar 7, 2024
531b0b7
updating print message
gizas Mar 7, 2024
aa14e07
updating go.mod with v0.6.9 autodiscovery library
gizas Mar 13, 2024
6b06af5
Merge branch 'main' into logshints
gizas Mar 13, 2024
a1fdd05
updating Notice.txt
gizas Mar 13, 2024
3d52fcc
Merge branch 'logshints' of github.com:elastic/elastic-agent into log…
gizas Mar 13, 2024
6eb8655
removing module from supported list
gizas Mar 13, 2024
c52caec
removing module from supported list and added package
gizas Mar 13, 2024
35231be
removing module from supported list and added package
gizas Mar 13, 2024
651f91c
correcting changelog for v0.6.12
gizas Apr 15, 2024
a5af235
fixing conflicts with main
gizas Apr 15, 2024
902b6c3
fixing conflicts with main
gizas Apr 15, 2024
2432e89
fixing notice.txt
gizas Apr 15, 2024
4cc176d
fixing test
gizas Apr 16, 2024
6d7906d
fixing conflicts with main
gizas Apr 16, 2024
d09e8bc
removing default_container_logs from allSupportedHints list
gizas Apr 16, 2024
890103c
updating to elastic-agent-autodiscovery v.0.6.13
gizas Apr 22, 2024
74df714
Merge branch 'main' of github.com:elastic/elastic-agent into logshints
gizas Apr 22, 2024
4f3d1be
merging with main
gizas Apr 22, 2024
f6fcf2e
Merge branch 'main' into logshints
gizas Apr 22, 2024
85e7d49
adding test TestGenerateHints
gizas Apr 22, 2024
98b7954
adding test TestGenerateHints
gizas Apr 22, 2024
5a5e0f3
fixing conflicts
gizas Apr 23, 2024
5310024
removing lables from test
gizas Apr 23, 2024
ff1ecf9
Update internal/pkg/composable/providers/kubernetes/hints.go
gizas Apr 23, 2024
62d1b2d
removing container id and changed typo label
gizas Apr 23, 2024
97491c3
Merge branch 'logshints' of github.com:elastic/elastic-agent into log…
gizas Apr 23, 2024
258aa5f
fixing conflicts
gizas Apr 24, 2024
725440b
Merge branch 'main' into logshints
gizas Apr 24, 2024
aca7696
fixing conflicts with main
gizas Apr 25, 2024
a44c62a
removing bin folder
gizas Apr 25, 2024
77ea366
Merge branch 'main' of github.com:elastic/elastic-agent into logshints
gizas Apr 29, 2024
4fdf8e0
Merge branch 'main' into logshints
rdner Apr 29, 2024
a221dee
Merge branch 'main' into logshints
gizas Apr 30, 2024
88cb012
adding function to override sonarcube
gizas Apr 30, 2024
fe3548f
adding function to override sonarcube
gizas Apr 30, 2024
2512f64
Merge branch 'main' into logshints
gizas May 1, 2024
dfb1945
Merge branch 'main' into logshints
gizas May 2, 2024
0cb2591
Merge branch 'main' into logshints
gizas May 2, 2024
e8318ae
Merge branch 'main' into logshints
gizas May 2, 2024
c191f4b
Merge branch 'main' into logshints
cmacknz May 7, 2024
d32fe34
merging with main
gizas May 8, 2024
fd7dcfd
Merge branch 'logshints' of github.com:elastic/elastic-agent into log…
gizas May 8, 2024
e6c8118
merging with main
gizas May 9, 2024
49af807
Merge branch 'main' into logshints
gizas May 9, 2024
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
32 changes: 32 additions & 0 deletions changelog/fragments/1709656001-logshints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: enhancement

# Change summary; a 80ish characters long description of the change.
summary: Introduce log message for not supported annotations for Hints based autodiscover

# Long description; in case the summary is not enough to describe the change
# this field accommodate a description without length limits.
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
#description:

# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
component: elastic-agent

# PR URL; optional; the PR number that added the changeset.
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
# Please provide it if you are adding a fragment for a different PR.
pr: https://github.com/elastic/elastic-agent/pull/4360

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
issue: https://github.com/elastic/elastic-agent/issues/3064
4 changes: 3 additions & 1 deletion internal/pkg/composable/providers/kubernetes/hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const (
processors = "processors"
)

var allSupportedHints = []string{"enabled", integration, datastreams, host, period, timeout, metricspath, username, password, stream, processors}

type hintsBuilder struct {
Key string

Expand Down Expand Up @@ -288,7 +290,7 @@ func GetHintsMapping(k8sMapping map[string]interface{}, logger *logp.Logger, pre
}
}

hintsExtracted := utils.GenerateHints(annotations, cName, prefix)
hintsExtracted, _ := utils.GenerateHints(annotations, cName, prefix, allSupportedHints)
if len(hintsExtracted) == 0 {
return hintData
}
Expand Down
7 changes: 6 additions & 1 deletion internal/pkg/composable/providers/kubernetes/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ func (p *pod) emitRunning(pod *kubernetes.Pod) {
if !p.managed {
if ann, ok := data.mapping["annotations"]; ok {
annotations, _ := ann.(mapstr.M)
hints := utils.GenerateHints(annotations, "", p.config.Prefix)
//We check whether the provided annotation follows the supported format and vocabulary. The check happens for annotations that start with co.elastic.hints
hints, err := utils.GenerateHints(annotations, "", p.config.Prefix, allSupportedHints)
if err != nil {
p.logger.Warnf("%v for pod %v in namespace", err, pod.Name, pod.ObjectMeta.Namespace)
Copy link
Contributor Author

@gizas gizas Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment I set it as warning.
This kind of errors I think must be visible with default installation

But almost every 2sec we have a warning for one pod per wrong annotation. This can add noise
What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be added as a warning like you did, but having it every 2sec is quite annoying...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will have it every two seconds until they fix it. If the only reason to get this warning is a wrong hint annotation, this will force them to fix it.
I would leave it as a warning.

}

if len(hints) > 0 {
p.logger.Debugf("Extracted hints are :%v", hints)
hintsMapping := GenerateHintsMapping(hints, data.mapping, p.logger, "")
Expand Down
Loading