-
Notifications
You must be signed in to change notification settings - Fork 1
feature: #146 add database discovery receiver #145
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
base: main
Are you sure you want to change the base?
Conversation
unit test unit test unit test additional changes
Dependency ReviewThe following issues were found:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The basic logic is that in regular intervals, we ask the k8s API for all Pods and Services in a k8s cluster, parse them and look for interesting ones. Then, for the ones that match some discovery rule, we ask the k8s API for their owner workloads.
Have you considered subscribing for these k8s objects instead of regularly querying them? That API also allows for fetching the cached objects by their namespace or labels. Or do you think it would actually be less effective that way?
} | ||
|
||
// listPods lists all pods across all namespaces using the typed client. | ||
func (c *Config) listPods(ctx context.Context, client k8s.Interface) ([]corev1.Pod, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are listPods
and listServices
in this file and bound to *Config
instead of being in in receiver.go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just as Client is a part of config, so I placed it here.
lower_name := strings.ToLower(svc.Name) | ||
|
||
for _, rule := range matchingRules { | ||
if strings.Contains(lower_external, rule.DatabaseType) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should rule.DatabaseType
always be lowercase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made that as part of Validation
svcPorts = append(svcPorts, p.Port) | ||
} | ||
|
||
// service with external endpoint can be detected by other discoveries we mark discovery.id as `external` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is discovery.id
used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's for deduplication - database running inside cluster will be discovered probably only by our agent, so discovery.id is clusterUid, but database which are running outside, can be detected by someone else and we need to match them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds a new database discovery receiver (swok8sdiscovery
) to the SolarWinds OTel Collector. The receiver performs periodic discovery of databases running in Kubernetes clusters and emits entity events describing discovered database instances and their relationships to Kubernetes workloads.
Key changes:
- Implements image-based and domain-based database discovery strategies
- Emits OpenTelemetry log records for database entities and their relationships
- Includes comprehensive test coverage and documentation
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
receiver/swok8sdiscovery/ | New receiver package with complete implementation including factory, configuration, discovery logic, and tests |
CHANGELOG.md | Updated to document the new receiver feature |
.gitattributes | Added to normalize line endings across the codebase |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
In SWO we would like to detect databases running inside cluster and create relations between DiscoveredDatabaseInstance enetity and workload if applicable.
Testing
Add receiver configuration with at least one rule.