Skip to content
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

Propagate trace context to helper pods #722

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: propagate trace context to helper pods
Signed-off-by: Suhyen Im <suhyenim.kor@gmail.com>
suhyenim committed Nov 13, 2024
commit 48cac2327749efd6350f1590ec14f5bacfc44fc0
14 changes: 7 additions & 7 deletions bin/helper/helper.go
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ func main() {

clients := cli.ClientSets{}

_, span := otel.Tracer(telemetry.TracerName).Start(ctx, "ExecuteExperimentHelper")
ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "ExecuteExperimentHelper")
defer span.End()

// parse the helper name
@@ -71,17 +71,17 @@ func main() {
// invoke the corresponding helper based on the the (-name) flag
switch *helperName {
case "container-kill":
containerKill.Helper(clients)
containerKill.Helper(ctx, clients)
case "disk-fill":
diskFill.Helper(clients)
diskFill.Helper(ctx, clients)
case "dns-chaos":
dnsChaos.Helper(clients)
dnsChaos.Helper(ctx, clients)
case "stress-chaos":
stressChaos.Helper(clients)
stressChaos.Helper(ctx, clients)
case "network-chaos":
networkChaos.Helper(clients)
networkChaos.Helper(ctx, clients)
case "http-chaos":
httpChaos.Helper(clients)
httpChaos.Helper(ctx, clients)

default:
log.Errorf("Unsupported -name %v, please provide the correct value of -name args", *helperName)
6 changes: 5 additions & 1 deletion chaoslib/litmus/container-kill/helper/container-kill.go
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ import (
"bytes"
"context"
"fmt"
"github.com/litmuschaos/litmus-go/pkg/telemetry"
"go.opentelemetry.io/otel"
"os/exec"
"strconv"
"time"
@@ -27,7 +29,9 @@ import (
var err error

// Helper injects the container-kill chaos
func Helper(clients clients.ClientSets) {
func Helper(ctx context.Context, clients clients.ClientSets) {
ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "SimulateContainerKillFault")
defer span.End()

experimentsDetails := experimentTypes.ExperimentDetails{}
eventsDetails := types.EventDetails{}
6 changes: 5 additions & 1 deletion chaoslib/litmus/disk-fill/helper/disk-fill.go
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@ import (
"context"
"fmt"
"github.com/litmuschaos/litmus-go/pkg/cerrors"
"github.com/litmuschaos/litmus-go/pkg/telemetry"
"github.com/palantir/stacktrace"
"go.opentelemetry.io/otel"
"os"
"os/exec"
"os/signal"
@@ -29,7 +31,9 @@ import (
var inject, abort chan os.Signal

// Helper injects the disk-fill chaos
func Helper(clients clients.ClientSets) {
func Helper(ctx context.Context, clients clients.ClientSets) {
ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "SimulateDiskFillFault")
defer span.End()

experimentsDetails := experimentTypes.ExperimentDetails{}
eventsDetails := types.EventDetails{}
7 changes: 6 additions & 1 deletion chaoslib/litmus/http-chaos/helper/http-helper.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package helper

import (
"context"
"fmt"
"github.com/litmuschaos/litmus-go/pkg/cerrors"
"github.com/litmuschaos/litmus-go/pkg/telemetry"
"github.com/palantir/stacktrace"
"go.opentelemetry.io/otel"
"os"
"os/signal"
"strconv"
@@ -27,7 +30,9 @@ var (
)

// Helper injects the http chaos
func Helper(clients clients.ClientSets) {
func Helper(ctx context.Context, clients clients.ClientSets) {
ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "SimulatePodHTTPFault")
defer span.End()

experimentsDetails := experimentTypes.ExperimentDetails{}
eventsDetails := types.EventDetails{}
7 changes: 6 additions & 1 deletion chaoslib/litmus/network-chaos/helper/netem.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package helper

import (
"context"
"fmt"
"github.com/litmuschaos/litmus-go/pkg/cerrors"
"github.com/litmuschaos/litmus-go/pkg/events"
"github.com/litmuschaos/litmus-go/pkg/telemetry"
"github.com/palantir/stacktrace"
"go.opentelemetry.io/otel"
"os"
"os/exec"
"os/signal"
@@ -34,7 +37,9 @@ var (
)

// Helper injects the network chaos
func Helper(clients clients.ClientSets) {
func Helper(ctx context.Context, clients clients.ClientSets) {
ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "SimulatePodNetworkFault")
defer span.End()

experimentsDetails := experimentTypes.ExperimentDetails{}
eventsDetails := types.EventDetails{}
7 changes: 6 additions & 1 deletion chaoslib/litmus/pod-dns-chaos/helper/dnschaos.go
Original file line number Diff line number Diff line change
@@ -2,9 +2,12 @@ package helper

import (
"bytes"
"context"
"fmt"
"github.com/litmuschaos/litmus-go/pkg/cerrors"
"github.com/litmuschaos/litmus-go/pkg/telemetry"
"github.com/palantir/stacktrace"
"go.opentelemetry.io/otel"
"os"
"os/exec"
"os/signal"
@@ -34,7 +37,9 @@ const (
)

// Helper injects the dns chaos
func Helper(clients clients.ClientSets) {
func Helper(ctx context.Context, clients clients.ClientSets) {
ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "SimulatePodDNSFault")
defer span.End()

experimentsDetails := experimentTypes.ExperimentDetails{}
eventsDetails := types.EventDetails{}
7 changes: 6 additions & 1 deletion chaoslib/litmus/stress-chaos/helper/stress-helper.go
Original file line number Diff line number Diff line change
@@ -3,9 +3,12 @@ package helper
import (
"bufio"
"bytes"
"context"
"fmt"
"github.com/litmuschaos/litmus-go/pkg/cerrors"
"github.com/litmuschaos/litmus-go/pkg/telemetry"
"github.com/palantir/stacktrace"
"go.opentelemetry.io/otel"
"io"
"os"
"os/exec"
@@ -51,7 +54,9 @@ const (
)

// Helper injects the stress chaos
func Helper(clients clients.ClientSets) {
func Helper(ctx context.Context, clients clients.ClientSets) {
ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "SimulatePodStressFault")
defer span.End()

experimentsDetails := experimentTypes.ExperimentDetails{}
eventsDetails := types.EventDetails{}
Loading