Skip to content

Commit

Permalink
Mark the instrumentation labels as deprecated (#2358)
Browse files Browse the repository at this point in the history
Co-authored-by: Amir Blum <[email protected]>
  • Loading branch information
RonFed and blumamir authored Feb 2, 2025
1 parent 9098447 commit 1707716
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions common/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ const (
OTLPPort = 4317
OTLPHttpPort = 4318
PprofOdigosPort = 6060
OdigosInstrumentationLabel = "odigos-instrumentation"
InstrumentationEnabled = "enabled"
InstrumentationDisabled = "disabled"

// Deprecated: Sources are used to mark workloads for instrumentation.
OdigosInstrumentationLabel = "odigos-instrumentation"

// Deprecated: Sources are used to mark workloads for instrumentation.
InstrumentationEnabled = "enabled"

// Deprecated: Sources are used to mark workloads for instrumentation.
InstrumentationDisabled = "disabled"

// Deprecated: reported name is set via the Source CR.
OdigosReportedNameAnnotation = "odigos.io/reported-name"
Expand Down
1 change: 1 addition & 0 deletions k8sutils/pkg/describe/source/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type SourceAnalyze struct {
Pods []PodAnalyze `json:"pods"`
}

// Deprecated: Sources are used to mark workloads for instrumentation.
func analyzeInstrumentationLabels(resource *OdigosSourceResources, workloadObj *K8sSourceObject) (InstrumentationLabelsAnalyze, bool) {
workloadLabel, workloadFound := workloadObj.GetLabels()[consts.OdigosInstrumentationLabel]
nsLabel, nsFound := resource.Namespace.GetLabels()[consts.OdigosInstrumentationLabel]
Expand Down
3 changes: 3 additions & 0 deletions k8sutils/pkg/workload/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func ObjectToWorkload(obj client.Object) (Workload, error) {
}
}

// Deprecated: this should only be used for backward compatibility migration.
func IsObjectLabeledForInstrumentation(obj client.Object) bool {
labels := obj.GetLabels()
if labels == nil {
Expand All @@ -74,6 +75,7 @@ func IsObjectLabeledForInstrumentation(obj client.Object) bool {
return val == consts.InstrumentationEnabled
}

// Deprecated: this should only be used for backward compatibility migration.
func IsWorkloadInstrumentationEffectiveEnabled(ctx context.Context, kubeClient client.Client, obj client.Object) (bool, error) {
// if the object itself is labeled, we will use that value
workloadLabels := obj.GetLabels()
Expand All @@ -98,6 +100,7 @@ func IsWorkloadInstrumentationEffectiveEnabled(ctx context.Context, kubeClient c
return IsObjectLabeledForInstrumentation(&ns), nil
}

// Deprecated: this should only be used for backward compatibility migration.
func IsInstrumentationDisabledExplicitly(obj client.Object) bool {
labels := obj.GetLabels()
if labels != nil {
Expand Down

0 comments on commit 1707716

Please sign in to comment.