Skip to content

Commit 31223db

Browse files
Refactor splunk-otel-java-agent framework
1 parent f889d52 commit 31223db

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

src/java/frameworks/splunk_otel_java_agent.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (s *SplunkOtelJavaAgentFramework) Finalize() error {
129129
opts = append(opts, fmt.Sprintf("-javaagent:%s", runtimeJarPath))
130130

131131
// Configure service name
132-
if appName := s.getApplicationName(); appName != "" {
132+
if appName := GetApplicationName(false); appName != "" {
133133
opts = append(opts, fmt.Sprintf("-Dotel.service.name=%s", appName))
134134
}
135135

@@ -234,25 +234,6 @@ func (s *SplunkOtelJavaAgentFramework) getCredentials() SplunkCredentials {
234234
return creds
235235
}
236236

237-
// getApplicationName returns the application name
238-
func (s *SplunkOtelJavaAgentFramework) getApplicationName() string {
239-
vcapApp := os.Getenv("VCAP_APPLICATION")
240-
if vcapApp == "" {
241-
return ""
242-
}
243-
244-
var appData map[string]interface{}
245-
if err := json.Unmarshal([]byte(vcapApp), &appData); err != nil {
246-
return ""
247-
}
248-
249-
if name, ok := appData["application_name"].(string); ok {
250-
return name
251-
}
252-
253-
return ""
254-
}
255-
256237
func (s *SplunkOtelJavaAgentFramework) constructJarPath(agentDir string) error {
257238
jarPattern := filepath.Join(agentDir, "splunk-otel-javaagent.jar")
258239
if _, err := os.Stat(jarPattern); err != nil {

0 commit comments

Comments
 (0)