Skip to content

Commit

Permalink
add new detector to processor factory
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Oct 2, 2024
1 parent 99279e0 commit 8266af8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ processor/resourcedetectionprocessor/internal/docker/ @open-teleme
processor/resourcedetectionprocessor/internal/gcp/ @open-telemetry/collector-contrib-approvers
processor/resourcedetectionprocessor/internal/heroku/ @open-telemetry/collector-contrib-approvers @atoulme
processor/resourcedetectionprocessor/internal/k8snode/ @open-telemetry/collector-contrib-approvers
processor/resourcedetectionprocessor/internal/kubeadm/ @open-telemetry/collector-contrib-approvers
processor/resourcedetectionprocessor/internal/openshift/ @open-telemetry/collector-contrib-approvers @frzifus
processor/resourcedetectionprocessor/internal/system/ @open-telemetry/collector-contrib-approvers
processor/resourceprocessor/ @open-telemetry/collector-contrib-approvers @dmitryax
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ body:
- processor/resourcedetection/internal/gcp
- processor/resourcedetection/internal/heroku
- processor/resourcedetection/internal/k8snode
- processor/resourcedetection/internal/kubeadm
- processor/resourcedetection/internal/openshift
- processor/resourcedetection/internal/system
- processor/routing
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ body:
- processor/resourcedetection/internal/gcp
- processor/resourcedetection/internal/heroku
- processor/resourcedetection/internal/k8snode
- processor/resourcedetection/internal/kubeadm
- processor/resourcedetection/internal/openshift
- processor/resourcedetection/internal/system
- processor/routing
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ body:
- processor/resourcedetection/internal/gcp
- processor/resourcedetection/internal/heroku
- processor/resourcedetection/internal/k8snode
- processor/resourcedetection/internal/kubeadm
- processor/resourcedetection/internal/openshift
- processor/resourcedetection/internal/system
- processor/routing
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/unmaintained.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ body:
- processor/resourcedetection/internal/gcp
- processor/resourcedetection/internal/heroku
- processor/resourcedetection/internal/k8snode
- processor/resourcedetection/internal/kubeadm
- processor/resourcedetection/internal/openshift
- processor/resourcedetection/internal/system
- processor/routing
Expand Down
7 changes: 7 additions & 0 deletions processor/resourcedetectionprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/gcp"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/heroku"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/k8snode"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/kubeadm"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/openshift"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/system"
)
Expand Down Expand Up @@ -86,6 +87,9 @@ type DetectorConfig struct {

// K8SNode contains user-specified configurations for the K8SNode detector
K8SNodeConfig k8snode.Config `mapstructure:"k8snode"`

// Kubeadm contains user-specified configurations for the Kubeadm detector
KubeadmConfig kubeadm.Config `mapstructure:"kubeadm"`
}

func detectorCreateDefaultConfig() DetectorConfig {
Expand All @@ -104,6 +108,7 @@ func detectorCreateDefaultConfig() DetectorConfig {
SystemConfig: system.CreateDefaultConfig(),
OpenShiftConfig: openshift.CreateDefaultConfig(),
K8SNodeConfig: k8snode.CreateDefaultConfig(),
KubeadmConfig: kubeadm.CreateDefaultConfig(),
}
}

Expand Down Expand Up @@ -137,6 +142,8 @@ func (d *DetectorConfig) GetConfigFromType(detectorType internal.DetectorType) i
return d.OpenShiftConfig
case k8snode.TypeStr:
return d.K8SNodeConfig
case kubeadm.TypeStr:
return d.KubeadmConfig
default:
return nil
}
Expand Down
1 change: 1 addition & 0 deletions processor/resourcedetectionprocessor/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//go:generate mdatagen internal/openshift/metadata.yaml
//go:generate mdatagen internal/system/metadata.yaml
//go:generate mdatagen internal/k8snode/metadata.yaml
//go:generate mdatagen internal/kubeadm/metadata.yaml

// package resourcedetectionprocessor implements a processor
// which can be used to detect resource information from the host,
Expand Down
2 changes: 2 additions & 0 deletions processor/resourcedetectionprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/gcp"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/heroku"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/k8snode"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/kubeadm"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/openshift"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/system"
Expand Down Expand Up @@ -63,6 +64,7 @@ func NewFactory() processor.Factory {
system.TypeStr: system.NewDetector,
openshift.TypeStr: openshift.NewDetector,
k8snode.TypeStr: k8snode.NewDetector,
kubeadm.TypeStr: kubeadm.NewDetector,
})

f := &factory{
Expand Down

0 comments on commit 8266af8

Please sign in to comment.