Skip to content

Commit c6ce177

Browse files
committed
Rename otel-python-wheel-kind to otel-python-platform
1 parent 660656d commit c6ce177

File tree

7 files changed

+29
-30
lines changed

7 files changed

+29
-30
lines changed

pkg/instrumentation/annotation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const (
3030
annotationInjectNodeJSContainersName = "instrumentation.opentelemetry.io/nodejs-container-names"
3131
annotationInjectPython = "instrumentation.opentelemetry.io/inject-python"
3232
annotationInjectPythonContainersName = "instrumentation.opentelemetry.io/python-container-names"
33-
annotationPythonWheelKind = "instrumentation.opentelemetry.io/otel-python-wheel-kind"
33+
annotationPythonPlatform = "instrumentation.opentelemetry.io/otel-python-platform"
3434
annotationInjectDotNet = "instrumentation.opentelemetry.io/inject-dotnet"
3535
annotationDotNetRuntime = "instrumentation.opentelemetry.io/otel-dotnet-auto-runtime"
3636
annotationInjectDotnetContainersName = "instrumentation.opentelemetry.io/dotnet-container-names"

pkg/instrumentation/podmutator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (pm *instPodMutator) Mutate(ctx context.Context, ns corev1.Namespace, pod c
321321
}
322322
if pm.config.EnablePythonAutoInstrumentation() || inst == nil {
323323
insts.Python.Instrumentation = inst
324-
insts.Python.AdditionalAnnotations = map[string]string{annotationPythonWheelKind: annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationPythonWheelKind)}
324+
insts.Python.AdditionalAnnotations = map[string]string{annotationPythonPlatform: annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationPythonPlatform)}
325325
} else {
326326
logger.Error(nil, "support for Python auto instrumentation is not enabled")
327327
pm.Recorder.Event(pod.DeepCopy(), "Warning", "InstrumentationRequestRejected", "support for Python auto instrumentation is not enabled")

pkg/instrumentation/python.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ const (
2727
envOtelTracesExporter = "OTEL_TRACES_EXPORTER"
2828
envOtelMetricsExporter = "OTEL_METRICS_EXPORTER"
2929
envOtelExporterOTLPProtocol = "OTEL_EXPORTER_OTLP_PROTOCOL"
30-
manyLinuxAutoInstrumentationSrc = "/autoinstrumentation/."
30+
glibcLinuxAutoInstrumentationSrc = "/autoinstrumentation/."
3131
muslLinuxAutoInstrumentationSrc = "/autoinstrumentation-musl/."
3232
pythonPathPrefix = "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation"
3333
pythonPathSuffix = "/otel-auto-instrumentation-python"
3434
pythonInstrMountPath = "/otel-auto-instrumentation-python"
3535
pythonVolumeName = volumeName + "-python"
3636
pythonInitContainerName = initContainerName + "-python"
37-
wheelKindManyLinux = "manylinux"
38-
wheelKindMuslLinux = "musllinux"
37+
glibcLinux = "glibc"
38+
muslLinux = "musl"
3939
)
4040

41-
func injectPythonSDK(pythonSpec v1alpha1.Python, pod corev1.Pod, index int, wheelKind string) (corev1.Pod, error) {
41+
func injectPythonSDK(pythonSpec v1alpha1.Python, pod corev1.Pod, index int, platform string) (corev1.Pod, error) {
4242
// caller checks if there is at least one container.
4343
container := &pod.Spec.Containers[index]
4444

@@ -48,13 +48,13 @@ func injectPythonSDK(pythonSpec v1alpha1.Python, pod corev1.Pod, index int, whee
4848
}
4949

5050
autoInstrumentationSrc := ""
51-
switch wheelKind {
52-
case "", wheelKindManyLinux:
53-
autoInstrumentationSrc = manyLinuxAutoInstrumentationSrc
54-
case wheelKindMuslLinux:
51+
switch platform {
52+
case "", glibcLinux:
53+
autoInstrumentationSrc = glibcLinuxAutoInstrumentationSrc
54+
case muslLinux:
5555
autoInstrumentationSrc = muslLinuxAutoInstrumentationSrc
5656
default:
57-
return pod, fmt.Errorf("provided instrumentation.opentelemetry.io/otel-python-wheel-kind annotation value '%s' is not supported", wheelKind)
57+
return pod, fmt.Errorf("provided instrumentation.opentelemetry.io/otel-python-platform annotation value '%s' is not supported", platform)
5858
}
5959

6060
// inject Python instrumentation spec env vars.

pkg/instrumentation/python_test.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestInjectPythonSDK(t *testing.T) {
2929
name string
3030
v1alpha1.Python
3131
pod corev1.Pod
32-
wheelKind string
32+
platform string
3333
expected corev1.Pod
3434
err error
3535
}{
@@ -43,7 +43,7 @@ func TestInjectPythonSDK(t *testing.T) {
4343
},
4444
},
4545
},
46-
wheelKind: "manylinux",
46+
platform: "glibc",
4747
expected: corev1.Pod{
4848
Spec: corev1.PodSpec{
4949
Volumes: []corev1.Volume{
@@ -116,7 +116,7 @@ func TestInjectPythonSDK(t *testing.T) {
116116
},
117117
},
118118
},
119-
wheelKind: "manylinux",
119+
platform: "glibc",
120120
expected: corev1.Pod{
121121
Spec: corev1.PodSpec{
122122
Volumes: []corev1.Volume{
@@ -190,7 +190,7 @@ func TestInjectPythonSDK(t *testing.T) {
190190
},
191191
},
192192
},
193-
wheelKind: "manylinux",
193+
platform: "glibc",
194194
expected: corev1.Pod{
195195
Spec: corev1.PodSpec{
196196
Volumes: []corev1.Volume{
@@ -263,7 +263,7 @@ func TestInjectPythonSDK(t *testing.T) {
263263
},
264264
},
265265
},
266-
wheelKind: "manylinux",
266+
platform: "glibc",
267267
expected: corev1.Pod{
268268
Spec: corev1.PodSpec{
269269
Volumes: []corev1.Volume{
@@ -336,7 +336,7 @@ func TestInjectPythonSDK(t *testing.T) {
336336
},
337337
},
338338
},
339-
wheelKind: "manylinux",
339+
platform: "glibc",
340340
expected: corev1.Pod{
341341
Spec: corev1.PodSpec{
342342
Volumes: []corev1.Volume{
@@ -409,7 +409,7 @@ func TestInjectPythonSDK(t *testing.T) {
409409
},
410410
},
411411
},
412-
wheelKind: "manylinux",
412+
platform: "glibc",
413413
expected: corev1.Pod{
414414
Spec: corev1.PodSpec{
415415
Containers: []corev1.Container{
@@ -427,7 +427,7 @@ func TestInjectPythonSDK(t *testing.T) {
427427
err: fmt.Errorf("the container defines env var value via ValueFrom, envVar: %s", envPythonPath),
428428
},
429429
{
430-
name: "musllinux wheelKind defined",
430+
name: "musl platform defined",
431431
Python: v1alpha1.Python{Image: "foo/bar:1"},
432432
pod: corev1.Pod{
433433
Spec: corev1.PodSpec{
@@ -436,7 +436,7 @@ func TestInjectPythonSDK(t *testing.T) {
436436
},
437437
},
438438
},
439-
wheelKind: "musllinux",
439+
platform: "musl",
440440
expected: corev1.Pod{
441441
Spec: corev1.PodSpec{
442442
Volumes: []corev1.Volume{
@@ -493,7 +493,7 @@ func TestInjectPythonSDK(t *testing.T) {
493493
err: nil,
494494
},
495495
{
496-
name: "wheelKind not defined",
496+
name: "platform not defined",
497497
Python: v1alpha1.Python{Image: "foo/bar:1"},
498498
pod: corev1.Pod{
499499
Spec: corev1.PodSpec{
@@ -502,7 +502,7 @@ func TestInjectPythonSDK(t *testing.T) {
502502
},
503503
},
504504
},
505-
wheelKind: "",
505+
platform: "",
506506
expected: corev1.Pod{
507507
Spec: corev1.PodSpec{
508508
Volumes: []corev1.Volume{
@@ -559,7 +559,7 @@ func TestInjectPythonSDK(t *testing.T) {
559559
err: nil,
560560
},
561561
{
562-
name: "wheelKind not supported",
562+
name: "platform not supported",
563563
Python: v1alpha1.Python{Image: "foo/bar:1"},
564564
pod: corev1.Pod{
565565
Spec: corev1.PodSpec{
@@ -568,21 +568,21 @@ func TestInjectPythonSDK(t *testing.T) {
568568
},
569569
},
570570
},
571-
wheelKind: "not supported",
571+
platform: "not-supported",
572572
expected: corev1.Pod{
573573
Spec: corev1.PodSpec{
574574
Containers: []corev1.Container{
575575
{},
576576
},
577577
},
578578
},
579-
err: fmt.Errorf("provided instrumentation.opentelemetry.io/otel-python-wheel-kind annotation value 'not supported' is not supported"),
579+
err: fmt.Errorf("provided instrumentation.opentelemetry.io/otel-python-platform annotation value 'not-supported' is not supported"),
580580
},
581581
}
582582

583583
for _, test := range tests {
584584
t.Run(test.name, func(t *testing.T) {
585-
pod, err := injectPythonSDK(test.Python, test.pod, 0, test.wheelKind)
585+
pod, err := injectPythonSDK(test.Python, test.pod, 0, test.platform)
586586
assert.Equal(t, test.expected, pod)
587587
assert.Equal(t, test.err, err)
588588
})

pkg/instrumentation/sdk.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations
110110

111111
for _, container := range insts.Python.Containers {
112112
index := getContainerIndex(container, pod)
113-
pod, err = injectPythonSDK(otelinst.Spec.Python, pod, index, insts.Python.AdditionalAnnotations[annotationPythonWheelKind])
113+
pod, err = injectPythonSDK(otelinst.Spec.Python, pod, index, insts.Python.AdditionalAnnotations[annotationPythonPlatform])
114114
if err != nil {
115115
i.logger.Info("Skipping Python SDK injection", "reason", err.Error(), "container", pod.Spec.Containers[index].Name)
116116
} else {

tests/e2e-instrumentation/instrumentation-python-musl/01-assert.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ metadata:
44
annotations:
55
instrumentation.opentelemetry.io/inject-python: "true"
66
sidecar.opentelemetry.io/inject: "true"
7-
instrumentation.opentelemetry.io/otel-python-wheel-kind: "musllinux"
7+
instrumentation.opentelemetry.io/otel-python-platform: "musl"
88
labels:
99
app: my-python-musl
1010
spec:
@@ -60,7 +60,6 @@ spec:
6060
- mountPath: /otel-auto-instrumentation-python
6161
name: opentelemetry-auto-instrumentation-python
6262
- args:
63-
- --feature-gates=-component.UseLocalHostAsDefaultHost
6463
- --config=env:OTEL_CONFIG
6564
name: otc-container
6665
initContainers:

tests/e2e-instrumentation/instrumentation-python-musl/01-install-app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
annotations:
1515
sidecar.opentelemetry.io/inject: "true"
1616
instrumentation.opentelemetry.io/inject-python: "true"
17-
instrumentation.opentelemetry.io/otel-python-wheel-kind: "musllinux"
17+
instrumentation.opentelemetry.io/otel-python-platform: "musl"
1818
spec:
1919
securityContext:
2020
runAsUser: 1000

0 commit comments

Comments
 (0)