-
Notifications
You must be signed in to change notification settings - Fork 200
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
[GEN-1738] Add service name to instrumentation config #1830
base: main
Are you sure you want to change the base?
[GEN-1738] Add service name to instrumentation config #1830
Conversation
…ntainer Task 149 sources container
…play-source-manage-list
…urces-card Task 107 overview sources card
…rce-manage-list Task 142 display source manage list
…rce-btn Task 143 add new source btn
…sources-connection Task 145 handle new sources connection
…-service-name-to-instrumentation-config
instrumentor/controllers/instrumentationconfig/workloads_reconciler.go
Outdated
Show resolved
Hide resolved
instrumentor/controllers/instrumentationconfig/workloads_reconciler.go
Outdated
Show resolved
Hide resolved
instrumentor/controllers/instrumentationconfig/workloads_reconciler.go
Outdated
Show resolved
Hide resolved
instrumentor/controllers/instrumentationconfig/workloads_reconciler.go
Outdated
Show resolved
Hide resolved
instrumentor/controllers/instrumentationconfig/instrumentedapplication_controller.go
Outdated
Show resolved
Hide resolved
… github.com:alonkeyval/odigos into gen-1738-add-service-name-to-instrumentation-config
instrumentor/controllers/instrumentationconfig/workloads_reconciler.go
Outdated
Show resolved
Hide resolved
instrumentor/controllers/instrumentationconfig/workloads_controllers.go
Outdated
Show resolved
Hide resolved
instrumentor/controllers/instrumentationconfig/workloads_controllers.go
Outdated
Show resolved
Hide resolved
… github.com:alonkeyval/odigos into gen-1738-add-service-name-to-instrumentation-config
func ExtractServiceNameFromAnnotations(annotations map[string]string, defaultName string) string { | ||
if annotations == nil { | ||
return defaultName | ||
} | ||
if reportedName, exists := annotations[consts.OdigosReportedNameAnnotation]; exists && reportedName != "" { | ||
return reportedName | ||
} | ||
return defaultName | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember @blumamir had a code for generating the service name based on the container name as well - to avoid conflicting service names. Do we need to handle this here?
return defaultName | ||
} | ||
if reportedName, exists := annotations[consts.OdigosReportedNameAnnotation]; exists && reportedName != "" { | ||
return reportedName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to perform some validation on this user-provided value?
Also, the fallbacks defined by OTel: https://opentelemetry.io/docs/specs/semconv/resource/#service
We can say that we'll handle this in the lower layers reading the service name from the config - I'm not sure what it the best approach.
|
||
} | ||
|
||
func createOrUpdateInstrumentationConfig(ctx context.Context, k8sClient client.Client, instConfigName, namespace string, serviceName string) (reconcile.Result, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no create only update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
This pull request introduces changes to support the identification and management of service names in telemetry data. The most important changes include the addition of the
serviceName
attribute in various configurations and the implementation of logic to resolve and update service names based on workload annotations.Enhancements to Telemetry Data Management:
api/config/crd/bases/odigos.io_instrumentationconfigs.yaml
: AddedserviceName
attribute to identify the name of the service generating telemetry data.api/odigos/v1alpha1/instrumentationconfig_types.go
: IntroducedServiceName
field inInstrumentationConfigSpec
to store the service name.Updates to Controllers:
instrumentor/controllers/instrumentationconfig/common.go
: ModifiedupdateInstrumentationConfigForWorkload
to acceptserviceName
and addedresolveServiceName
function to determine the service name based on workload kind. [1] [2] [3]instrumentor/controllers/instrumentationconfig/instrumentationrule_controller.go
: Integrated service name resolution in theReconcile
method and updated calls toupdateInstrumentationConfigForWorkload
. [1] [2]instrumentor/controllers/instrumentationconfig/instrumentedapplication_controller.go
: Added logic to resolve and use the service name in theReconcile
method.Testing Updates:
instrumentor/controllers/instrumentationconfig/common_test.go
: Updated test cases to passserviceName
toupdateInstrumentationConfigForWorkload
. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]New Workload Reconciler:
instrumentor/controllers/instrumentationconfig/manager.go
: Added predicates and watchers for deployment, statefulset, and daemonset changes to handle service name updates. [1] [2] [3]instrumentor/controllers/instrumentationconfig/workloads_reconciler.go
: ImplementedWorkloadsReconciler
to manageInstrumentationConfig
updates based on workload annotations.