Documentation
¶
Overview ¶
Copyright 2024.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func GetLanguageInstrumentations(instCandidates []*v1beta1.Instrumentation) ([]*v1beta1.Instrumentation, error)
- func GetSecretNameFromInstrumentations(insts []*v1beta1.Instrumentation) (string, error)
- type Health
- type HealthCheck
- type HealthCheckApi
- type HealthMonitor
- func (m *HealthMonitor) InstrumentationRemove(instrumentation *v1beta1.Instrumentation)
- func (m *HealthMonitor) InstrumentationSet(instrumentation *v1beta1.Instrumentation)
- func (m *HealthMonitor) NamespaceRemove(ns *corev1.Namespace)
- func (m *HealthMonitor) NamespaceSet(ns *corev1.Namespace)
- func (m *HealthMonitor) PodRemove(pod *corev1.Pod)
- func (m *HealthMonitor) PodSet(pod *corev1.Pod)
- func (m *HealthMonitor) Shutdown(ctx context.Context) error
- func (m *HealthMonitor) Stop(ctx context.Context) error
- type InstrumentationLocator
- type InstrumentationPodMutator
- type InstrumentationStatusUpdater
- type InstrumentationStatusUpdaterImpl
- type NewrelicInstrumentationLocator
- type NewrelicSdkInjector
- type NewrelicSecretReplicator
- type SdkInjector
- type SecretReplicator
Constants ¶
const (
DefaultLicenseKeySecretName = "newrelic-key-secret"
)
Variables ¶
This section is empty.
Functions ¶
func GetLanguageInstrumentations ¶
func GetLanguageInstrumentations(instCandidates []*v1beta1.Instrumentation) ([]*v1beta1.Instrumentation, error)
GetLanguageInstrumentations is used to collect all instrumentations and validate that only a single instrumentation exists for each language, and return them together, modifying the slice items in place
func GetSecretNameFromInstrumentations ¶
func GetSecretNameFromInstrumentations(insts []*v1beta1.Instrumentation) (string, error)
GetSecretNameFromInstrumentations is used to get a single secret key name from a list of Instrumentation's. It will use the default if none is provided. If any of them are different by name, this will fail, as we can only bind a single license key to a single pod.
Types ¶
type Health ¶
type Health struct { Healthy bool `json:"healthy" yaml:"healthy"` Status string `json:"status" yaml:"status"` StartTime int64 `json:"start_time_unix_nano" yaml:"start_time_unix_nano"` StatusTime int64 `json:"status_time_unix_nano" yaml:"status_time_unix_nano"` LastError string `json:"last_error" yaml:"last_error"` ComponentHealthMap map[string]*Health `json:"component_health_map,omitempty" yaml:"component_health_map,omitempty"` }
Health in the opamp format
type HealthCheck ¶
type HealthCheck interface {
GetHealth(ctx context.Context, url string) (health Health, err error)
}
HealthCheck our api contract
type HealthCheckApi ¶
type HealthCheckApi struct {
// contains filtered or unexported fields
}
HealthCheckApi .
func NewHealthCheckApi ¶
func NewHealthCheckApi(httpClient *http.Client) *HealthCheckApi
NewHealthCheckApi returns a newly constructed health check client
type HealthMonitor ¶
type HealthMonitor struct {
// contains filtered or unexported fields
}
HealthMonitor .
func NewHealthMonitor ¶
func NewHealthMonitor( instrumentationStatusUpdater InstrumentationStatusUpdater, healthCheck HealthCheck, tickInterval time.Duration, podMetricWorkers int, instrumentationsMetricWorkers int, instrumentationsMetricPersistWorkers int, ) *HealthMonitor
NewHealthMonitor returns a new instance of a health monitor which check the health of pods via the health sidecar
func (*HealthMonitor) InstrumentationRemove ¶
func (m *HealthMonitor) InstrumentationRemove(instrumentation *v1beta1.Instrumentation)
InstrumentationRemove to remove the instrumentation
func (*HealthMonitor) InstrumentationSet ¶
func (m *HealthMonitor) InstrumentationSet(instrumentation *v1beta1.Instrumentation)
InstrumentationSet to set the instrumentation
func (*HealthMonitor) NamespaceRemove ¶
func (m *HealthMonitor) NamespaceRemove(ns *corev1.Namespace)
NamespaceRemove to remove the namespace
func (*HealthMonitor) NamespaceSet ¶
func (m *HealthMonitor) NamespaceSet(ns *corev1.Namespace)
NamespaceSet to set the namespace
func (*HealthMonitor) PodRemove ¶
func (m *HealthMonitor) PodRemove(pod *corev1.Pod)
PodRemove to remove the pod
func (*HealthMonitor) PodSet ¶
func (m *HealthMonitor) PodSet(pod *corev1.Pod)
PodSet to set the pod
type InstrumentationLocator ¶
type InstrumentationLocator interface {
GetInstrumentations(ctx context.Context, ns corev1.Namespace, pod corev1.Pod) ([]*v1beta1.Instrumentation, error)
}
InstrumentationLocator is used to find instrumentations
type InstrumentationPodMutator ¶
type InstrumentationPodMutator struct {
// contains filtered or unexported fields
}
func NewMutator ¶
func NewMutator( logger logr.Logger, client client.Client, sdkInjector SdkInjector, secretReplicator SecretReplicator, instrumentationLocator InstrumentationLocator, operatorNamespace string, ) *InstrumentationPodMutator
NewMutator is used to get a new instance of a mutator
type InstrumentationStatusUpdater ¶
type InstrumentationStatusUpdater interface {
UpdateInstrumentationStatus(ctx context.Context, instrumentation *v1beta1.Instrumentation) error
}
type InstrumentationStatusUpdaterImpl ¶
func NewInstrumentationStatusUpdater ¶
func NewInstrumentationStatusUpdater(client client.Client) *InstrumentationStatusUpdaterImpl
func (*InstrumentationStatusUpdaterImpl) UpdateInstrumentationStatus ¶
func (i *InstrumentationStatusUpdaterImpl) UpdateInstrumentationStatus(ctx context.Context, instrumentation *v1beta1.Instrumentation) error
type NewrelicInstrumentationLocator ¶
type NewrelicInstrumentationLocator struct {
// contains filtered or unexported fields
}
NewrelicInstrumentationLocator is the base struct for locating instrumentations
func NewNewRelicInstrumentationLocator ¶
func NewNewRelicInstrumentationLocator(logger logr.Logger, client client.Client, operatorNamespace string) *NewrelicInstrumentationLocator
NewNewRelicInstrumentationLocator is the constructor for getting instrumentations
func (*NewrelicInstrumentationLocator) GetInstrumentations ¶
func (il *NewrelicInstrumentationLocator) GetInstrumentations(ctx context.Context, ns corev1.Namespace, pod corev1.Pod) ([]*v1beta1.Instrumentation, error)
GetInstrumentations is used to get all instrumentations in the cluster. While we could limit it to the operator namespace, it's more helpful to list anything in the logs that may have been excluded.
type NewrelicSdkInjector ¶
type NewrelicSdkInjector struct {
// contains filtered or unexported fields
}
NewrelicSdkInjector is the base struct used to inject our instrumentation into a pod
func NewNewrelicSdkInjector ¶
func NewNewrelicSdkInjector(logger logr.Logger, client client.Client, injectorRegistry *apm.InjectorRegistery) *NewrelicSdkInjector
NewNewrelicSdkInjector is used to create our injector
func (*NewrelicSdkInjector) Inject ¶
func (i *NewrelicSdkInjector) Inject(ctx context.Context, insts []*v1beta1.Instrumentation, ns corev1.Namespace, pod corev1.Pod) corev1.Pod
Inject is used to utilize a list of instrumentations, and if the injectors language matches the instrumentation, trigger the injector
type NewrelicSecretReplicator ¶
type NewrelicSecretReplicator struct {
// contains filtered or unexported fields
}
NewrelicSecretReplicator is the base struct used for copying the secrets
func NewNewrelicSecretReplicator ¶
func NewNewrelicSecretReplicator(logger logr.Logger, client client.Client) *NewrelicSecretReplicator
NewNewrelicSecretReplicator is the constructor for copying secrets
func (*NewrelicSecretReplicator) ReplicateSecret ¶
func (sr *NewrelicSecretReplicator) ReplicateSecret(ctx context.Context, ns corev1.Namespace, pod corev1.Pod, operatorNamespace string, secretName string) error
ReplicateSecret is used to copy the secret from the operator namespace to the pod namespace if the secret doesn't already exist