Skip to content

Commit

Permalink
A fix for #1893 - ApacheModuleServiceNamespace falls back to instrume…
Browse files Browse the repository at this point in the history
…ntation request namespace name or static default name (#1905)

* fix for #1893

* chloggen

---------

Co-authored-by: Jacob Aronoff <[email protected]>
  • Loading branch information
chrlic and jaronoff97 authored Jul 12, 2023
1 parent e9af801 commit fc9485b
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 5 deletions.
16 changes: 16 additions & 0 deletions .chloggen/fix-for-1893.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
component: operator

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Fix for issue #1893"

# One or more tracking issues related to the change
issues: [1905]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
8 changes: 8 additions & 0 deletions pkg/instrumentation/apachehttpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"strings"

"github.com/go-logr/logr"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
corev1 "k8s.io/api/core/v1"

"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
Expand Down Expand Up @@ -219,6 +220,13 @@ LoadModule otel_apache_module %[1]s/WebServerModule/Apache/libmod_apache_otel%[2
}
serviceName := chooseServiceName(pod, resourceMap, index)
serviceNamespace := pod.GetNamespace()
if len(serviceNamespace) == 0 {
serviceNamespace = resourceMap[string(semconv.K8SNamespaceNameKey)]
if len(serviceNamespace) == 0 {
serviceNamespace = "apache-httpd"
}

}
// Namespace name override TBD

// There are two versions of the OTEL modules - for Apache HTTPD 2.4 and 2.2.
Expand Down
Loading

0 comments on commit fc9485b

Please sign in to comment.