Skip to content

Commit

Permalink
feat(5787): Add depreciation condition for telemetry as addon
Browse files Browse the repository at this point in the history
  • Loading branch information
gansheer committed Sep 4, 2024
1 parent 50b8b04 commit cbaa59c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 2 additions & 0 deletions e2e/telemetry/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ func TestTelemetryAddon(t *testing.T) {
// Create integration and activate traces by telemetry trait
ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/int-rest-consumer-addon.yaml", "-n", ns))
g.Eventually(IntegrationPodPhase(t, ctx, ns, "rest-consumer-addon"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationCondition(t, ctx, ns, "rest-consumer-addon", "TelemetryTraitInfo"), TestTimeoutShort).Should(
WithTransform(IntegrationConditionMessage, ContainSubstring("Telemetry addon configuration is deprecated")))

name := "Alice"
serviceName := fmt.Sprintf("rest-consumer-addon.%s", ns)
Expand Down
23 changes: 19 additions & 4 deletions pkg/trait/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,22 @@ func (t *telemetryTrait) Configure(e *Environment) (bool, *TraitCondition, error
return false, nil, nil
}

if !ptr.Deref(t.Auto, true) {
return true, nil, nil
var condition *TraitCondition

// Deprecated
if _, isAddon := e.Integration.Spec.Traits.Addons["telemetry"]; isAddon {
condition = NewIntegrationCondition(
"Telemetry",
v1.IntegrationConditionTraitInfo,
corev1.ConditionTrue,
traitConfigurationReason,
"Telemetry addon configuration is deprecated and may be removed in future releases. Make sure to use Telemetry trait configuration instead.",
)
}

var condition *TraitCondition
if !ptr.Deref(t.Auto, true) {
return true, condition, nil
}

if t.Endpoint == "" {
for _, locator := range discovery.TelemetryLocators {
Expand All @@ -81,11 +92,15 @@ func (t *telemetryTrait) Configure(e *Environment) (bool, *TraitCondition, error
}
if endpoint != "" {
t.L.Infof("Using tracing endpoint: %s", endpoint)
conditionMessage := "TracingEndpoint"
if condition != nil {
conditionMessage = conditionMessage + ";" + condition.message
}
condition = NewIntegrationCondition(
"Telemetry",
v1.IntegrationConditionTraitInfo,
corev1.ConditionTrue,
"TracingEndpoint",
conditionMessage,
endpoint,
)
t.Endpoint = endpoint
Expand Down

0 comments on commit cbaa59c

Please sign in to comment.