Documentation
¶
Index ¶
- func CreateMetricsAndLogsRhobsFetchers(ctx context.Context, clusterKey string, hiveOcmUrl string) (*RhobsFetcher, *RhobsFetcher, error)
- func GatherHCPLogs(ctx context.Context, clusterId, hiveOcmUrl, destDir string, ...) (totalLogs int, err error)
- func GetAllowedGrafanaDashboardsShortNames() []string
- func GetGrafanaDashboardUrl(metricsFetcher, logsFetcher *RhobsFetcher, grafanaDashboard *GrafanaDashboard) (string, error)
- func NewCmdRhobs() *cobra.Command
- type AlertsFormat
- type GrafanaDashboard
- type LogsFormat
- type MetricsFormat
- type MetricsTimeRange
- type RhobsFetchUsage
- type RhobsFetcher
- func (f *RhobsFetcher) DeleteSilence(ctx context.Context, silenceId uuid.UUID) error
- func (f *RhobsFetcher) GetGrafanaLogsUrl(lokiExpr string, startTime, endTime time.Time, isGoingForward bool) (string, error)
- func (f *RhobsFetcher) GetGrafanaMetricsUrl(promExpr string, startTime, endTime time.Time) (string, error)
- func (f *RhobsFetcher) PrintAlerts(ctx context.Context, format AlertsFormat, isPrintingClusterResultsOnly bool) error
- func (f *RhobsFetcher) PrintInstantMetrics(ctx context.Context, promExpr string, evalTime time.Time, format MetricsFormat, ...) error
- func (f *RhobsFetcher) PrintLogs(ctx context.Context, lokiExpr string, startTime, endTime time.Time, ...) error
- func (f *RhobsFetcher) PrintRangeMetrics(ctx context.Context, promExpr string, timeRange MetricsTimeRange, ...) error
- func (f *RhobsFetcher) QueryRules(ctx context.Context, ruleType string) (json.RawMessage, error)
- func (f *RhobsFetcher) QuerySilences(ctx context.Context) (json.RawMessage, error)
- func (f *RhobsFetcher) StreamLogs(lokiExpr string, format LogsFormat, isPrintingTimeValue bool, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMetricsAndLogsRhobsFetchers ¶ added in v0.61.0
func CreateMetricsAndLogsRhobsFetchers(ctx context.Context, clusterKey string, hiveOcmUrl string) (*RhobsFetcher, *RhobsFetcher, error)
func GatherHCPLogs ¶ added in v0.67.0
func GatherHCPLogs(ctx context.Context, clusterId, hiveOcmUrl, destDir string, namespaces []string, since time.Duration, maxLines int) (totalLogs int, err error)
GatherHCPLogs fetches pod logs for the given namespaces from RHOBS over the [now-since, now] window and writes them under destDir, one file per pod. It is the RHOBS replacement for the former Dynatrace-based HCP log collection. (Kubernetes Events are collected separately by the ACM hypershift dump as core/events.yaml, so they are intentionally not fetched here.)
A namespace with no matching logs is not an error, but a query/transport/auth failure is returned so callers can distinguish an empty result from a collection failure. It returns the total number of log lines written across all namespaces, so callers can report whether data was actually found. maxLines bounds the most-recent lines fetched per namespace (0 = unlimited). A positive cap makes the collection fetch newest-first and stop, bounding both runtime and archive size.
func GetAllowedGrafanaDashboardsShortNames ¶ added in v0.61.0
func GetAllowedGrafanaDashboardsShortNames() []string
func GetGrafanaDashboardUrl ¶ added in v0.61.0
func GetGrafanaDashboardUrl(metricsFetcher, logsFetcher *RhobsFetcher, grafanaDashboard *GrafanaDashboard) (string, error)
func NewCmdRhobs ¶
NewCmdRhobs builds the RHOBS command and its subcommands.
Types ¶
type AlertsFormat ¶ added in v0.61.0
type AlertsFormat string
const ( AlertsFormatText AlertsFormat = "text" AlertsFormatCsv AlertsFormat = "csv" AlertsFormatJson AlertsFormat = "json" )
func GetAlertsFormatFromString ¶ added in v0.61.0
func GetAlertsFormatFromString(formatStr string) (AlertsFormat, error)
type GrafanaDashboard ¶ added in v0.61.0
type GrafanaDashboard struct {
// contains filtered or unexported fields
}
func GetGrafanaDashboardForShortName ¶ added in v0.61.0
func GetGrafanaDashboardForShortName(shortName string) *GrafanaDashboard
type LogsFormat ¶
type LogsFormat string
const ( LogsFormatText LogsFormat = "text" LogsFormatCsv LogsFormat = "csv" LogsFormatJson LogsFormat = "json" )
func GetLogsFormatFromString ¶
func GetLogsFormatFromString(formatStr string) (LogsFormat, error)
type MetricsFormat ¶
type MetricsFormat string
const ( MetricsFormatTable MetricsFormat = "table" MetricsFormatCsv MetricsFormat = "csv" MetricsFormatJson MetricsFormat = "json" )
func GetMetricsFormatFromString ¶
func GetMetricsFormatFromString(formatStr string) (MetricsFormat, error)
type MetricsTimeRange ¶ added in v0.61.0
type MetricsTimeRange struct {
// contains filtered or unexported fields
}
func NewMetricsTimeRange ¶ added in v0.61.0
func NewMetricsTimeRange(startTime, endTime time.Time, stepDuration time.Duration) MetricsTimeRange
func (*MetricsTimeRange) Log ¶ added in v0.61.0
func (tr *MetricsTimeRange) Log()
type RhobsFetchUsage ¶
type RhobsFetchUsage string
const ( RhobsFetchForMetrics RhobsFetchUsage = "metrics" RhobsFetchForLogs RhobsFetchUsage = "logs" )
type RhobsFetcher ¶
type RhobsFetcher struct {
IsHostedCluster bool
RhobsCell string
HcpNamespace string // HCP control-plane namespace on the MC; set for HCP clusters
// contains filtered or unexported fields
}
func CreateRhobsFetcher ¶
func CreateRhobsFetcher(ctx context.Context, clusterKey string, usage RhobsFetchUsage, hiveOcmUrl string) (*RhobsFetcher, error)
func CreateRhobsFetcherFromCell ¶ added in v0.61.0
func CreateRhobsFetcherFromCell(rhobsCell string) (*RhobsFetcher, error)
func (*RhobsFetcher) DeleteSilence ¶ added in v0.61.0
func (*RhobsFetcher) GetGrafanaLogsUrl ¶ added in v0.61.0
func (*RhobsFetcher) GetGrafanaMetricsUrl ¶ added in v0.61.0
func (*RhobsFetcher) PrintAlerts ¶ added in v0.61.0
func (f *RhobsFetcher) PrintAlerts(ctx context.Context, format AlertsFormat, isPrintingClusterResultsOnly bool) error
func (*RhobsFetcher) PrintInstantMetrics ¶ added in v0.61.0
func (f *RhobsFetcher) PrintInstantMetrics(ctx context.Context, promExpr string, evalTime time.Time, format MetricsFormat, isPrintingClusterResultsOnly bool) error
func (*RhobsFetcher) PrintRangeMetrics ¶ added in v0.61.0
func (f *RhobsFetcher) PrintRangeMetrics(ctx context.Context, promExpr string, timeRange MetricsTimeRange, format MetricsFormat, isPrintingClusterResultsOnly bool) error
func (*RhobsFetcher) QueryRules ¶ added in v0.58.0
func (f *RhobsFetcher) QueryRules(ctx context.Context, ruleType string) (json.RawMessage, error)
func (*RhobsFetcher) QuerySilences ¶ added in v0.61.0
func (f *RhobsFetcher) QuerySilences(ctx context.Context) (json.RawMessage, error)
func (*RhobsFetcher) StreamLogs ¶
func (f *RhobsFetcher) StreamLogs(lokiExpr string, format LogsFormat, isPrintingTimeValue bool, fieldNames []string, isDeduping bool) error