Skip to content

Commit d5bfbe3

Browse files
committed
set all URLs to 15m/5s refresh, fix shadowed error in DefaultNetwork
1 parent 7dcf0a5 commit d5bfbe3

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

framework/.changeset/v0.10.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Expose observability stack functions to reuse in devenv repository
2+
- Set all dashboard URLs to 15m/5s
3+
- Add config functions compatible with devenv

framework/config.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ func LoadCache[X any](t *testing.T) (*X, error) {
224224
return Load[X](t)
225225
}
226226

227+
// BaseConfigPath returns base config path, ex. env.toml,overrides.toml -> env.toml
227228
func BaseConfigPath() (string, error) {
228229
configs := os.Getenv("CTF_CONFIGS")
229230
if configs == "" {
@@ -233,6 +234,7 @@ func BaseConfigPath() (string, error) {
233234
return strings.Split(configs, ",")[0], nil
234235
}
235236

237+
// BaseConfigName returns base config name, ex. env.toml -> env
236238
func BaseConfigName() (string, error) {
237239
cp, err := BaseConfigPath()
238240
if err != nil {
@@ -241,6 +243,7 @@ func BaseConfigName() (string, error) {
241243
return strings.Replace(cp, ".toml", "", -1), nil
242244
}
243245

246+
// BaseCacheName returns base cache file name, ex.: env.toml -> env-cache.toml
244247
func BaseCacheName() (string, error) {
245248
cp, err := BaseConfigPath()
246249
if err != nil {
@@ -252,15 +255,17 @@ func BaseCacheName() (string, error) {
252255

253256
func DefaultNetwork(once *sync.Once) error {
254257
var net *testcontainers.DockerNetwork
255-
var err error
258+
var innerErr error
256259
once.Do(func() {
257-
net, err = network.New(
260+
net, innerErr = network.New(
258261
context.Background(),
259262
network.WithLabels(map[string]string{"framework": "ctf"}),
260263
)
261-
DefaultNetworkName = net.Name
264+
if innerErr == nil {
265+
DefaultNetworkName = net.Name
266+
}
262267
})
263-
return err
268+
return innerErr
264269
}
265270

266271
func RenderTemplate(tmpl string, data interface{}) (string, error) {

framework/observability.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ var EmbeddedObservabilityFiles embed.FS
1414

1515
const (
1616
LocalCLNodeErrorsURL = "http://localhost:3000/d/a7de535b-3e0f-4066-bed7-d505b6ec9ef1/cl-node-errors?orgId=1&refresh=5s"
17-
LocalWorkflowEngineURL = "http://localhost:3000/d/ce589a98-b4be-4f80-bed1-bc62f3e4414a/workflow-engine?orgId=1&refresh=5s"
18-
LocalLogsURL = "http://localhost:3000/explore?panes=%7B%22qZw%22:%7B%22datasource%22:%22P8E80F9AEF21F6940%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22P8E80F9AEF21F6940%22%7D%7D%5D,%22range%22:%7B%22from%22:%22now-15m%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1"
19-
LocalPrometheusURL = "http://localhost:3000/explore?panes=%7B%22qZw%22:%7B%22datasource%22:%22PBFA97CFB590B2093%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%22,%22range%22:true,%22datasource%22:%7B%22type%22:%22prometheus%22,%22uid%22:%22PBFA97CFB590B2093%22%7D%7D%5D,%22range%22:%7B%22from%22:%22now-6h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1"
20-
LocalPostgresDebugURL = "http://localhost:3000/d/000000039/postgresql-database?orgId=1&refresh=10s&var-DS_PROMETHEUS=PBFA97CFB590B2093&var-interval=$__auto_interval_interval&var-namespace=&var-release=&var-instance=postgres_exporter_0:9187&var-datname=All&var-mode=All&from=now-5m&to=now"
21-
LocalPyroScopeURL = "http://localhost:4040"
17+
LocalWorkflowEngineURL = "http://localhost:3000/d/ce589a98-b4be-4f80-bed1-bc62f3e4414a/workflow-engine?orgId=1&refresh=5s&from=now-15m&to=now"
18+
LocalLogsURL = "http://localhost:3000/explore?panes=%7B%22qZw%22:%7B%22datasource%22:%22P8E80F9AEF21F6940%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bjob%3D%5C%22ctf%5C%22%7D%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22P8E80F9AEF21F6940%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-15m%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1"
19+
LocalPrometheusURL = "http://localhost:3000/explore?panes=%7B%22qZw%22:%7B%22datasource%22:%22PBFA97CFB590B2093%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%22,%22range%22:true,%22datasource%22:%7B%22type%22:%22prometheus%22,%22uid%22:%22PBFA97CFB590B2093%22%7D%7D%5D,%22range%22:%7B%22from%22:%22now-15m%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1"
20+
LocalPostgresDebugURL = "http://localhost:3000/d/000000039/postgresql-database?orgId=1&refresh=5s&var-DS_PROMETHEUS=PBFA97CFB590B2093&var-interval=$__auto_interval_interval&var-namespace=&var-release=&var-instance=postgres_exporter_0:9187&var-datname=All&var-mode=All&from=now-15m&to=now"
21+
LocalPyroScopeURL = "http://localhost:4040/?query=process_cpu%3Acpu%3Ananoseconds%3Acpu%3Ananoseconds%7Bservice_name%3D%22chainlink-node%22%7D&from=now-15m"
2222
)
2323

2424
// extractAllFiles goes through the embedded directory and extracts all files to the current directory

0 commit comments

Comments
 (0)