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 3fdef36 commit 0df7f8d
Show file tree
Hide file tree
Showing 2 changed files with 20 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 is deprecated")))

name := "Alice"
serviceName := fmt.Sprintf("rest-consumer-addon.%s", ns)
Expand Down
22 changes: 18 additions & 4 deletions pkg/trait/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,21 @@ 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

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 +91,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 0df7f8d

Please sign in to comment.