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

Telemetry correction #55

Merged
merged 6 commits into from
Apr 30, 2023
Merged

Telemetry correction #55

merged 6 commits into from
Apr 30, 2023

Conversation

rcohencyberarmor
Copy link
Contributor

Overview

Raziel Cohen added 2 commits April 23, 2023 18:02
Signed-off-by: Raziel Cohen <rcohen@armosec.io>
…r-time-scope

Signed-off-by: Raziel Cohen <rcohen@armosec.io>
@github-actions
Copy link

Summary:

  • License scan: success
  • Credentials scan: success
  • Vulnerabilities scan: success
  • Unit test: success
  • Go linting: success

@dwertent dwertent requested a review from matthyx April 23, 2023 16:38
Copy link
Contributor

@matthyx matthyx left a comment

Choose a reason for hiding this comment

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

I think we should spend some time together and I'll show you what we expect from telemetry, as it is not just error handling

}
}
}
logger.L().Ctx(ctx).Info("stop monitor on container - after monitoring time", helpers.String("container ID", contEvent.GetContainerID()), helpers.String("container name", contEvent.GetContainerName()), helpers.String("k8s resources", contEvent.GetK8SWorkloadID()), helpers.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't attach logs above Warning to spans, please remove .Ctx(ctx) from the line

@@ -160,10 +176,13 @@ func (ch *ContainerHandler) startRelevancyProcess(contEvent v1.ContainerEventDat
err = ch.startTimer(watchedContainer, contEvent.GetContainerID())
if err != nil {
if errors.Is(err, droppedEventsError) {
logger.L().Ctx(context.GetBackgroundContext()).Warning("container monitoring got drop events - we may miss some realtime data", helpers.String("container ID", contEvent.GetContainerID()), helpers.String("container name", contEvent.GetContainerName()), helpers.String("k8s resources", contEvent.GetK8SWorkloadID()), helpers.Error(err))
ctx, span := otel.Tracer("").Start(ctx, "dropped events.", trace.WithAttributes(attribute.String("containerID", contEvent.GetContainerID()), attribute.String("container workload", contEvent.GetK8SWorkloadID())))
Copy link
Contributor

Choose a reason for hiding this comment

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

don't create a span just for the error, they should be created when you enter a part of your code that you want to trace all the time (aka. record time spent there and compare with other spans)

Raziel Cohen added 3 commits April 24, 2023 18:21
Signed-off-by: Raziel Cohen <rcohen@armosec.io>
Signed-off-by: Raziel Cohen <rcohen@armosec.io>
@github-actions
Copy link

Summary:

  • License scan: success
  • Credentials scan: success
  • Vulnerabilities scan: success
  • Unit test: success
  • Go linting: failure

@matthyx
Copy link
Contributor

matthyx commented Apr 25, 2023

@rcohencyberarmor I corrected some things myself, PTAL

@github-actions
Copy link

Summary:

  • License scan: success
  • Credentials scan: success
  • Vulnerabilities scan: success
  • Unit test: success
  • Go linting: success

@@ -26,7 +26,7 @@ func (aggregator *Aggregator) collectDataFromContainerAccumulator(errChan chan e
for {
newEvent := <-aggregator.aggregationDataChan
if newEvent.GetEventCMD() == accumulator.DropEventOccurred {
// aggregator.StopAggregate()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed it by purpose, the management decided to continue listen on container when we got dropped events.

main.go Outdated
@@ -14,6 +14,9 @@ import (
)

func main() {
context.SetBackgroundContext()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it must be after the config parser, so we can get account ID etc..

Copy link
Contributor

Choose a reason for hiding this comment

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

ok then don't try to attach warnings to the ctx without span

Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
@github-actions
Copy link

Summary:

  • License scan: success
  • Credentials scan: success
  • Vulnerabilities scan: success
  • Unit test: success
  • Go linting: success

@@ -26,7 +26,7 @@ func (aggregator *Aggregator) collectDataFromContainerAccumulator(errChan chan e
for {
newEvent := <-aggregator.aggregationDataChan
if newEvent.GetEventCMD() == accumulator.DropEventOccurred {
aggregator.StopAggregate()
// aggregator.StopAggregate()
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you stop accumulating here?

@@ -117,11 +123,9 @@ func (ch *ContainerHandler) startTimer(watchedContainer watchedContainerData, co
}
case err = <-watchedContainer.syncChannel[StepEventAggregator]:
if err.Error() == accumulator.DropEventOccurred {
watchedContainer.snifferTicker.Stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

was it intended to be removed?

main.go Outdated
@@ -14,6 +14,9 @@ import (
)

func main() {
context.SetBackgroundContext()
Copy link
Contributor

Choose a reason for hiding this comment

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

ok then don't try to attach warnings to the ctx without span

@rcohencyberarmor rcohencyberarmor merged commit 9dd48dd into main Apr 30, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants