@@ -3,6 +3,7 @@ package lib
3
3
import (
4
4
"context"
5
5
"fmt"
6
+ "os"
6
7
"strconv"
7
8
8
9
"github.com/litmuschaos/litmus-go/pkg/cerrors"
@@ -103,6 +104,35 @@ func createHelperPod(ctx context.Context, experimentsDetails *experimentTypes.Ex
103
104
104
105
const volumeName = "script-volume"
105
106
const mountPath = "/mnt"
107
+
108
+ var envs []corev1.EnvVar
109
+ args := []string {
110
+ mountPath + "/" + experimentsDetails .ScriptSecretKey ,
111
+ "-q" ,
112
+ "--duration" ,
113
+ strconv .Itoa (experimentsDetails .ChaosDuration ) + "s" ,
114
+ "--tag" ,
115
+ "trace_id=" + span .SpanContext ().TraceID ().String (),
116
+ }
117
+
118
+ if otelExporterEndpoint := os .Getenv (telemetry .OTELExporterOTLPEndpoint ); otelExporterEndpoint != "" {
119
+ envs = []corev1.EnvVar {
120
+ {
121
+ Name : "K6_OTEL_METRIC_PREFIX" ,
122
+ Value : "k6_" ,
123
+ },
124
+ {
125
+ Name : "K6_OTEL_GRPC_EXPORTER_INSECURE" ,
126
+ Value : "true" ,
127
+ },
128
+ {
129
+ Name : "K6_OTEL_GRPC_EXPORTER_ENDPOINT" ,
130
+ Value : otelExporterEndpoint ,
131
+ },
132
+ }
133
+ args = append (args , "--out" , "experimental-opentelemetry" )
134
+ }
135
+
106
136
helperPod := & corev1.Pod {
107
137
ObjectMeta : v1.ObjectMeta {
108
138
GenerateName : experimentsDetails .ExperimentName + "-helper-" ,
@@ -122,12 +152,8 @@ func createHelperPod(ctx context.Context, experimentsDetails *experimentTypes.Ex
122
152
"k6" ,
123
153
"run" ,
124
154
},
125
- Args : []string {
126
- mountPath + "/" + experimentsDetails .ScriptSecretKey ,
127
- "-q" ,
128
- "--duration" ,
129
- strconv .Itoa (experimentsDetails .ChaosDuration ) + "s" ,
130
- },
155
+ Args : args ,
156
+ Env : envs ,
131
157
Resources : chaosDetails .Resources ,
132
158
VolumeMounts : []corev1.VolumeMount {
133
159
{
0 commit comments