
com.newrelic.agent.utilization.KubernetesData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of newrelic-agent Show documentation
Show all versions of newrelic-agent Show documentation
Jar required to run with a java application to monitor performance.
The newest version!
/*
*
* * Copyright 2020 New Relic Corporation. All rights reserved.
* * SPDX-License-Identifier: Apache-2.0
*
*/
package com.newrelic.agent.utilization;
import com.newrelic.agent.config.SystemPropertyProvider;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class KubernetesData {
static final String KUBERNETES_SERVICE_HOST_ENV = "KUBERNETES_SERVICE_HOST";
static final String KUBERNETES_SERVICE_HOST_KEY = "kubernetes_service_host";
static final KubernetesData EMPTY_KUBERNETES_DATA = new KubernetesData(Collections.emptyMap());
private final Map kubernetesData;
private KubernetesData(Map kubernetesData) {
this.kubernetesData = kubernetesData;
}
static KubernetesData extractKubernetesValues(SystemPropertyProvider systemPropertyProvider) {
Map kubernetesData = new HashMap<>();
String kubernetesServiceHost = systemPropertyProvider.getEnvironmentVariable(KUBERNETES_SERVICE_HOST_ENV);
if (kubernetesServiceHost != null) {
kubernetesData.put(KUBERNETES_SERVICE_HOST_KEY, kubernetesServiceHost);
}
return new KubernetesData(kubernetesData);
}
public Map getValueMap() {
return kubernetesData;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy