-
Notifications
You must be signed in to change notification settings - Fork 18
feat(otel): OpenTelemetry traces, logs, drop counters, and OTEL metrics (Phase 1 + 2) #818
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
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
dba2830
feat(otel): add OpenTelemetry traces, logs, and drop counters (Phase 1)
matthyx 572df5f
fix(otel): per-signal exporter gating and atomic dedup
matthyx 3bbf498
fix(otel): address CodeRabbit review comments
matthyx 9d7c130
fix(otel): add ClusterName and ServiceVersion to OTEL resource
matthyx 6cd5ae9
fix(otel): resolve schema URL conflict in resource.Merge
matthyx 9081ebb
fix(otel): use insecure gRPC transport for non-HTTPS endpoints
matthyx 6aed5fb
feat(otel): Phase 1 — lifecycle spans, CP traceparent, M2 throttle, r…
matthyx 8e3cf41
feat(otel): Step 5 — Tier 1/2 .Ctx() on alert delivery, rule eval, Cl…
matthyx b41f213
fix(otel): mark slow-eval spans as error on CEL failure; add OTEL log…
matthyx 5b936af
feat(metrics): Phase 2 — replace Prometheus impl with OTEL SDK
matthyx c2be3d3
fix(otel): flush on shutdown, mark profiles dropped, gate OTEL log on…
matthyx 8d9ea6f
fix(otel): address CodeRabbit review comments
matthyx e1fc1e6
fix(metrics): always enable OTEL metrics manager per design spec
matthyx 5d18c56
feat(otel): correlate alert logs to traces via rule.alert / malware.a…
matthyx 95df910
feat(metrics): thread span ctx through ReportRuleEvaluationTime for O…
matthyx dedf290
feat(sbom): migrate SBOM metrics to MetricsManager and add gRPC tracing
matthyx 579ef55
feat(sbom-scanner): instrument sidecar with OTEL traces
matthyx 6bd5b6a
feat(sbom-scanner): add Go runtime metrics and per-scan heap delta
matthyx 14f55cb
feat: add alert.suppressed.total counter for suppression funnel obser…
matthyx 7ec156a
fix: exclude Health RPC from otelgrpc tracing to stay within span budget
matthyx c477e36
fix: gate sidecar go runtime metrics on OTEL_EXPORTER_OTLP_ENDPOINT
matthyx 2fb4a4a
perf: cache attribute sets for alert.suppressed counter
matthyx 861db0c
fix(sbom-scanner): credentials from /etc/credentials + soft-fail Prom…
matthyx cd00ceb
chore: bump go-logger to v0.0.30
matthyx 776394e
fix(otelsetup): bind Prometheus port before setting global MeterProvider
matthyx 7beaf37
fix(sbommanager): substitute MetricsNoop when nil metrics passed to C…
matthyx 7ef0455
fix(sbomscanner): use TotalAlloc for scan heap delta to avoid negativ…
matthyx 52e2500
chore: bump go-logger to v0.0.31
matthyx 47dcb06
docs: remove ARMO_OTEL_AUTH, update auth header description to creden…
matthyx ec3002a
docs: debug listener activates via KS_LOGGER_LEVEL=debug, remove ENAB…
matthyx dda23a9
chore: bump go-logger to v0.0.32
matthyx fea6131
fix: address remaining PR review comments
matthyx e6167d6
feat(metrics): add resource gauges and wire goruntime.Start in main a…
matthyx 7cacef7
feat(otel): close span↔log correlation gaps via shared context plumbing
matthyx be6435a
test(otel): prove span↔log correlation wiring via logtest.Recorder
matthyx 30d86eb
fix(nodeprofile): guard HTTP client timeout default against unset config
matthyx 05aec48
fix(metrics): resolve own cgroup for memory.current, add limit gauge
matthyx 854069e
fix(metrics): resolve own cgroup via authoritative container ID
matthyx 2e2ff3b
feat(metrics): emit process memory gauges from the sbom-scanner too
matthyx 12aff41
fix(otel): only overwrite env credentials with non-empty values from …
matthyx 9e56c73
refactor(sbom): extract sbom-scanner main logic into reusable RunServ…
matthyx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,48 +1,30 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "net" | ||
| "context" | ||
| "os" | ||
| "os/signal" | ||
| "syscall" | ||
|
|
||
| "github.com/kubescape/go-logger" | ||
| "github.com/kubescape/go-logger/helpers" | ||
| beUtils "github.com/kubescape/backend/pkg/utils" | ||
| sbomscanner "github.com/kubescape/node-agent/pkg/sbomscanner/v1" | ||
| pb "github.com/kubescape/node-agent/pkg/sbomscanner/v1/proto" | ||
| "google.golang.org/grpc" | ||
| _ "modernc.org/sqlite" | ||
| ) | ||
|
|
||
| func main() { | ||
| socketPath := os.Getenv("SOCKET_PATH") | ||
| if socketPath == "" { | ||
| socketPath = "/sbom-comm/scanner.sock" | ||
| ctx := context.Background() | ||
|
|
||
| // Load ARMO credentials from /etc/credentials (same source as the main agent). | ||
| // Fall back to env vars so the binary stays functional in non-ARMO deployments. | ||
| accountID := os.Getenv("ACCOUNT_ID") | ||
| accessKey := os.Getenv("ACCESS_KEY") | ||
| if creds, err := beUtils.LoadCredentialsFromFile("/etc/credentials"); err == nil { | ||
| if creds.Account != "" { | ||
| accountID = creds.Account | ||
| } | ||
| if creds.AccessKey != "" { | ||
| accessKey = creds.AccessKey | ||
| } | ||
| } | ||
|
|
||
| // Remove stale socket file from a previous run | ||
| os.Remove(socketPath) | ||
|
|
||
| lis, err := net.Listen("unix", socketPath) | ||
| if err != nil { | ||
| logger.L().Fatal("failed to listen on socket", helpers.Error(err), helpers.String("path", socketPath)) | ||
| } | ||
|
|
||
| srv := grpc.NewServer() | ||
| pb.RegisterSBOMScannerServer(srv, sbomscanner.NewScannerServer()) | ||
|
|
||
| sigCh := make(chan os.Signal, 1) | ||
| signal.Notify(sigCh, syscall.SIGTERM, syscall.SIGINT) | ||
|
|
||
| go func() { | ||
| sig := <-sigCh | ||
| logger.L().Info("received signal, shutting down", helpers.String("signal", sig.String())) | ||
| srv.GracefulStop() | ||
| os.Remove(socketPath) | ||
| }() | ||
|
|
||
| logger.L().Info("SBOM scanner sidecar started", helpers.String("socket", socketPath)) | ||
| if err := srv.Serve(lis); err != nil { | ||
| logger.L().Fatal("gRPC server failed", helpers.Error(err)) | ||
| } | ||
| // Run the reusable SBOM scanner server | ||
| sbomscanner.RunServer(ctx, accountID, accessKey) | ||
| } |
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.