Skip to content

Commit

Permalink
Merge branch 'main' into remove-DestinationPool-from-OffRampTokens
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR authored Jun 18, 2024
2 parents 529cd51 + 2867080 commit ab0464c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion observability-lib/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var DeployCmd = &cobra.Command{
case "core-node":
builder, err = corenode.BuildDashboard(name, dataSourcesType.Metrics, platform)
case "core-node-components":
builder, err = corenodecomponents.BuildDashboard(name, dataSourcesType.Metrics)
builder, err = corenodecomponents.BuildDashboard(name, dataSourcesType.Metrics, dataSourcesType.Logs)
case "core-node-resources":
builder, err = k8sresources.BuildDashboard(name, dataSourcesType.Metrics, dataSourcesType.Logs)
case "ocr":
Expand Down
2 changes: 1 addition & 1 deletion observability-lib/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var GenerateCmd = &cobra.Command{
case "core-node":
builder, err = corenode.BuildDashboard(name, dataSourcesType.Metrics, platform)
case "core-node-components":
builder, err = corenodecomponents.BuildDashboard(name, dataSourcesType.Metrics)
builder, err = corenodecomponents.BuildDashboard(name, dataSourcesType.Metrics, dataSourcesType.Logs)
case "core-node-resources":
builder, err = k8sresources.BuildDashboard(name, dataSourcesType.Metrics, dataSourcesType.Logs)
case "ocr":
Expand Down
15 changes: 14 additions & 1 deletion observability-lib/core-node-components/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"github.com/smartcontractkit/chainlink-common/observability-lib/utils"
)

func BuildDashboard(name string, dataSourceMetric string) (dashboard.Dashboard, error) {
func BuildDashboard(name string, dataSourceMetric string, dataSourceLog string) (dashboard.Dashboard, error) {
props := Props{
MetricsDataSource: dataSourceMetric,
LogsDataSource: dataSourceLog,
PlatformOpts: PlatformPanelOpts(),
}

Expand Down Expand Up @@ -140,5 +141,17 @@ func panelsGeneralInfo(p Props) []cog.Builder[dashboard.Panel] {
},
).Min(0).Max(100))

panelsArray = append(panelsArray, utils.LogPanel(
p.LogsDataSource,
"Logs with severity >= error",
"",
6,
24,
utils.PrometheusQuery{
Query: `{env="${env}", cluster="${cluster}", product="${product}", network_type="${network_type}", instance=~"${service}"} | json | level=~"(error|panic|fatal|crit)"`,
Legend: "",
},
))

return panelsArray
}
1 change: 1 addition & 0 deletions observability-lib/core-node-components/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type PlatformOpts struct {

type Props struct {
MetricsDataSource string
LogsDataSource string
PlatformOpts PlatformOpts
}

Expand Down
23 changes: 23 additions & 0 deletions observability-lib/utils/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/grafana/grafana-foundation-sdk/go/common"
"github.com/grafana/grafana-foundation-sdk/go/dashboard"
"github.com/grafana/grafana-foundation-sdk/go/gauge"
"github.com/grafana/grafana-foundation-sdk/go/logs"
"github.com/grafana/grafana-foundation-sdk/go/prometheus"
"github.com/grafana/grafana-foundation-sdk/go/stat"
"github.com/grafana/grafana-foundation-sdk/go/table"
Expand Down Expand Up @@ -189,3 +190,25 @@ func TablePanel(

return panel
}

func LogPanel(
datasource string,
title string,
description string,
height uint32,
span uint32,
query ...PrometheusQuery,
) *logs.PanelBuilder {
panel := logs.NewPanelBuilder().
Datasource(datasourceRef(datasource)).
Height(height).
Span(span).
Title(title).
Description(description)

for _, q := range query {
panel.WithTarget(prometheusQuery(q.Query, q.Legend))
}

return panel
}

0 comments on commit ab0464c

Please sign in to comment.