mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 12:12:11 +08:00
Investigations: Add experimental app platform backend (#100584)
* add investigations group? * Investigations: Add experimental app platform backend * change `grafana-app-sdk/logging` version * investigations: add feature flag to test --------- Co-authored-by: Sven Grossmann <svennergr@gmail.com>
This commit is contained in:
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -71,7 +71,7 @@
|
||||
|
||||
/apps/alerting/ @grafana/alerting-backend
|
||||
/apps/playlist/ @grafana/grafana-app-platform-squad
|
||||
/apps/investigation/ @fcjack @matryer
|
||||
/apps/investigations/ @fcjack @matryer @svennergr
|
||||
/apps/advisor/ @grafana/plugins-platform-backend
|
||||
/pkg/api/ @grafana/grafana-backend-group
|
||||
/pkg/apis/ @grafana/grafana-app-platform-squad
|
||||
|
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@ -8,7 +8,7 @@ updates:
|
||||
directories:
|
||||
- "/"
|
||||
- "/apps/playlist"
|
||||
- "/apps/investigation"
|
||||
- "/apps/investigations"
|
||||
- "/pkg/aggregator"
|
||||
- "/pkg/apimachinery"
|
||||
- "/pkg/apiserver"
|
||||
|
@ -191,10 +191,10 @@ linters-settings:
|
||||
allow: []
|
||||
deny:
|
||||
- pkg: github.com/grafana/grafana/pkg
|
||||
desc: apps/investigation is not allowed to import grafana core
|
||||
desc: apps/investigations is not allowed to import grafana core
|
||||
files:
|
||||
- ./apps/investigation/*
|
||||
- ./apps/investigation/**/*
|
||||
- ./apps/investigations/*
|
||||
- ./apps/investigations/**/*
|
||||
gocritic:
|
||||
enabled-checks:
|
||||
- ruleguard
|
||||
|
@ -73,7 +73,7 @@ COPY pkg/storage/unified/apistore pkg/storage/unified/apistore
|
||||
COPY pkg/semconv pkg/semconv
|
||||
COPY pkg/aggregator pkg/aggregator
|
||||
COPY apps/playlist apps/playlist
|
||||
COPY apps/investigation apps/investigation
|
||||
COPY apps/investigations apps/investigations
|
||||
COPY apps/advisor apps/advisor
|
||||
COPY apps apps
|
||||
COPY kindsv2 kindsv2
|
||||
|
@ -1,2 +0,0 @@
|
||||
module: "github.com/grafana/grafana/apps/investigation/kinds"
|
||||
language: version: "v0.8.2"
|
@ -1,87 +0,0 @@
|
||||
package investigation
|
||||
|
||||
// This is our Investigation definition, which contains metadata about the kind, and the kind's schema
|
||||
investigation: {
|
||||
kind: "Investigation"
|
||||
pluralName: "Investigations"
|
||||
current: "v1alpha1"
|
||||
versions: {
|
||||
"v1alpha1": {
|
||||
codegen: {
|
||||
frontend: false
|
||||
backend: true
|
||||
}
|
||||
schema: {
|
||||
#InvestigationSpec: {
|
||||
title: string
|
||||
status: "open" | "closed"
|
||||
items: [...#InvestigationItem]
|
||||
}
|
||||
|
||||
// InvestigationItem is an item in an investigation.
|
||||
#InvestigationItem: {
|
||||
id: string
|
||||
title: string
|
||||
// type is the type of the item "timeseries", "heatmap", "log-table" (not an enum to allow for future extensions).
|
||||
type: string
|
||||
// url is the URL to the item.
|
||||
url: string
|
||||
// origin is where the item was created from.
|
||||
origin: string // "explore-metrics", "explore-logs", "explore-traces" (not an enum to allow for future extensions)
|
||||
// iconPath (optional) is the path to the icon for the item.
|
||||
iconPath?: string
|
||||
// timeRange (optional) is the time range of the item.
|
||||
timeRange: #AbsoluteTimeRange
|
||||
// note (optional) is a comment on the item.
|
||||
note?: [...#Comment]
|
||||
// queryType is the type of the query used to generate this item.
|
||||
queryType: "logs" | "metrics"
|
||||
// dataQuery contains the query used to generate this item.
|
||||
dataQuery: #DataQueryLogs | #DataQueryMetrics
|
||||
}
|
||||
|
||||
// DataQueryLogs is a data query for logs.
|
||||
#DataQueryLogs: {
|
||||
// refId is the reference ID of the query.
|
||||
refId: string
|
||||
// datasource is the datasource of the query.
|
||||
datasource: #DatasourceRef
|
||||
// expr is the expression of the query.
|
||||
expr: string
|
||||
// maxLines (optional) is used to limit the number of log rows returned.
|
||||
maxLines?: int64
|
||||
}
|
||||
|
||||
// DataQueryMetrics is a data query for metrics.
|
||||
#DataQueryMetrics: {
|
||||
refId: string
|
||||
datasource: #DatasourceRef
|
||||
expr: string
|
||||
}
|
||||
|
||||
// Comment is a comment on an investigation item.
|
||||
#Comment: {
|
||||
authorUserID: string
|
||||
bodyMarkdown: string
|
||||
}
|
||||
|
||||
// DatasourceRef is a reference to a datasource.
|
||||
#DatasourceRef: {
|
||||
uid: string
|
||||
type: string
|
||||
apiVersion: string
|
||||
name: string
|
||||
}
|
||||
|
||||
// AbsoluteTimeRange is a time range specified by absolute timestamps.
|
||||
#AbsoluteTimeRange: {
|
||||
from: number
|
||||
to: number
|
||||
}
|
||||
|
||||
// spec is the schema of our resource. The spec should include all the user-ediable information for the kind.
|
||||
spec: #InvestigationSpec
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package investigation
|
||||
|
||||
manifest: {
|
||||
appName: "investigation"
|
||||
groupOverride: "investigation.grafana.app"
|
||||
kinds: [
|
||||
investigation,
|
||||
]
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// AbsoluteTimeRange is a time range specified by absolute timestamps.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationAbsoluteTimeRange struct {
|
||||
From float64 `json:"from"`
|
||||
To float64 `json:"to"`
|
||||
}
|
||||
|
||||
// NewInvestigationAbsoluteTimeRange creates a new InvestigationAbsoluteTimeRange object.
|
||||
func NewInvestigationAbsoluteTimeRange() *InvestigationAbsoluteTimeRange {
|
||||
return &InvestigationAbsoluteTimeRange{}
|
||||
}
|
||||
|
||||
// Comment is a comment on an investigation item.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationComment struct {
|
||||
AuthorUserID string `json:"authorUserID"`
|
||||
BodyMarkdown string `json:"bodyMarkdown"`
|
||||
}
|
||||
|
||||
// NewInvestigationComment creates a new InvestigationComment object.
|
||||
func NewInvestigationComment() *InvestigationComment {
|
||||
return &InvestigationComment{}
|
||||
}
|
||||
|
||||
// DatasourceRef is a reference to a datasource.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationDatasourceRef struct {
|
||||
Uid string `json:"uid"`
|
||||
Type string `json:"type"`
|
||||
ApiVersion string `json:"apiVersion"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// NewInvestigationDatasourceRef creates a new InvestigationDatasourceRef object.
|
||||
func NewInvestigationDatasourceRef() *InvestigationDatasourceRef {
|
||||
return &InvestigationDatasourceRef{}
|
||||
}
|
||||
|
||||
// DataQueryLogs is a data query for logs.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationDataQueryLogs struct {
|
||||
// refId is the reference ID of the query.
|
||||
RefId string `json:"refId"`
|
||||
// datasource is the datasource of the query.
|
||||
Datasource InvestigationDatasourceRef `json:"datasource"`
|
||||
// expr is the expression of the query.
|
||||
Expr string `json:"expr"`
|
||||
// maxLines (optional) is used to limit the number of log rows returned.
|
||||
MaxLines *int64 `json:"maxLines,omitempty"`
|
||||
}
|
||||
|
||||
// NewInvestigationDataQueryLogs creates a new InvestigationDataQueryLogs object.
|
||||
func NewInvestigationDataQueryLogs() *InvestigationDataQueryLogs {
|
||||
return &InvestigationDataQueryLogs{
|
||||
Datasource: *NewInvestigationDatasourceRef(),
|
||||
}
|
||||
}
|
||||
|
||||
// DataQueryMetrics is a data query for metrics.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationDataQueryMetrics struct {
|
||||
RefId string `json:"refId"`
|
||||
Datasource InvestigationDatasourceRef `json:"datasource"`
|
||||
Expr string `json:"expr"`
|
||||
}
|
||||
|
||||
// NewInvestigationDataQueryMetrics creates a new InvestigationDataQueryMetrics object.
|
||||
func NewInvestigationDataQueryMetrics() *InvestigationDataQueryMetrics {
|
||||
return &InvestigationDataQueryMetrics{
|
||||
Datasource: *NewInvestigationDatasourceRef(),
|
||||
}
|
||||
}
|
||||
|
||||
// InvestigationItem is an item in an investigation.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationInvestigationItem struct {
|
||||
Id string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
// type is the type of the item "timeseries", "heatmap", "log-table" (not an enum to allow for future extensions).
|
||||
Type string `json:"type"`
|
||||
// url is the URL to the item.
|
||||
Url string `json:"url"`
|
||||
// origin is where the item was created from.
|
||||
// "explore-metrics", "explore-logs", "explore-traces" (not an enum to allow for future extensions)
|
||||
Origin string `json:"origin"`
|
||||
// iconPath (optional) is the path to the icon for the item.
|
||||
IconPath *string `json:"iconPath,omitempty"`
|
||||
// timeRange (optional) is the time range of the item.
|
||||
TimeRange InvestigationAbsoluteTimeRange `json:"timeRange"`
|
||||
// note (optional) is a comment on the item.
|
||||
Note []InvestigationComment `json:"note,omitempty"`
|
||||
// queryType is the type of the query used to generate this item.
|
||||
QueryType InvestigationInvestigationItemQueryType `json:"queryType"`
|
||||
// dataQuery contains the query used to generate this item.
|
||||
DataQuery interface{} `json:"dataQuery"`
|
||||
}
|
||||
|
||||
// NewInvestigationInvestigationItem creates a new InvestigationInvestigationItem object.
|
||||
func NewInvestigationInvestigationItem() *InvestigationInvestigationItem {
|
||||
return &InvestigationInvestigationItem{
|
||||
TimeRange: *NewInvestigationAbsoluteTimeRange(),
|
||||
}
|
||||
}
|
||||
|
||||
// spec is the schema of our resource. The spec should include all the user-ediable information for the kind.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationSpec struct {
|
||||
Title string `json:"title"`
|
||||
Status InvestigationSpecStatus `json:"status"`
|
||||
Items []InvestigationInvestigationItem `json:"items"`
|
||||
}
|
||||
|
||||
// NewInvestigationSpec creates a new InvestigationSpec object.
|
||||
func NewInvestigationSpec() *InvestigationSpec {
|
||||
return &InvestigationSpec{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationInvestigationItemQueryType string
|
||||
|
||||
const (
|
||||
InvestigationInvestigationItemQueryTypeLogs InvestigationInvestigationItemQueryType = "logs"
|
||||
InvestigationInvestigationItemQueryTypeMetrics InvestigationInvestigationItemQueryType = "metrics"
|
||||
)
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationSpecStatus string
|
||||
|
||||
const (
|
||||
InvestigationSpecStatusOpen InvestigationSpecStatus = "open"
|
||||
InvestigationSpecStatusClosed InvestigationSpecStatus = "closed"
|
||||
)
|
@ -1,537 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
common "k8s.io/kube-openapi/pkg/common"
|
||||
spec "k8s.io/kube-openapi/pkg/validation/spec"
|
||||
)
|
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||
return map[string]common.OpenAPIDefinition{
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.Investigation": schema_pkg_apis_investigation_v1alpha1_Investigation(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationAbsoluteTimeRange": schema_pkg_apis_investigation_v1alpha1_InvestigationAbsoluteTimeRange(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationComment": schema_pkg_apis_investigation_v1alpha1_InvestigationComment(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDataQueryLogs": schema_pkg_apis_investigation_v1alpha1_InvestigationDataQueryLogs(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDataQueryMetrics": schema_pkg_apis_investigation_v1alpha1_InvestigationDataQueryMetrics(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef": schema_pkg_apis_investigation_v1alpha1_InvestigationDatasourceRef(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationInvestigationItem": schema_pkg_apis_investigation_v1alpha1_InvestigationInvestigationItem(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationList": schema_pkg_apis_investigation_v1alpha1_InvestigationList(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationSpec": schema_pkg_apis_investigation_v1alpha1_InvestigationSpec(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationStatus": schema_pkg_apis_investigation_v1alpha1_InvestigationStatus(ref),
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationstatusOperatorState": schema_pkg_apis_investigation_v1alpha1_InvestigationstatusOperatorState(ref),
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_Investigation(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"metadata", "spec", "status"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationSpec", "github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationAbsoluteTimeRange(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "AbsoluteTimeRange is a time range specified by absolute timestamps.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"from": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: 0,
|
||||
Type: []string{"number"},
|
||||
Format: "double",
|
||||
},
|
||||
},
|
||||
"to": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: 0,
|
||||
Type: []string{"number"},
|
||||
Format: "double",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"from", "to"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationComment(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Comment is a comment on an investigation item.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"authorUserID": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"bodyMarkdown": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"authorUserID", "bodyMarkdown"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationDataQueryLogs(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DataQueryLogs is a data query for logs.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"refId": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "refId is the reference ID of the query.",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"datasource": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "datasource is the datasource of the query.",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef"),
|
||||
},
|
||||
},
|
||||
"expr": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "expr is the expression of the query.",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"maxLines": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "maxLines (optional) is used to limit the number of log rows returned.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int64",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"refId", "datasource", "expr"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationDataQueryMetrics(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DataQueryMetrics is a data query for metrics.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"refId": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"datasource": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef"),
|
||||
},
|
||||
},
|
||||
"expr": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"refId", "datasource", "expr"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationDatasourceRef(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DatasourceRef is a reference to a datasource.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"uid": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"type": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"name": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"uid", "type", "apiVersion", "name"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationInvestigationItem(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "InvestigationItem is an item in an investigation.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"id": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"title": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"type": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "type is the type of the item \"timeseries\", \"heatmap\", \"log-table\" (not an enum to allow for future extensions).",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"url": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "url is the URL to the item.",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"origin": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "origin is where the item was created from. \"explore-metrics\", \"explore-logs\", \"explore-traces\" (not an enum to allow for future extensions)",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"iconPath": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "iconPath (optional) is the path to the icon for the item.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"timeRange": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "timeRange (optional) is the time range of the item.",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationAbsoluteTimeRange"),
|
||||
},
|
||||
},
|
||||
"note": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "note (optional) is a comment on the item.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationComment"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"queryType": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "queryType is the type of the query used to generate this item.",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"dataQuery": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "dataQuery contains the query used to generate this item.",
|
||||
Type: []string{"object"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"id", "title", "type", "url", "origin", "timeRange", "queryType", "dataQuery"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationAbsoluteTimeRange", "github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationComment"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.Investigation"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"metadata", "items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.Investigation", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "spec is the schema of our resource. The spec should include all the user-ediable information for the kind.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"title": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationInvestigationItem"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"title", "status", "items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationInvestigationItem"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"operatorStates": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "operatorStates is a map of operator ID to operator state evaluations. Any operator which consumes this kind SHOULD add its state evaluation information to this field.",
|
||||
Type: []string{"object"},
|
||||
AdditionalProperties: &spec.SchemaOrBool{
|
||||
Allows: true,
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationstatusOperatorState"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"additionalFields": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "additionalFields is reserved for future use",
|
||||
Type: []string{"object"},
|
||||
AdditionalProperties: &spec.SchemaOrBool{
|
||||
Allows: true,
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationstatusOperatorState"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"lastEvaluation": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "lastEvaluation is the ResourceVersion last evaluated",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"state": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"descriptiveState": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"details": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "details contains any extra information that is operator-specific",
|
||||
Type: []string{"object"},
|
||||
AdditionalProperties: &spec.SchemaOrBool{
|
||||
Allows: true,
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"lastEvaluation", "state"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
//
|
||||
// This file is generated by grafana-app-sdk
|
||||
// DO NOT EDIT
|
||||
//
|
||||
|
||||
package apis
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/app"
|
||||
)
|
||||
|
||||
var (
|
||||
rawSchemaInvestigationv1alpha1 = []byte(`{"spec":{"description":"spec is the schema of our resource. The spec should include all the user-ediable information for the kind.","properties":{"items":{"items":{"properties":{"dataQuery":{"description":"dataQuery contains the query used to generate this item.","oneOf":[{"allOf":[{"required":["refId","datasource","expr"]},{"not":{"anyOf":[{"required":["refId","datasource","expr"]}]}}]},{"allOf":[{"required":["refId","datasource","expr"]},{"not":{"anyOf":[{"required":["refId","datasource","expr"]}]}}]}],"properties":{"datasource":{"description":"datasource is the datasource of the query.","properties":{"apiVersion":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"uid":{"type":"string"}},"required":["uid","type","apiVersion","name"],"type":"object"},"expr":{"description":"expr is the expression of the query.","type":"string"},"maxLines":{"description":"maxLines (optional) is used to limit the number of log rows returned.","format":"int64","type":"integer"},"refId":{"description":"refId is the reference ID of the query.","type":"string"}},"type":"object"},"iconPath":{"description":"iconPath (optional) is the path to the icon for the item.","type":"string"},"id":{"type":"string"},"note":{"description":"note (optional) is a comment on the item.","items":{"properties":{"authorUserID":{"type":"string"},"bodyMarkdown":{"type":"string"}},"required":["authorUserID","bodyMarkdown"],"type":"object"},"type":"array"},"origin":{"description":"origin is where the item was created from.","type":"string"},"queryType":{"description":"queryType is the type of the query used to generate this item.","enum":["logs","metrics"],"type":"string"},"timeRange":{"description":"timeRange (optional) is the time range of the item.","properties":{"from":{"type":"number"},"to":{"type":"number"}},"required":["from","to"],"type":"object"},"title":{"type":"string"},"type":{"description":"type is the type of the item \"timeseries\", \"heatmap\", \"log-table\" (not an enum to allow for future extensions).","type":"string"},"url":{"description":"url is the URL to the item.","type":"string"}},"required":["id","title","type","url","origin","timeRange","queryType","dataQuery"],"type":"object"},"type":"array"},"status":{"enum":["open","closed"],"type":"string"},"title":{"type":"string"}},"required":["title","status","items"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`)
|
||||
versionSchemaInvestigationv1alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaInvestigationv1alpha1, &versionSchemaInvestigationv1alpha1)
|
||||
)
|
||||
|
||||
var appManifestData = app.ManifestData{
|
||||
AppName: "investigation",
|
||||
Group: "investigation.grafana.app",
|
||||
Kinds: []app.ManifestKind{
|
||||
{
|
||||
Kind: "Investigation",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Versions: []app.ManifestKindVersion{
|
||||
{
|
||||
Name: "v1alpha1",
|
||||
Schema: &versionSchemaInvestigationv1alpha1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func jsonToMap(j string) map[string]any {
|
||||
m := make(map[string]any)
|
||||
json.Unmarshal([]byte(j), &j)
|
||||
return m
|
||||
}
|
||||
|
||||
func LocalManifest() app.Manifest {
|
||||
return app.NewEmbeddedManifest(appManifestData)
|
||||
}
|
||||
|
||||
func RemoteManifest() app.Manifest {
|
||||
return app.NewAPIServerManifest("investigation")
|
||||
}
|
152
apps/investigations/example.json
Normal file
152
apps/investigations/example.json
Normal file
@ -0,0 +1,152 @@
|
||||
[
|
||||
{
|
||||
"id": "896312ce-65b0-4b50-ade1-e7f04fa22c66",
|
||||
"title": "Thursday morning investigation",
|
||||
"hasCustomName": false,
|
||||
"isFavorite": false,
|
||||
"collectables": [
|
||||
{
|
||||
"origin": "Explore Logs",
|
||||
"type": "timeseries",
|
||||
"queries": [
|
||||
{
|
||||
"refId": "LABEL_BREAKDOWN_VALUES",
|
||||
"queryType": "range",
|
||||
"editorMode": "code",
|
||||
"supportingQueryType": "grafana-lokiexplore-app",
|
||||
"legendFormat": "{{detected_level}}",
|
||||
"expr": "sum(count_over_time({service_name=\"web_app_1\"} | detected_level != \"\"[$__auto])) by (detected_level)"
|
||||
}
|
||||
],
|
||||
"timeRange": {
|
||||
"to": "2025-02-13T11:31:20.536Z",
|
||||
"from": "2025-02-13T11:16:20.536Z",
|
||||
"raw": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
}
|
||||
},
|
||||
"datasource": {
|
||||
"uid": "fe9k7u07b1a0wc"
|
||||
},
|
||||
"url": "http://localhost:3000/a/grafana-lokiexplore-app/explore/service/web_app_1/labels?patterns=%5B%5D&from=now-15m&to=now&var-ds=fe9k7u07b1a0wc&var-filters=service_name%7C%3D%7Cweb_app_1&var-fields=&var-levels=&var-metadata=&var-patterns=&var-lineFilterV2=&var-lineFilters=&urlColumns=%5B%5D&visualizationType=%22logs%22&displayedFields=%5B%5D&timezone=browser&var-all-fields=&var-labelBy=$__all",
|
||||
"id": "LABEL_BREAKDOWN_VALUES_detected_level",
|
||||
"title": "detected_level",
|
||||
"logoPath": "public/plugins/grafana-lokiexplore-app/img/img/logo.svg",
|
||||
"createdAt": "2025-02-13T11:31:23.637Z"
|
||||
}
|
||||
],
|
||||
"createdAt": "2025-02-13T11:31:23.636Z",
|
||||
"updatedAt": "2025-02-13T11:31:23.637Z",
|
||||
"viewMode": {
|
||||
"mode": "compact",
|
||||
"showComments": true,
|
||||
"showTooltips": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e9cf1958-d0ed-46b7-b597-9052c7648656",
|
||||
"title": "Thursday morning investigation",
|
||||
"hasCustomName": false,
|
||||
"isFavorite": false,
|
||||
"collectables": [
|
||||
{
|
||||
"origin": "Explore Logs",
|
||||
"type": "timeseries",
|
||||
"queries": [
|
||||
{
|
||||
"refId": "LABEL_BREAKDOWN_VALUES",
|
||||
"queryType": "range",
|
||||
"editorMode": "code",
|
||||
"supportingQueryType": "grafana-lokiexplore-app",
|
||||
"legendFormat": "{{detected_level}}",
|
||||
"expr": "sum(count_over_time({service_name=\"web_app_1\"} | detected_level != \"\"[$__auto])) by (detected_level)"
|
||||
}
|
||||
],
|
||||
"timeRange": {
|
||||
"to": "2025-02-13T11:31:20.536Z",
|
||||
"from": "2025-02-13T11:16:20.536Z",
|
||||
"raw": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
}
|
||||
},
|
||||
"datasource": {
|
||||
"uid": "fe9k7u07b1a0wc"
|
||||
},
|
||||
"url": "http://localhost:3000/a/grafana-lokiexplore-app/explore/service/web_app_1/labels?patterns=%5B%5D&from=now-15m&to=now&var-ds=fe9k7u07b1a0wc&var-filters=service_name%7C%3D%7Cweb_app_1&var-fields=&var-levels=&var-metadata=&var-patterns=&var-lineFilterV2=&var-lineFilters=&urlColumns=%5B%5D&visualizationType=%22logs%22&displayedFields=%5B%5D&timezone=browser&var-all-fields=&var-labelBy=$__all",
|
||||
"id": "LABEL_BREAKDOWN_VALUES_detected_level",
|
||||
"title": "detected_level",
|
||||
"logoPath": "public/plugins/grafana-lokiexplore-app/img/img/logo.svg",
|
||||
"createdAt": "2025-02-13T11:31:23.638Z"
|
||||
},
|
||||
{
|
||||
"origin": "Explore Logs",
|
||||
"type": "timeseries",
|
||||
"queries": [
|
||||
{
|
||||
"refId": "LABEL_BREAKDOWN_VALUES",
|
||||
"queryType": "range",
|
||||
"editorMode": "code",
|
||||
"supportingQueryType": "grafana-lokiexplore-app",
|
||||
"legendFormat": "{{service_name}}",
|
||||
"expr": "sum(count_over_time({service_name=\"web_app_1\",service_name != \"\"} [$__auto])) by (service_name)"
|
||||
}
|
||||
],
|
||||
"timeRange": {
|
||||
"to": "2025-02-13T11:31:20.536Z",
|
||||
"from": "2025-02-13T11:16:20.536Z",
|
||||
"raw": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
}
|
||||
},
|
||||
"datasource": {
|
||||
"uid": "fe9k7u07b1a0wc"
|
||||
},
|
||||
"url": "http://localhost:3000/a/grafana-lokiexplore-app/explore/service/web_app_1/labels?patterns=%5B%5D&from=now-15m&to=now&var-ds=fe9k7u07b1a0wc&var-filters=service_name%7C%3D%7Cweb_app_1&var-fields=&var-levels=&var-metadata=&var-patterns=&var-lineFilterV2=&var-lineFilters=&urlColumns=%5B%5D&visualizationType=%22logs%22&displayedFields=%5B%5D&timezone=browser&var-all-fields=&var-labelBy=$__all",
|
||||
"id": "LABEL_BREAKDOWN_VALUES_service_name",
|
||||
"title": "service_name",
|
||||
"logoPath": "public/plugins/grafana-lokiexplore-app/img/img/logo.svg",
|
||||
"createdAt": "2025-02-13T11:31:41.507Z"
|
||||
},
|
||||
{
|
||||
"origin": "Explore Logs",
|
||||
"type": "timeseries",
|
||||
"queries": [
|
||||
{
|
||||
"refId": "LABEL_BREAKDOWN_VALUES",
|
||||
"queryType": "range",
|
||||
"editorMode": "code",
|
||||
"supportingQueryType": "grafana-lokiexplore-app",
|
||||
"legendFormat": "{{service}}",
|
||||
"expr": "sum(count_over_time({service_name=\"web_app_1\",service != \"\"} [$__auto])) by (service)"
|
||||
}
|
||||
],
|
||||
"timeRange": {
|
||||
"to": "2025-02-13T11:31:20.536Z",
|
||||
"from": "2025-02-13T11:16:20.536Z",
|
||||
"raw": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
}
|
||||
},
|
||||
"datasource": {
|
||||
"uid": "fe9k7u07b1a0wc"
|
||||
},
|
||||
"url": "http://localhost:3000/a/grafana-lokiexplore-app/explore/service/web_app_1/labels?patterns=%5B%5D&from=now-15m&to=now&var-ds=fe9k7u07b1a0wc&var-filters=service_name%7C%3D%7Cweb_app_1&var-fields=&var-levels=&var-metadata=&var-patterns=&var-lineFilterV2=&var-lineFilters=&urlColumns=%5B%5D&visualizationType=%22logs%22&displayedFields=%5B%5D&timezone=browser&var-all-fields=&var-labelBy=$__all",
|
||||
"id": "LABEL_BREAKDOWN_VALUES_service",
|
||||
"title": "service",
|
||||
"logoPath": "public/plugins/grafana-lokiexplore-app/img/img/logo.svg",
|
||||
"createdAt": "2025-02-13T11:31:43.698Z"
|
||||
}
|
||||
],
|
||||
"createdAt": "2025-02-13T11:31:23.637Z",
|
||||
"updatedAt": "2025-02-13T11:31:43.698Z",
|
||||
"viewMode": {
|
||||
"mode": "compact",
|
||||
"showComments": true,
|
||||
"showTooltips": false
|
||||
}
|
||||
}
|
||||
]
|
@ -1,4 +1,4 @@
|
||||
module github.com/grafana/grafana/apps/investigation
|
||||
module github.com/grafana/grafana/apps/investigations
|
||||
|
||||
go 1.23.4
|
||||
|
51
apps/investigations/kinds/collectable.cue
Normal file
51
apps/investigations/kinds/collectable.cue
Normal file
@ -0,0 +1,51 @@
|
||||
package investigations
|
||||
|
||||
// Collectable represents an item collected during investigation
|
||||
#Collectable: {
|
||||
id: string
|
||||
createdAt: string
|
||||
|
||||
title: string
|
||||
origin: string
|
||||
type: string
|
||||
queries: [...#Query] // +listType=atomic
|
||||
timeRange: #TimeRange
|
||||
datasource: #DatasourceRef
|
||||
url: string
|
||||
logoPath?: string
|
||||
|
||||
note: string
|
||||
noteUpdatedAt: string
|
||||
}
|
||||
|
||||
#CollectableSummary: {
|
||||
id: string
|
||||
title: string
|
||||
logoPath: string
|
||||
origin: string
|
||||
}
|
||||
|
||||
// Query represents a data query
|
||||
#Query: {
|
||||
refId: string
|
||||
queryType: string
|
||||
editorMode: string
|
||||
supportingQueryType: string
|
||||
legendFormat: string
|
||||
expr: string
|
||||
}
|
||||
|
||||
// TimeRange represents a time range with both absolute and relative values
|
||||
#TimeRange: {
|
||||
from: string
|
||||
to: string
|
||||
raw: {
|
||||
from: string
|
||||
to: string
|
||||
}
|
||||
}
|
||||
|
||||
// DatasourceRef is a reference to a datasource
|
||||
#DatasourceRef: {
|
||||
uid: string
|
||||
}
|
1
apps/investigations/kinds/cue.mod/module.cue
Normal file
1
apps/investigations/kinds/cue.mod/module.cue
Normal file
@ -0,0 +1 @@
|
||||
module: "github.com/grafana/grafana/apps/investigations"
|
64
apps/investigations/kinds/investigation.cue
Normal file
64
apps/investigations/kinds/investigation.cue
Normal file
@ -0,0 +1,64 @@
|
||||
package investigations
|
||||
|
||||
// This is our Investigation definition, which contains metadata about the kind, and the kind's schema
|
||||
investigation: {
|
||||
kind: "Investigation"
|
||||
group: "investigations.grafana.app"
|
||||
apiResource: {
|
||||
groupOverride: "investigations.grafana.app"
|
||||
}
|
||||
pluralName: "Investigations"
|
||||
current: "v0alpha1"
|
||||
versions: {
|
||||
"v0alpha1": {
|
||||
codegen: {
|
||||
frontend: true
|
||||
backend: true
|
||||
options: {
|
||||
generateObjectMeta: true
|
||||
generateClient: true
|
||||
k8sLike: true
|
||||
package: "github.com/grafana/grafana/apps/investigations"
|
||||
}
|
||||
}
|
||||
schema: {
|
||||
// spec is the schema of our resource
|
||||
spec: {
|
||||
title: string
|
||||
createdByProfile: #Person
|
||||
hasCustomName: bool
|
||||
isFavorite: bool
|
||||
overviewNote: string
|
||||
overviewNoteUpdatedAt: string
|
||||
collectables: [...#Collectable] // +listType=atomic
|
||||
viewMode: #ViewMode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Type definition for investigation summaries
|
||||
#InvestigationSummary: {
|
||||
title: string
|
||||
createdByProfile: #Person
|
||||
hasCustomName: bool
|
||||
isFavorite: bool
|
||||
overviewNote: string
|
||||
overviewNoteUpdatedAt: string
|
||||
viewMode: #ViewMode
|
||||
collectableSummaries: [...#CollectableSummary] // +listType=atomic
|
||||
}
|
||||
|
||||
// Person represents a user profile with basic information
|
||||
#Person: {
|
||||
uid: string // Unique identifier for the user
|
||||
name: string // Display name of the user
|
||||
gravatarUrl: string // URL to user's Gravatar image
|
||||
}
|
||||
|
||||
#ViewMode: {
|
||||
mode: "compact" | "full"
|
||||
showComments: bool
|
||||
showTooltips: bool
|
||||
}
|
37
apps/investigations/kinds/investigationindex.cue
Normal file
37
apps/investigations/kinds/investigationindex.cue
Normal file
@ -0,0 +1,37 @@
|
||||
package investigations
|
||||
|
||||
investigationIndex: {
|
||||
kind: "InvestigationIndex"
|
||||
group: "investigations.grafana.app"
|
||||
apiResource: {
|
||||
groupOverride: "investigations.grafana.app"
|
||||
}
|
||||
pluralName: "InvestigationIndexes"
|
||||
current: "v0alpha1"
|
||||
versions: {
|
||||
"v0alpha1": {
|
||||
codegen: {
|
||||
frontend: true
|
||||
backend: true
|
||||
options: {
|
||||
generateObjectMeta: true
|
||||
generateClient: true
|
||||
k8sLike: true
|
||||
package: "github.com/grafana/grafana/apps/investigations"
|
||||
}
|
||||
}
|
||||
schema: {
|
||||
spec: {
|
||||
// Title of the index, e.g. 'Favorites' or 'My Investigations'
|
||||
title: string
|
||||
|
||||
// The Person who owns this investigation index
|
||||
owner: #Person
|
||||
|
||||
// Array of investigation summaries
|
||||
investigationSummaries: [...#InvestigationSummary] // +listType=atomic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
apps/investigations/kinds/manifest.cue
Normal file
10
apps/investigations/kinds/manifest.cue
Normal file
@ -0,0 +1,10 @@
|
||||
package investigations
|
||||
|
||||
manifest: {
|
||||
appName: "investigations"
|
||||
groupOverride: "investigations.grafana.app"
|
||||
kinds: [
|
||||
investigation,
|
||||
investigationIndex,
|
||||
]
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package v1alpha1
|
||||
package v0alpha1
|
||||
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
const (
|
||||
// Group is the API group used by all kinds in this package
|
||||
Group = "investigation.grafana.app"
|
||||
Group = "investigations.grafana.app"
|
||||
// Version is the API version used by all kinds in this package
|
||||
Version = "v1alpha1"
|
||||
Version = "v0alpha1"
|
||||
)
|
||||
|
||||
var (
|
@ -2,7 +2,7 @@
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v1alpha1
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
@ -1,6 +1,6 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
time "time"
|
@ -2,7 +2,7 @@
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v1alpha1
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -2,7 +2,7 @@
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v1alpha1
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
@ -10,7 +10,7 @@ import (
|
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var (
|
||||
schemaInvestigation = resource.NewSimpleSchema("investigation.grafana.app", "v1alpha1", &Investigation{}, &InvestigationList{}, resource.WithKind("Investigation"),
|
||||
schemaInvestigation = resource.NewSimpleSchema("investigations.grafana.app", "v0alpha1", &Investigation{}, &InvestigationList{}, resource.WithKind("Investigation"),
|
||||
resource.WithPlural("investigations"), resource.WithScope(resource.NamespacedScope))
|
||||
kindInvestigation = resource.Kind{
|
||||
Schema: schemaInvestigation,
|
@ -0,0 +1,140 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v0alpha1
|
||||
|
||||
// Person represents a user profile with basic information
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationPerson struct {
|
||||
// Unique identifier for the user
|
||||
Uid string `json:"uid"`
|
||||
// Display name of the user
|
||||
Name string `json:"name"`
|
||||
// URL to user's Gravatar image
|
||||
GravatarUrl string `json:"gravatarUrl"`
|
||||
}
|
||||
|
||||
// NewInvestigationPerson creates a new InvestigationPerson object.
|
||||
func NewInvestigationPerson() *InvestigationPerson {
|
||||
return &InvestigationPerson{}
|
||||
}
|
||||
|
||||
// Collectable represents an item collected during investigation
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationCollectable struct {
|
||||
Id string `json:"id"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
Title string `json:"title"`
|
||||
Origin string `json:"origin"`
|
||||
Type string `json:"type"`
|
||||
// +listType=atomic
|
||||
Queries []InvestigationQuery `json:"queries"`
|
||||
TimeRange InvestigationTimeRange `json:"timeRange"`
|
||||
Datasource InvestigationDatasourceRef `json:"datasource"`
|
||||
Url string `json:"url"`
|
||||
LogoPath *string `json:"logoPath,omitempty"`
|
||||
Note string `json:"note"`
|
||||
NoteUpdatedAt string `json:"noteUpdatedAt"`
|
||||
}
|
||||
|
||||
// NewInvestigationCollectable creates a new InvestigationCollectable object.
|
||||
func NewInvestigationCollectable() *InvestigationCollectable {
|
||||
return &InvestigationCollectable{
|
||||
TimeRange: *NewInvestigationTimeRange(),
|
||||
Datasource: *NewInvestigationDatasourceRef(),
|
||||
}
|
||||
}
|
||||
|
||||
// Query represents a data query
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationQuery struct {
|
||||
RefId string `json:"refId"`
|
||||
QueryType string `json:"queryType"`
|
||||
EditorMode string `json:"editorMode"`
|
||||
SupportingQueryType string `json:"supportingQueryType"`
|
||||
LegendFormat string `json:"legendFormat"`
|
||||
Expr string `json:"expr"`
|
||||
}
|
||||
|
||||
// NewInvestigationQuery creates a new InvestigationQuery object.
|
||||
func NewInvestigationQuery() *InvestigationQuery {
|
||||
return &InvestigationQuery{}
|
||||
}
|
||||
|
||||
// TimeRange represents a time range with both absolute and relative values
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationTimeRange struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
Raw InvestigationV0alpha1TimeRangeRaw `json:"raw"`
|
||||
}
|
||||
|
||||
// NewInvestigationTimeRange creates a new InvestigationTimeRange object.
|
||||
func NewInvestigationTimeRange() *InvestigationTimeRange {
|
||||
return &InvestigationTimeRange{
|
||||
Raw: *NewInvestigationV0alpha1TimeRangeRaw(),
|
||||
}
|
||||
}
|
||||
|
||||
// DatasourceRef is a reference to a datasource
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationDatasourceRef struct {
|
||||
Uid string `json:"uid"`
|
||||
}
|
||||
|
||||
// NewInvestigationDatasourceRef creates a new InvestigationDatasourceRef object.
|
||||
func NewInvestigationDatasourceRef() *InvestigationDatasourceRef {
|
||||
return &InvestigationDatasourceRef{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationViewMode struct {
|
||||
Mode InvestigationViewModeMode `json:"mode"`
|
||||
ShowComments bool `json:"showComments"`
|
||||
ShowTooltips bool `json:"showTooltips"`
|
||||
}
|
||||
|
||||
// NewInvestigationViewMode creates a new InvestigationViewMode object.
|
||||
func NewInvestigationViewMode() *InvestigationViewMode {
|
||||
return &InvestigationViewMode{}
|
||||
}
|
||||
|
||||
// spec is the schema of our resource
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationSpec struct {
|
||||
Title string `json:"title"`
|
||||
CreatedByProfile InvestigationPerson `json:"createdByProfile"`
|
||||
HasCustomName bool `json:"hasCustomName"`
|
||||
IsFavorite bool `json:"isFavorite"`
|
||||
OverviewNote string `json:"overviewNote"`
|
||||
OverviewNoteUpdatedAt string `json:"overviewNoteUpdatedAt"`
|
||||
// +listType=atomic
|
||||
Collectables []InvestigationCollectable `json:"collectables"`
|
||||
ViewMode InvestigationViewMode `json:"viewMode"`
|
||||
}
|
||||
|
||||
// NewInvestigationSpec creates a new InvestigationSpec object.
|
||||
func NewInvestigationSpec() *InvestigationSpec {
|
||||
return &InvestigationSpec{
|
||||
CreatedByProfile: *NewInvestigationPerson(),
|
||||
ViewMode: *NewInvestigationViewMode(),
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationV0alpha1TimeRangeRaw struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
}
|
||||
|
||||
// NewInvestigationV0alpha1TimeRangeRaw creates a new InvestigationV0alpha1TimeRangeRaw object.
|
||||
func NewInvestigationV0alpha1TimeRangeRaw() *InvestigationV0alpha1TimeRangeRaw {
|
||||
return &InvestigationV0alpha1TimeRangeRaw{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationViewModeMode string
|
||||
|
||||
const (
|
||||
InvestigationViewModeModeCompact InvestigationViewModeMode = "compact"
|
||||
InvestigationViewModeModeFull InvestigationViewModeMode = "full"
|
||||
)
|
@ -1,6 +1,6 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v0alpha1
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationstatusOperatorState struct {
|
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
)
|
||||
|
||||
// InvestigationIndexJSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type InvestigationIndexJSONCodec struct{}
|
||||
|
||||
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
|
||||
func (*InvestigationIndexJSONCodec) Read(reader io.Reader, into resource.Object) error {
|
||||
return json.NewDecoder(reader).Decode(into)
|
||||
}
|
||||
|
||||
// Write writes JSON-encoded bytes into `writer` marshaled from `from`
|
||||
func (*InvestigationIndexJSONCodec) Write(writer io.Writer, from resource.Object) error {
|
||||
return json.NewEncoder(writer).Encode(from)
|
||||
}
|
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Codec = &InvestigationIndexJSONCodec{}
|
@ -0,0 +1,28 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
)
|
||||
|
||||
// metadata contains embedded CommonMetadata and can be extended with custom string fields
|
||||
// TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
|
||||
// without external reference as using the CommonMetadata reference breaks thema codegen.
|
||||
type InvestigationIndexMetadata struct {
|
||||
UpdateTimestamp time.Time `json:"updateTimestamp"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
Uid string `json:"uid"`
|
||||
CreationTimestamp time.Time `json:"creationTimestamp"`
|
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
|
||||
Finalizers []string `json:"finalizers"`
|
||||
ResourceVersion string `json:"resourceVersion"`
|
||||
Generation int64 `json:"generation"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
}
|
||||
|
||||
// NewInvestigationIndexMetadata creates a new InvestigationIndexMetadata object.
|
||||
func NewInvestigationIndexMetadata() *InvestigationIndexMetadata {
|
||||
return &InvestigationIndexMetadata{}
|
||||
}
|
@ -0,0 +1,266 @@
|
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"time"
|
||||
)
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndex struct {
|
||||
metav1.TypeMeta `json:",inline" yaml:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata" yaml:"metadata"`
|
||||
Spec InvestigationIndexSpec `json:"spec" yaml:"spec"`
|
||||
InvestigationIndexStatus InvestigationIndexStatus `json:"status" yaml:"status"`
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) GetSpec() any {
|
||||
return o.Spec
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) SetSpec(spec any) error {
|
||||
cast, ok := spec.(InvestigationIndexSpec)
|
||||
if !ok {
|
||||
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec)
|
||||
}
|
||||
o.Spec = cast
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) GetSubresources() map[string]any {
|
||||
return map[string]any{
|
||||
"status": o.InvestigationIndexStatus,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) GetSubresource(name string) (any, bool) {
|
||||
switch name {
|
||||
case "status":
|
||||
return o.InvestigationIndexStatus, true
|
||||
default:
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) SetSubresource(name string, value any) error {
|
||||
switch name {
|
||||
case "status":
|
||||
cast, ok := value.(InvestigationIndexStatus)
|
||||
if !ok {
|
||||
return fmt.Errorf("cannot set status type %#v, not of type InvestigationIndexStatus", value)
|
||||
}
|
||||
o.InvestigationIndexStatus = cast
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("subresource '%s' does not exist", name)
|
||||
}
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) GetStaticMetadata() resource.StaticMetadata {
|
||||
gvk := o.GroupVersionKind()
|
||||
return resource.StaticMetadata{
|
||||
Name: o.ObjectMeta.Name,
|
||||
Namespace: o.ObjectMeta.Namespace,
|
||||
Group: gvk.Group,
|
||||
Version: gvk.Version,
|
||||
Kind: gvk.Kind,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) SetStaticMetadata(metadata resource.StaticMetadata) {
|
||||
o.Name = metadata.Name
|
||||
o.Namespace = metadata.Namespace
|
||||
o.SetGroupVersionKind(schema.GroupVersionKind{
|
||||
Group: metadata.Group,
|
||||
Version: metadata.Version,
|
||||
Kind: metadata.Kind,
|
||||
})
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) GetCommonMetadata() resource.CommonMetadata {
|
||||
dt := o.DeletionTimestamp
|
||||
var deletionTimestamp *time.Time
|
||||
if dt != nil {
|
||||
deletionTimestamp = &dt.Time
|
||||
}
|
||||
// Legacy ExtraFields support
|
||||
extraFields := make(map[string]any)
|
||||
if o.Annotations != nil {
|
||||
extraFields["annotations"] = o.Annotations
|
||||
}
|
||||
if o.ManagedFields != nil {
|
||||
extraFields["managedFields"] = o.ManagedFields
|
||||
}
|
||||
if o.OwnerReferences != nil {
|
||||
extraFields["ownerReferences"] = o.OwnerReferences
|
||||
}
|
||||
return resource.CommonMetadata{
|
||||
UID: string(o.UID),
|
||||
ResourceVersion: o.ResourceVersion,
|
||||
Generation: o.Generation,
|
||||
Labels: o.Labels,
|
||||
CreationTimestamp: o.CreationTimestamp.Time,
|
||||
DeletionTimestamp: deletionTimestamp,
|
||||
Finalizers: o.Finalizers,
|
||||
UpdateTimestamp: o.GetUpdateTimestamp(),
|
||||
CreatedBy: o.GetCreatedBy(),
|
||||
UpdatedBy: o.GetUpdatedBy(),
|
||||
ExtraFields: extraFields,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) SetCommonMetadata(metadata resource.CommonMetadata) {
|
||||
o.UID = types.UID(metadata.UID)
|
||||
o.ResourceVersion = metadata.ResourceVersion
|
||||
o.Generation = metadata.Generation
|
||||
o.Labels = metadata.Labels
|
||||
o.CreationTimestamp = metav1.NewTime(metadata.CreationTimestamp)
|
||||
if metadata.DeletionTimestamp != nil {
|
||||
dt := metav1.NewTime(*metadata.DeletionTimestamp)
|
||||
o.DeletionTimestamp = &dt
|
||||
} else {
|
||||
o.DeletionTimestamp = nil
|
||||
}
|
||||
o.Finalizers = metadata.Finalizers
|
||||
if o.Annotations == nil {
|
||||
o.Annotations = make(map[string]string)
|
||||
}
|
||||
if !metadata.UpdateTimestamp.IsZero() {
|
||||
o.SetUpdateTimestamp(metadata.UpdateTimestamp)
|
||||
}
|
||||
if metadata.CreatedBy != "" {
|
||||
o.SetCreatedBy(metadata.CreatedBy)
|
||||
}
|
||||
if metadata.UpdatedBy != "" {
|
||||
o.SetUpdatedBy(metadata.UpdatedBy)
|
||||
}
|
||||
// Legacy support for setting Annotations, ManagedFields, and OwnerReferences via ExtraFields
|
||||
if metadata.ExtraFields != nil {
|
||||
if annotations, ok := metadata.ExtraFields["annotations"]; ok {
|
||||
if cast, ok := annotations.(map[string]string); ok {
|
||||
o.Annotations = cast
|
||||
}
|
||||
}
|
||||
if managedFields, ok := metadata.ExtraFields["managedFields"]; ok {
|
||||
if cast, ok := managedFields.([]metav1.ManagedFieldsEntry); ok {
|
||||
o.ManagedFields = cast
|
||||
}
|
||||
}
|
||||
if ownerReferences, ok := metadata.ExtraFields["ownerReferences"]; ok {
|
||||
if cast, ok := ownerReferences.([]metav1.OwnerReference); ok {
|
||||
o.OwnerReferences = cast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) GetCreatedBy() string {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/createdBy"]
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) SetCreatedBy(createdBy string) {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) GetUpdateTimestamp() time.Time {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
parsed, _ := time.Parse(time.RFC3339, o.ObjectMeta.Annotations["grafana.com/updateTimestamp"])
|
||||
return parsed
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) SetUpdateTimestamp(updateTimestamp time.Time) {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updateTimestamp"] = updateTimestamp.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) GetUpdatedBy() string {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/updatedBy"]
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) SetUpdatedBy(updatedBy string) {
|
||||
if o.ObjectMeta.Annotations == nil {
|
||||
o.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) Copy() resource.Object {
|
||||
return resource.CopyObject(o)
|
||||
}
|
||||
|
||||
func (o *InvestigationIndex) DeepCopyObject() runtime.Object {
|
||||
return o.Copy()
|
||||
}
|
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.Object = &InvestigationIndex{}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexList struct {
|
||||
metav1.TypeMeta `json:",inline" yaml:",inline"`
|
||||
metav1.ListMeta `json:"metadata" yaml:"metadata"`
|
||||
Items []InvestigationIndex `json:"items" yaml:"items"`
|
||||
}
|
||||
|
||||
func (o *InvestigationIndexList) DeepCopyObject() runtime.Object {
|
||||
return o.Copy()
|
||||
}
|
||||
|
||||
func (o *InvestigationIndexList) Copy() resource.ListObject {
|
||||
cpy := &InvestigationIndexList{
|
||||
TypeMeta: o.TypeMeta,
|
||||
Items: make([]InvestigationIndex, len(o.Items)),
|
||||
}
|
||||
o.ListMeta.DeepCopyInto(&cpy.ListMeta)
|
||||
for i := 0; i < len(o.Items); i++ {
|
||||
if item, ok := o.Items[i].Copy().(*InvestigationIndex); ok {
|
||||
cpy.Items[i] = *item
|
||||
}
|
||||
}
|
||||
return cpy
|
||||
}
|
||||
|
||||
func (o *InvestigationIndexList) GetItems() []resource.Object {
|
||||
items := make([]resource.Object, len(o.Items))
|
||||
for i := 0; i < len(o.Items); i++ {
|
||||
items[i] = &o.Items[i]
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
func (o *InvestigationIndexList) SetItems(items []resource.Object) {
|
||||
o.Items = make([]InvestigationIndex, len(items))
|
||||
for i := 0; i < len(items); i++ {
|
||||
o.Items[i] = *items[i].(*InvestigationIndex)
|
||||
}
|
||||
}
|
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.ListObject = &InvestigationIndexList{}
|
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
)
|
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var (
|
||||
schemaInvestigationIndex = resource.NewSimpleSchema("investigations.grafana.app", "v0alpha1", &InvestigationIndex{}, &InvestigationIndexList{}, resource.WithKind("InvestigationIndex"),
|
||||
resource.WithPlural("investigationindexes"), resource.WithScope(resource.NamespacedScope))
|
||||
kindInvestigationIndex = resource.Kind{
|
||||
Schema: schemaInvestigationIndex,
|
||||
Codecs: map[resource.KindEncoding]resource.Codec{
|
||||
resource.KindEncodingJSON: &InvestigationIndexJSONCodec{},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func InvestigationIndexKind() resource.Kind {
|
||||
return kindInvestigationIndex
|
||||
}
|
||||
|
||||
// Schema returns a resource.SimpleSchema representation of InvestigationIndex
|
||||
func InvestigationIndexSchema() *resource.SimpleSchema {
|
||||
return schemaInvestigationIndex
|
||||
}
|
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindInvestigationIndex
|
@ -0,0 +1,92 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v0alpha1
|
||||
|
||||
// Person represents a user profile with basic information
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexPerson struct {
|
||||
// Unique identifier for the user
|
||||
Uid string `json:"uid"`
|
||||
// Display name of the user
|
||||
Name string `json:"name"`
|
||||
// URL to user's Gravatar image
|
||||
GravatarUrl string `json:"gravatarUrl"`
|
||||
}
|
||||
|
||||
// NewInvestigationIndexPerson creates a new InvestigationIndexPerson object.
|
||||
func NewInvestigationIndexPerson() *InvestigationIndexPerson {
|
||||
return &InvestigationIndexPerson{}
|
||||
}
|
||||
|
||||
// Type definition for investigation summaries
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexInvestigationSummary struct {
|
||||
Title string `json:"title"`
|
||||
CreatedByProfile InvestigationIndexPerson `json:"createdByProfile"`
|
||||
HasCustomName bool `json:"hasCustomName"`
|
||||
IsFavorite bool `json:"isFavorite"`
|
||||
OverviewNote string `json:"overviewNote"`
|
||||
OverviewNoteUpdatedAt string `json:"overviewNoteUpdatedAt"`
|
||||
ViewMode InvestigationIndexViewMode `json:"viewMode"`
|
||||
// +listType=atomic
|
||||
CollectableSummaries []InvestigationIndexCollectableSummary `json:"collectableSummaries"`
|
||||
}
|
||||
|
||||
// NewInvestigationIndexInvestigationSummary creates a new InvestigationIndexInvestigationSummary object.
|
||||
func NewInvestigationIndexInvestigationSummary() *InvestigationIndexInvestigationSummary {
|
||||
return &InvestigationIndexInvestigationSummary{
|
||||
CreatedByProfile: *NewInvestigationIndexPerson(),
|
||||
ViewMode: *NewInvestigationIndexViewMode(),
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexViewMode struct {
|
||||
Mode InvestigationIndexViewModeMode `json:"mode"`
|
||||
ShowComments bool `json:"showComments"`
|
||||
ShowTooltips bool `json:"showTooltips"`
|
||||
}
|
||||
|
||||
// NewInvestigationIndexViewMode creates a new InvestigationIndexViewMode object.
|
||||
func NewInvestigationIndexViewMode() *InvestigationIndexViewMode {
|
||||
return &InvestigationIndexViewMode{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexCollectableSummary struct {
|
||||
Id string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
LogoPath string `json:"logoPath"`
|
||||
Origin string `json:"origin"`
|
||||
}
|
||||
|
||||
// NewInvestigationIndexCollectableSummary creates a new InvestigationIndexCollectableSummary object.
|
||||
func NewInvestigationIndexCollectableSummary() *InvestigationIndexCollectableSummary {
|
||||
return &InvestigationIndexCollectableSummary{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexSpec struct {
|
||||
// Title of the index, e.g. 'Favorites' or 'My Investigations'
|
||||
Title string `json:"title"`
|
||||
// The Person who owns this investigation index
|
||||
Owner InvestigationIndexPerson `json:"owner"`
|
||||
// Array of investigation summaries
|
||||
// +listType=atomic
|
||||
InvestigationSummaries []InvestigationIndexInvestigationSummary `json:"investigationSummaries"`
|
||||
}
|
||||
|
||||
// NewInvestigationIndexSpec creates a new InvestigationIndexSpec object.
|
||||
func NewInvestigationIndexSpec() *InvestigationIndexSpec {
|
||||
return &InvestigationIndexSpec{
|
||||
Owner: *NewInvestigationIndexPerson(),
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexViewModeMode string
|
||||
|
||||
const (
|
||||
InvestigationIndexViewModeModeCompact InvestigationIndexViewModeMode = "compact"
|
||||
InvestigationIndexViewModeModeFull InvestigationIndexViewModeMode = "full"
|
||||
)
|
@ -0,0 +1,44 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v0alpha1
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexstatusOperatorState struct {
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"`
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State InvestigationIndexStatusOperatorStateState `json:"state"`
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"`
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"`
|
||||
}
|
||||
|
||||
// NewInvestigationIndexstatusOperatorState creates a new InvestigationIndexstatusOperatorState object.
|
||||
func NewInvestigationIndexstatusOperatorState() *InvestigationIndexstatusOperatorState {
|
||||
return &InvestigationIndexstatusOperatorState{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexStatus struct {
|
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
OperatorStates map[string]InvestigationIndexstatusOperatorState `json:"operatorStates,omitempty"`
|
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"`
|
||||
}
|
||||
|
||||
// NewInvestigationIndexStatus creates a new InvestigationIndexStatus object.
|
||||
func NewInvestigationIndexStatus() *InvestigationIndexStatus {
|
||||
return &InvestigationIndexStatus{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexStatusOperatorStateState string
|
||||
|
||||
const (
|
||||
InvestigationIndexStatusOperatorStateStateSuccess InvestigationIndexStatusOperatorStateState = "success"
|
||||
InvestigationIndexStatusOperatorStateStateInProgress InvestigationIndexStatusOperatorStateState = "in_progress"
|
||||
InvestigationIndexStatusOperatorStateStateFailed InvestigationIndexStatusOperatorStateState = "failed"
|
||||
)
|
File diff suppressed because it is too large
Load Diff
65
apps/investigations/pkg/apis/investigations_manifest.go
Normal file
65
apps/investigations/pkg/apis/investigations_manifest.go
Normal file
@ -0,0 +1,65 @@
|
||||
//
|
||||
// This file is generated by grafana-app-sdk
|
||||
// DO NOT EDIT
|
||||
//
|
||||
|
||||
package apis
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/app"
|
||||
)
|
||||
|
||||
var (
|
||||
rawSchemaInvestigationv0alpha1 = []byte(`{"spec":{"description":"spec is the schema of our resource","properties":{"collectables":{"items":{"properties":{"createdAt":{"type":"string"},"datasource":{"properties":{"uid":{"type":"string"}},"required":["uid"],"type":"object"},"id":{"type":"string"},"logoPath":{"type":"string"},"note":{"type":"string"},"noteUpdatedAt":{"type":"string"},"origin":{"type":"string"},"queries":{"items":{"properties":{"editorMode":{"type":"string"},"expr":{"type":"string"},"legendFormat":{"type":"string"},"queryType":{"type":"string"},"refId":{"type":"string"},"supportingQueryType":{"type":"string"}},"required":["refId","queryType","editorMode","supportingQueryType","legendFormat","expr"],"type":"object"},"type":"array"},"timeRange":{"properties":{"from":{"type":"string"},"raw":{"properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"type":"object"},"to":{"type":"string"}},"required":["from","to","raw"],"type":"object"},"title":{"type":"string"},"type":{"type":"string"},"url":{"type":"string"}},"required":["id","createdAt","title","origin","type","queries","timeRange","datasource","url","note","noteUpdatedAt"],"type":"object"},"type":"array"},"createdByProfile":{"properties":{"gravatarUrl":{"type":"string"},"name":{"type":"string"},"uid":{"type":"string"}},"required":["uid","name","gravatarUrl"],"type":"object"},"hasCustomName":{"type":"boolean"},"isFavorite":{"type":"boolean"},"overviewNote":{"type":"string"},"overviewNoteUpdatedAt":{"type":"string"},"title":{"type":"string"},"viewMode":{"properties":{"mode":{"enum":["compact","full"],"type":"string"},"showComments":{"type":"boolean"},"showTooltips":{"type":"boolean"}},"required":["mode","showComments","showTooltips"],"type":"object"}},"required":["title","createdByProfile","hasCustomName","isFavorite","overviewNote","overviewNoteUpdatedAt","collectables","viewMode"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`)
|
||||
versionSchemaInvestigationv0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaInvestigationv0alpha1, &versionSchemaInvestigationv0alpha1)
|
||||
rawSchemaInvestigationIndexv0alpha1 = []byte(`{"spec":{"properties":{"investigationSummaries":{"description":"Array of investigation summaries","items":{"properties":{"collectableSummaries":{"items":{"properties":{"id":{"type":"string"},"logoPath":{"type":"string"},"origin":{"type":"string"},"title":{"type":"string"}},"required":["id","title","logoPath","origin"],"type":"object"},"type":"array"},"createdByProfile":{"properties":{"gravatarUrl":{"type":"string"},"name":{"type":"string"},"uid":{"type":"string"}},"required":["uid","name","gravatarUrl"],"type":"object"},"hasCustomName":{"type":"boolean"},"isFavorite":{"type":"boolean"},"overviewNote":{"type":"string"},"overviewNoteUpdatedAt":{"type":"string"},"title":{"type":"string"},"viewMode":{"properties":{"mode":{"enum":["compact","full"],"type":"string"},"showComments":{"type":"boolean"},"showTooltips":{"type":"boolean"}},"required":["mode","showComments","showTooltips"],"type":"object"}},"required":["title","createdByProfile","hasCustomName","isFavorite","overviewNote","overviewNoteUpdatedAt","viewMode","collectableSummaries"],"type":"object"},"type":"array"},"owner":{"description":"The Person who owns this investigation index","properties":{"gravatarUrl":{"type":"string"},"name":{"type":"string"},"uid":{"type":"string"}},"required":["uid","name","gravatarUrl"],"type":"object"},"title":{"description":"Title of the index, e.g. 'Favorites' or 'My Investigations'","type":"string"}},"required":["title","owner","investigationSummaries"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`)
|
||||
versionSchemaInvestigationIndexv0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaInvestigationIndexv0alpha1, &versionSchemaInvestigationIndexv0alpha1)
|
||||
)
|
||||
|
||||
var appManifestData = app.ManifestData{
|
||||
AppName: "investigations",
|
||||
Group: "investigations.grafana.app",
|
||||
Kinds: []app.ManifestKind{
|
||||
{
|
||||
Kind: "Investigation",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Versions: []app.ManifestKindVersion{
|
||||
{
|
||||
Name: "v0alpha1",
|
||||
Schema: &versionSchemaInvestigationv0alpha1,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
Kind: "InvestigationIndex",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Versions: []app.ManifestKindVersion{
|
||||
{
|
||||
Name: "v0alpha1",
|
||||
Schema: &versionSchemaInvestigationIndexv0alpha1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func jsonToMap(j string) map[string]any {
|
||||
m := make(map[string]any)
|
||||
json.Unmarshal([]byte(j), &j)
|
||||
return m
|
||||
}
|
||||
|
||||
func LocalManifest() app.Manifest {
|
||||
return app.NewEmbeddedManifest(appManifestData)
|
||||
}
|
||||
|
||||
func RemoteManifest() app.Manifest {
|
||||
return app.NewAPIServerManifest("investigations")
|
||||
}
|
@ -9,7 +9,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
investigationv1alpha1 "github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1"
|
||||
investigationsv0alpha1 "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1"
|
||||
)
|
||||
|
||||
func New(cfg app.Config) (app.App, error) {
|
||||
@ -24,7 +24,10 @@ func New(cfg app.Config) (app.App, error) {
|
||||
},
|
||||
ManagedKinds: []simple.AppManagedKind{
|
||||
{
|
||||
Kind: investigationv1alpha1.InvestigationKind(),
|
||||
Kind: investigationsv0alpha1.InvestigationKind(),
|
||||
},
|
||||
{
|
||||
Kind: investigationsv0alpha1.InvestigationIndexKind(),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -44,10 +47,13 @@ func New(cfg app.Config) (app.App, error) {
|
||||
|
||||
func GetKinds() map[schema.GroupVersion][]resource.Kind {
|
||||
gv := schema.GroupVersion{
|
||||
Group: investigationv1alpha1.InvestigationKind().Group(),
|
||||
Version: investigationv1alpha1.InvestigationKind().Version(),
|
||||
Group: investigationsv0alpha1.InvestigationKind().Group(),
|
||||
Version: investigationsv0alpha1.InvestigationKind().Version(),
|
||||
}
|
||||
return map[schema.GroupVersion][]resource.Kind{
|
||||
gv: {investigationv1alpha1.InvestigationKind()},
|
||||
gv: {
|
||||
investigationsv0alpha1.InvestigationKind(),
|
||||
investigationsv0alpha1.InvestigationIndexKind(),
|
||||
},
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file was generated by grafana-app-sdk. DO NOT EDIT.
|
||||
*/
|
||||
import { Spec } from './types.spec.gen';
|
||||
import { Status } from './types.status.gen';
|
||||
|
||||
export interface Metadata {
|
||||
name: string;
|
||||
namespace: string;
|
||||
generateName?: string;
|
||||
selfLink?: string;
|
||||
uid?: string;
|
||||
resourceVersion?: string;
|
||||
generation?: number;
|
||||
creationTimestamp?: string;
|
||||
deletionTimestamp?: string;
|
||||
deletionGracePeriodSeconds?: number;
|
||||
labels?: Record<string, string>;
|
||||
annotations?: Record<string, string>;
|
||||
ownerReferences?: OwnerReference[];
|
||||
finalizers?: string[];
|
||||
managedFields?: ManagedFieldsEntry[];
|
||||
}
|
||||
|
||||
export interface OwnerReference {
|
||||
apiVersion: string;
|
||||
kind: string;
|
||||
name: string;
|
||||
uid: string;
|
||||
controller?: boolean;
|
||||
blockOwnerDeletion?: boolean;
|
||||
}
|
||||
|
||||
export interface ManagedFieldsEntry {
|
||||
manager?: string;
|
||||
operation?: string;
|
||||
apiVersion?: string;
|
||||
time?: string;
|
||||
fieldsType?: string;
|
||||
subresource?: string;
|
||||
}
|
||||
|
||||
export interface Investigation {
|
||||
kind: string;
|
||||
apiVersion: string;
|
||||
metadata: Metadata;
|
||||
spec: Spec;
|
||||
status: Status;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// metadata contains embedded CommonMetadata and can be extended with custom string fields
|
||||
// TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
|
||||
// without external reference as using the CommonMetadata reference breaks thema codegen.
|
||||
export interface Metadata {
|
||||
updateTimestamp: string;
|
||||
createdBy: string;
|
||||
uid: string;
|
||||
creationTimestamp: string;
|
||||
deletionTimestamp?: string;
|
||||
finalizers: string[];
|
||||
resourceVersion: string;
|
||||
generation: number;
|
||||
updatedBy: string;
|
||||
labels: Record<string, string>;
|
||||
}
|
||||
|
||||
export const defaultMetadata = (): Metadata => ({
|
||||
updateTimestamp: "",
|
||||
createdBy: "",
|
||||
uid: "",
|
||||
creationTimestamp: "",
|
||||
finalizers: [],
|
||||
resourceVersion: "",
|
||||
generation: 0,
|
||||
updatedBy: "",
|
||||
labels: {},
|
||||
});
|
||||
|
@ -0,0 +1,132 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// Person represents a user profile with basic information
|
||||
export interface Person {
|
||||
// Unique identifier for the user
|
||||
uid: string;
|
||||
// Display name of the user
|
||||
name: string;
|
||||
// URL to user's Gravatar image
|
||||
gravatarUrl: string;
|
||||
}
|
||||
|
||||
export const defaultPerson = (): Person => ({
|
||||
uid: "",
|
||||
name: "",
|
||||
gravatarUrl: "",
|
||||
});
|
||||
|
||||
// Collectable represents an item collected during investigation
|
||||
export interface Collectable {
|
||||
id: string;
|
||||
createdAt: string;
|
||||
title: string;
|
||||
origin: string;
|
||||
type: string;
|
||||
// +listType=atomic
|
||||
queries: Query[];
|
||||
timeRange: TimeRange;
|
||||
datasource: DatasourceRef;
|
||||
url: string;
|
||||
logoPath?: string;
|
||||
note: string;
|
||||
noteUpdatedAt: string;
|
||||
}
|
||||
|
||||
export const defaultCollectable = (): Collectable => ({
|
||||
id: "",
|
||||
createdAt: "",
|
||||
title: "",
|
||||
origin: "",
|
||||
type: "",
|
||||
queries: [],
|
||||
timeRange: defaultTimeRange(),
|
||||
datasource: defaultDatasourceRef(),
|
||||
url: "",
|
||||
note: "",
|
||||
noteUpdatedAt: "",
|
||||
});
|
||||
|
||||
// Query represents a data query
|
||||
export interface Query {
|
||||
refId: string;
|
||||
queryType: string;
|
||||
editorMode: string;
|
||||
supportingQueryType: string;
|
||||
legendFormat: string;
|
||||
expr: string;
|
||||
}
|
||||
|
||||
export const defaultQuery = (): Query => ({
|
||||
refId: "",
|
||||
queryType: "",
|
||||
editorMode: "",
|
||||
supportingQueryType: "",
|
||||
legendFormat: "",
|
||||
expr: "",
|
||||
});
|
||||
|
||||
// TimeRange represents a time range with both absolute and relative values
|
||||
export interface TimeRange {
|
||||
from: string;
|
||||
to: string;
|
||||
raw: {
|
||||
from: string;
|
||||
to: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const defaultTimeRange = (): TimeRange => ({
|
||||
from: "",
|
||||
to: "",
|
||||
raw: {
|
||||
from: "",
|
||||
to: "",
|
||||
},
|
||||
});
|
||||
|
||||
// DatasourceRef is a reference to a datasource
|
||||
export interface DatasourceRef {
|
||||
uid: string;
|
||||
}
|
||||
|
||||
export const defaultDatasourceRef = (): DatasourceRef => ({
|
||||
uid: "",
|
||||
});
|
||||
|
||||
export interface ViewMode {
|
||||
mode: "compact" | "full";
|
||||
showComments: boolean;
|
||||
showTooltips: boolean;
|
||||
}
|
||||
|
||||
export const defaultViewMode = (): ViewMode => ({
|
||||
mode: "compact",
|
||||
showComments: false,
|
||||
showTooltips: false,
|
||||
});
|
||||
|
||||
// spec is the schema of our resource
|
||||
export interface Spec {
|
||||
title: string;
|
||||
createdByProfile: Person;
|
||||
hasCustomName: boolean;
|
||||
isFavorite: boolean;
|
||||
overviewNote: string;
|
||||
overviewNoteUpdatedAt: string;
|
||||
// +listType=atomic
|
||||
collectables: Collectable[];
|
||||
viewMode: ViewMode;
|
||||
}
|
||||
|
||||
export const defaultSpec = (): Spec => ({
|
||||
title: "",
|
||||
createdByProfile: defaultPerson(),
|
||||
hasCustomName: false,
|
||||
isFavorite: false,
|
||||
overviewNote: "",
|
||||
overviewNoteUpdatedAt: "",
|
||||
collectables: [],
|
||||
viewMode: defaultViewMode(),
|
||||
});
|
||||
|
@ -0,0 +1,30 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
export interface OperatorState {
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
lastEvaluation: string;
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
state: "success" | "in_progress" | "failed";
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
descriptiveState?: string;
|
||||
// details contains any extra information that is operator-specific
|
||||
details?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const defaultOperatorState = (): OperatorState => ({
|
||||
lastEvaluation: "",
|
||||
state: "success",
|
||||
});
|
||||
|
||||
export interface Status {
|
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
operatorStates?: Record<string, OperatorState>;
|
||||
// additionalFields is reserved for future use
|
||||
additionalFields?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const defaultStatus = (): Status => ({
|
||||
});
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file was generated by grafana-app-sdk. DO NOT EDIT.
|
||||
*/
|
||||
import { Spec } from './types.spec.gen';
|
||||
import { Status } from './types.status.gen';
|
||||
|
||||
export interface Metadata {
|
||||
name: string;
|
||||
namespace: string;
|
||||
generateName?: string;
|
||||
selfLink?: string;
|
||||
uid?: string;
|
||||
resourceVersion?: string;
|
||||
generation?: number;
|
||||
creationTimestamp?: string;
|
||||
deletionTimestamp?: string;
|
||||
deletionGracePeriodSeconds?: number;
|
||||
labels?: Record<string, string>;
|
||||
annotations?: Record<string, string>;
|
||||
ownerReferences?: OwnerReference[];
|
||||
finalizers?: string[];
|
||||
managedFields?: ManagedFieldsEntry[];
|
||||
}
|
||||
|
||||
export interface OwnerReference {
|
||||
apiVersion: string;
|
||||
kind: string;
|
||||
name: string;
|
||||
uid: string;
|
||||
controller?: boolean;
|
||||
blockOwnerDeletion?: boolean;
|
||||
}
|
||||
|
||||
export interface ManagedFieldsEntry {
|
||||
manager?: string;
|
||||
operation?: string;
|
||||
apiVersion?: string;
|
||||
time?: string;
|
||||
fieldsType?: string;
|
||||
subresource?: string;
|
||||
}
|
||||
|
||||
export interface InvestigationIndex {
|
||||
kind: string;
|
||||
apiVersion: string;
|
||||
metadata: Metadata;
|
||||
spec: Spec;
|
||||
status: Status;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// metadata contains embedded CommonMetadata and can be extended with custom string fields
|
||||
// TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
|
||||
// without external reference as using the CommonMetadata reference breaks thema codegen.
|
||||
export interface Metadata {
|
||||
updateTimestamp: string;
|
||||
createdBy: string;
|
||||
uid: string;
|
||||
creationTimestamp: string;
|
||||
deletionTimestamp?: string;
|
||||
finalizers: string[];
|
||||
resourceVersion: string;
|
||||
generation: number;
|
||||
updatedBy: string;
|
||||
labels: Record<string, string>;
|
||||
}
|
||||
|
||||
export const defaultMetadata = (): Metadata => ({
|
||||
updateTimestamp: "",
|
||||
createdBy: "",
|
||||
uid: "",
|
||||
creationTimestamp: "",
|
||||
finalizers: [],
|
||||
resourceVersion: "",
|
||||
generation: 0,
|
||||
updatedBy: "",
|
||||
labels: {},
|
||||
});
|
||||
|
@ -0,0 +1,84 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// Person represents a user profile with basic information
|
||||
export interface Person {
|
||||
// Unique identifier for the user
|
||||
uid: string;
|
||||
// Display name of the user
|
||||
name: string;
|
||||
// URL to user's Gravatar image
|
||||
gravatarUrl: string;
|
||||
}
|
||||
|
||||
export const defaultPerson = (): Person => ({
|
||||
uid: "",
|
||||
name: "",
|
||||
gravatarUrl: "",
|
||||
});
|
||||
|
||||
// Type definition for investigation summaries
|
||||
export interface InvestigationSummary {
|
||||
title: string;
|
||||
createdByProfile: Person;
|
||||
hasCustomName: boolean;
|
||||
isFavorite: boolean;
|
||||
overviewNote: string;
|
||||
overviewNoteUpdatedAt: string;
|
||||
viewMode: ViewMode;
|
||||
// +listType=atomic
|
||||
collectableSummaries: CollectableSummary[];
|
||||
}
|
||||
|
||||
export const defaultInvestigationSummary = (): InvestigationSummary => ({
|
||||
title: "",
|
||||
createdByProfile: defaultPerson(),
|
||||
hasCustomName: false,
|
||||
isFavorite: false,
|
||||
overviewNote: "",
|
||||
overviewNoteUpdatedAt: "",
|
||||
viewMode: defaultViewMode(),
|
||||
collectableSummaries: [],
|
||||
});
|
||||
|
||||
export interface ViewMode {
|
||||
mode: "compact" | "full";
|
||||
showComments: boolean;
|
||||
showTooltips: boolean;
|
||||
}
|
||||
|
||||
export const defaultViewMode = (): ViewMode => ({
|
||||
mode: "compact",
|
||||
showComments: false,
|
||||
showTooltips: false,
|
||||
});
|
||||
|
||||
export interface CollectableSummary {
|
||||
id: string;
|
||||
title: string;
|
||||
logoPath: string;
|
||||
origin: string;
|
||||
}
|
||||
|
||||
export const defaultCollectableSummary = (): CollectableSummary => ({
|
||||
id: "",
|
||||
title: "",
|
||||
logoPath: "",
|
||||
origin: "",
|
||||
});
|
||||
|
||||
export interface Spec {
|
||||
// Title of the index, e.g. 'Favorites' or 'My Investigations'
|
||||
title: string;
|
||||
// The Person who owns this investigation index
|
||||
owner: Person;
|
||||
// Array of investigation summaries
|
||||
// +listType=atomic
|
||||
investigationSummaries: InvestigationSummary[];
|
||||
}
|
||||
|
||||
export const defaultSpec = (): Spec => ({
|
||||
title: "",
|
||||
owner: defaultPerson(),
|
||||
investigationSummaries: [],
|
||||
});
|
||||
|
@ -0,0 +1,30 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
export interface OperatorState {
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
lastEvaluation: string;
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
state: "success" | "in_progress" | "failed";
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
descriptiveState?: string;
|
||||
// details contains any extra information that is operator-specific
|
||||
details?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const defaultOperatorState = (): OperatorState => ({
|
||||
lastEvaluation: "",
|
||||
state: "success",
|
||||
});
|
||||
|
||||
export interface Status {
|
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
operatorStates?: Record<string, OperatorState>;
|
||||
// additionalFields is reserved for future use
|
||||
additionalFields?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const defaultStatus = (): Status => ({
|
||||
});
|
||||
|
1
go.mod
1
go.mod
@ -202,7 +202,6 @@ require (
|
||||
require (
|
||||
github.com/grafana/grafana/apps/advisor v0.0.0-20250123151950-b066a6313173 // @grafana/plugins-platform-backend
|
||||
github.com/grafana/grafana/apps/alerting/notifications v0.0.0-20250121113133-e747350fee2d // @grafana/alerting-backend
|
||||
github.com/grafana/grafana/apps/investigation v0.0.0-20250121113133-e747350fee2d // @fcjack @matryer
|
||||
github.com/grafana/grafana/apps/playlist v0.0.0-20250121113133-e747350fee2d // @grafana/grafana-app-platform-squad
|
||||
github.com/grafana/grafana/pkg/aggregator v0.0.0-20250121113133-e747350fee2d // @grafana/grafana-app-platform-squad
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250121113133-e747350fee2d // @grafana/grafana-app-platform-squad
|
||||
|
2
go.sum
2
go.sum
@ -1551,8 +1551,6 @@ github.com/grafana/grafana/apps/advisor v0.0.0-20250123151950-b066a6313173 h1:uO
|
||||
github.com/grafana/grafana/apps/advisor v0.0.0-20250123151950-b066a6313173/go.mod h1:goSDiy3jtC2cp8wjpPZdUHRENcoSUHae1/Px/MDfddA=
|
||||
github.com/grafana/grafana/apps/alerting/notifications v0.0.0-20250121113133-e747350fee2d h1:NRVOtiG1aUwOazBj9KM7X2o2shsM6TchqisezzoH1gw=
|
||||
github.com/grafana/grafana/apps/alerting/notifications v0.0.0-20250121113133-e747350fee2d/go.mod h1:AvleS6icyPmcBjihtx5jYEvdzLmHGBp66NuE0AMR57A=
|
||||
github.com/grafana/grafana/apps/investigation v0.0.0-20250121113133-e747350fee2d h1:oNc/aDfDucQxLbRZK25yz3Cwc+dGo1C0Xmm2LaliWUQ=
|
||||
github.com/grafana/grafana/apps/investigation v0.0.0-20250121113133-e747350fee2d/go.mod h1:HQprw3MmiYj5OUV9CZnkwA1FKDZBmYACuAB3oDvUOmI=
|
||||
github.com/grafana/grafana/apps/playlist v0.0.0-20250121113133-e747350fee2d h1:cJ+9jgHw8Z17rM+DCdxvyWxPqH9OB9fkPLbnWEO+QGg=
|
||||
github.com/grafana/grafana/apps/playlist v0.0.0-20250121113133-e747350fee2d/go.mod h1:DjJe5osrW/BKrzN9hAAOSElNWutj1bcriExa7iDP7kA=
|
||||
github.com/grafana/grafana/pkg/aggregator v0.0.0-20250121113133-e747350fee2d h1:aBD5kzsIAh50vjNqUkWK9mNpLGIBYAnKkWtUepGNAiQ=
|
||||
|
2
go.work
2
go.work
@ -7,7 +7,7 @@ use (
|
||||
. // skip:golangci-lint
|
||||
./apps/advisor
|
||||
./apps/alerting/notifications
|
||||
./apps/investigation
|
||||
./apps/investigations
|
||||
./apps/playlist
|
||||
./pkg/aggregator
|
||||
./pkg/apimachinery
|
||||
|
@ -1550,14 +1550,20 @@ github.com/grafana/authlib v0.0.0-20250120145936-5f0e28e7a87c/go.mod h1:/gYfphsN
|
||||
github.com/grafana/authlib/types v0.0.0-20250120144156-d6737a7dc8f5/go.mod h1:qYjSd1tmJiuVoSICp7Py9/zD54O9uQQA3wuM6Gg4DFM=
|
||||
github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 h1:qhugDMdQ4Vp68H0tp/0iN17DM2ehRo1rLEdOFe/gB8I=
|
||||
github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2/go.mod h1:w/aiO1POVIeXUQyl0VQSZjl5OAGDTL5aX+4v0RA1tcw=
|
||||
github.com/grafana/cog v0.0.23 h1:/0CCJ24Z8XXM2DnboSd2FzoIswUroqIZzVr8oJWmMQs=
|
||||
github.com/grafana/cog v0.0.23/go.mod h1:jrS9indvWuDs60RHEZpLaAkmZdgyoLKMOEUT0jiB1t0=
|
||||
github.com/grafana/go-gelf/v2 v2.0.1 h1:BOChP0h/jLeD+7F9mL7tq10xVkDG15he3T1zHuQaWak=
|
||||
github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD4s0CLobh90=
|
||||
github.com/grafana/grafana-app-sdk v0.29.0/go.mod h1:XLt308EmK6kvqPlzjUyXxbwZKEk2vur/eiypUNDay5I=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.31.1/go.mod h1:n1PIV2bImMAgjfJsRC5rLZQP0mpAOouG7iQ4idedJgk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.32.0 h1:mflGs4nEN/yUUl/lwyJck2XdBdcCN5DrYaU50tWLRLk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.32.0/go.mod h1:n1PIV2bImMAgjfJsRC5rLZQP0mpAOouG7iQ4idedJgk=
|
||||
github.com/grafana/grafana-azure-sdk-go/v2 v2.1.5/go.mod h1:i0uiuu9/sMFBJnpFbjvviH0KOZzdWkti9Q9Ck1HkFWM=
|
||||
github.com/grafana/grafana-plugin-sdk-go v0.262.0/go.mod h1:U43Cnrj/9DNYyvFcNdeUWNjMXTKNB0jcTcQGpWKd2gw=
|
||||
github.com/grafana/grafana-plugin-sdk-go v0.266.0 h1:YP+iEpXH3HRX9Xo4NHjsrJhN2W7uVTtkLNzMHYbmiLI=
|
||||
github.com/grafana/grafana-plugin-sdk-go v0.266.0/go.mod h1:bxkXrBQ4QSmOncsWdIOcpgP+M6wajQNMAPXlbWrqAWY=
|
||||
github.com/grafana/grafana/apps/advisor v0.0.0-20250121115006-c1eac9f9973f/go.mod h1:goSDiy3jtC2cp8wjpPZdUHRENcoSUHae1/Px/MDfddA=
|
||||
github.com/grafana/grafana/apps/investigation v0.0.0-20250121113133-e747350fee2d/go.mod h1:HQprw3MmiYj5OUV9CZnkwA1FKDZBmYACuAB3oDvUOmI=
|
||||
github.com/grafana/grafana/pkg/promlib v0.0.7/go.mod h1:rnwJXCA2xRwb7F27NB35iO/JsLL/H/+eVXECk/hrEhQ=
|
||||
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A=
|
||||
github.com/grafana/tail v0.0.0-20230510142333-77b18831edf0 h1:bjh0PVYSVVFxzINqPFYJmAmJNrWPgnVjuSdYJGHmtFU=
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/registry"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/advisor"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/investigation"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/investigations"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/playlist"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/builder"
|
||||
@ -31,7 +31,7 @@ func ProvideRegistryServiceSink(
|
||||
restConfigProvider apiserver.RestConfigProvider,
|
||||
features featuremgmt.FeatureToggles,
|
||||
playlistAppProvider *playlist.PlaylistAppProvider,
|
||||
investigationAppProvider *investigation.InvestigationAppProvider,
|
||||
investigationAppProvider *investigations.InvestigationsAppProvider,
|
||||
advisorAppProvider *advisor.AdvisorAppProvider,
|
||||
) (*Service, error) {
|
||||
cfgWrapper := func(ctx context.Context) *rest.Config {
|
||||
@ -47,11 +47,12 @@ func ProvideRegistryServiceSink(
|
||||
RestConfigGetter: cfgWrapper,
|
||||
APIRegistrar: registrar,
|
||||
}
|
||||
|
||||
logger := log.New("app-registry")
|
||||
var apiGroupRunner *runner.APIGroupRunner
|
||||
var err error
|
||||
providers := []app.Provider{playlistAppProvider}
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagInvestigationsBackend) {
|
||||
logger.Debug("Investigations backend is enabled")
|
||||
providers = append(providers, investigationAppProvider)
|
||||
}
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagGrafanaAdvisor) {
|
||||
@ -62,7 +63,7 @@ func ProvideRegistryServiceSink(
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Service{runner: apiGroupRunner, log: log.New("app-registry")}, nil
|
||||
return &Service{runner: apiGroupRunner, log: logger}, nil
|
||||
}
|
||||
|
||||
func (s *Service) Run(ctx context.Context) error {
|
||||
|
@ -1,28 +1,28 @@
|
||||
package investigation
|
||||
package investigations
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana-app-sdk/app"
|
||||
"github.com/grafana/grafana-app-sdk/simple"
|
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis"
|
||||
investigationv1alpha1 "github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1"
|
||||
investigationapp "github.com/grafana/grafana/apps/investigation/pkg/app"
|
||||
"github.com/grafana/grafana/apps/investigations/pkg/apis"
|
||||
investigationv0alpha1 "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1"
|
||||
investigationapp "github.com/grafana/grafana/apps/investigations/pkg/app"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/builder/runner"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
type InvestigationAppProvider struct {
|
||||
type InvestigationsAppProvider struct {
|
||||
app.Provider
|
||||
cfg *setting.Cfg
|
||||
}
|
||||
|
||||
func RegisterApp(
|
||||
cfg *setting.Cfg,
|
||||
) *InvestigationAppProvider {
|
||||
provider := &InvestigationAppProvider{
|
||||
) *InvestigationsAppProvider {
|
||||
provider := &InvestigationsAppProvider{
|
||||
cfg: cfg,
|
||||
}
|
||||
appCfg := &runner.AppBuilderConfig{
|
||||
OpenAPIDefGetter: investigationv1alpha1.GetOpenAPIDefinitions,
|
||||
OpenAPIDefGetter: investigationv0alpha1.GetOpenAPIDefinitions,
|
||||
ManagedKinds: investigationapp.GetKinds(),
|
||||
}
|
||||
provider.Provider = simple.NewAppProvider(apis.LocalManifest(), appCfg, investigationapp.New)
|
@ -5,14 +5,14 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/apps/advisor/pkg/app/checkregistry"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/advisor"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/investigation"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/investigations"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/playlist"
|
||||
)
|
||||
|
||||
var WireSet = wire.NewSet(
|
||||
ProvideRegistryServiceSink,
|
||||
playlist.RegisterApp,
|
||||
investigation.RegisterApp,
|
||||
investigations.RegisterApp,
|
||||
advisor.RegisterApp,
|
||||
checkregistry.ProvideService,
|
||||
wire.Bind(new(checkregistry.CheckService), new(*checkregistry.Service)),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -31,6 +31,7 @@ func TestIntegrationOpenAPIs(t *testing.T) {
|
||||
featuremgmt.FlagKubernetesFoldersServiceV2, // Will be default on by G12
|
||||
featuremgmt.FlagQueryService, // Query Library
|
||||
featuremgmt.FlagProvisioning,
|
||||
featuremgmt.FlagInvestigationsBackend,
|
||||
},
|
||||
})
|
||||
|
||||
@ -70,6 +71,9 @@ func TestIntegrationOpenAPIs(t *testing.T) {
|
||||
}, {
|
||||
Group: "provisioning.grafana.app",
|
||||
Version: "v0alpha1",
|
||||
}, {
|
||||
Group: "investigations.grafana.app",
|
||||
Version: "v0alpha1",
|
||||
}}
|
||||
for _, gv := range groups {
|
||||
VerifyOpenAPISnapshots(t, dir, gv, h)
|
||||
|
Reference in New Issue
Block a user