forked from TrueCloudLab/frostfs-node
Compare commits
4 commits
933a1b577d
...
4b6123c4c4
Author | SHA1 | Date | |
---|---|---|---|
4b6123c4c4 | |||
1df288fa18 | |||
0f9a71811d | |||
b4ac3cc257 |
10 changed files with 130 additions and 9 deletions
3
Makefile
3
Makefile
|
@ -282,7 +282,6 @@ env-up: all
|
|||
|
||||
# Shutdown dev environment
|
||||
env-down:
|
||||
docker compose -f dev/docker-compose.yml down
|
||||
docker volume rm -f frostfs-node_neo-go
|
||||
docker compose -f dev/docker-compose.yml down -v
|
||||
rm -rf ./$(TMP_DIR)/state
|
||||
rm -rf ./$(TMP_DIR)/storage
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/misc"
|
||||
|
@ -24,6 +25,7 @@ func ToTracingConfig(c *config.Config) (*tracing.Config, error) {
|
|||
Service: "frostfs-node",
|
||||
InstanceID: getInstanceIDOrDefault(c),
|
||||
Version: misc.Version,
|
||||
Attributes: make(map[string]string),
|
||||
}
|
||||
|
||||
if trustedCa := config.StringSafe(c.Sub(subsection), "trusted_ca"); trustedCa != "" {
|
||||
|
@ -38,11 +40,30 @@ func ToTracingConfig(c *config.Config) (*tracing.Config, error) {
|
|||
}
|
||||
conf.ServerCaCertPool = certPool
|
||||
}
|
||||
|
||||
i := uint64(0)
|
||||
for ; ; i++ {
|
||||
si := strconv.FormatUint(i, 10)
|
||||
ac := c.Sub(subsection).Sub("attributes").Sub(si)
|
||||
k := config.StringSafe(ac, "key")
|
||||
if k == "" {
|
||||
break
|
||||
}
|
||||
v := config.StringSafe(ac, "value")
|
||||
if v == "" {
|
||||
return nil, fmt.Errorf("empty tracing attribute value for key %s", k)
|
||||
}
|
||||
if _, ok := conf.Attributes[k]; ok {
|
||||
return nil, fmt.Errorf("tracing attribute key %s defined more than once", k)
|
||||
}
|
||||
conf.Attributes[k] = v
|
||||
}
|
||||
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
func getInstanceIDOrDefault(c *config.Config) string {
|
||||
s := config.StringSlice(c.Sub("node"), "addresses")
|
||||
s := config.StringSliceSafe(c.Sub("node"), "addresses")
|
||||
if len(s) > 0 {
|
||||
return s[0]
|
||||
}
|
||||
|
|
46
cmd/frostfs-node/config/tracing/config_test.go
Normal file
46
cmd/frostfs-node/config/tracing/config_test.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
package tracing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
||||
configtest "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/test"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestTracingSection(t *testing.T) {
|
||||
t.Run("defaults", func(t *testing.T) {
|
||||
tc, err := ToTracingConfig(configtest.EmptyConfig())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, false, tc.Enabled)
|
||||
require.Equal(t, tracing.Exporter(""), tc.Exporter)
|
||||
require.Equal(t, "", tc.Endpoint)
|
||||
require.Equal(t, "frostfs-node", tc.Service)
|
||||
require.Equal(t, "", tc.InstanceID)
|
||||
require.Nil(t, tc.ServerCaCertPool)
|
||||
require.Empty(t, tc.Attributes)
|
||||
})
|
||||
|
||||
const path = "../../../../config/example/node"
|
||||
|
||||
fileConfigTest := func(c *config.Config) {
|
||||
tc, err := ToTracingConfig(c)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, tc.Enabled)
|
||||
require.Equal(t, tracing.OTLPgRPCExporter, tc.Exporter)
|
||||
require.Equal(t, "localhost", tc.Endpoint)
|
||||
require.Equal(t, "frostfs-node", tc.Service)
|
||||
require.Nil(t, tc.ServerCaCertPool)
|
||||
require.EqualValues(t, map[string]string{
|
||||
"key0": "value",
|
||||
"key1": "value",
|
||||
}, tc.Attributes)
|
||||
}
|
||||
|
||||
configtest.ForEachFileType(path, fileConfigTest)
|
||||
|
||||
t.Run("ENV", func(t *testing.T) {
|
||||
configtest.ForEnvFileType(t, path, fileConfigTest)
|
||||
})
|
||||
}
|
|
@ -202,6 +202,10 @@ FROSTFS_TRACING_ENABLED=true
|
|||
FROSTFS_TRACING_ENDPOINT="localhost"
|
||||
FROSTFS_TRACING_EXPORTER="otlp_grpc"
|
||||
FROSTFS_TRACING_TRUSTED_CA=""
|
||||
FROSTFS_TRACING_ATTRIBUTES_0_KEY=key0
|
||||
FROSTFS_TRACING_ATTRIBUTES_0_VALUE=value
|
||||
FROSTFS_TRACING_ATTRIBUTES_1_KEY=key1
|
||||
FROSTFS_TRACING_ATTRIBUTES_1_VALUE=value
|
||||
|
||||
FROSTFS_RUNTIME_SOFT_MEMORY_LIMIT=1073741824
|
||||
|
||||
|
|
|
@ -258,9 +258,19 @@
|
|||
},
|
||||
"tracing": {
|
||||
"enabled": true,
|
||||
"endpoint": "localhost:9090",
|
||||
"endpoint": "localhost",
|
||||
"exporter": "otlp_grpc",
|
||||
"trusted_ca": "/etc/ssl/tracing.pem"
|
||||
"trusted_ca": "",
|
||||
"attributes":[
|
||||
{
|
||||
"key": "key0",
|
||||
"value": "value"
|
||||
},
|
||||
{
|
||||
"key": "key1",
|
||||
"value": "value"
|
||||
}
|
||||
]
|
||||
},
|
||||
"runtime": {
|
||||
"soft_memory_limit": 1073741824
|
||||
|
|
|
@ -238,6 +238,11 @@ tracing:
|
|||
exporter: "otlp_grpc"
|
||||
endpoint: "localhost"
|
||||
trusted_ca: ""
|
||||
attributes:
|
||||
- key: key0
|
||||
value: value
|
||||
- key: key1
|
||||
value: value
|
||||
|
||||
runtime:
|
||||
soft_memory_limit: 1gb
|
||||
|
|
|
@ -78,7 +78,12 @@
|
|||
"FROSTFS_STORAGE_SHARD_1_PILORAMA_PATH":"${workspaceFolder}/.cache/storage/s1/pilorama1",
|
||||
"FROSTFS_PROMETHEUS_ENABLED":"true",
|
||||
"FROSTFS_PROMETHEUS_ADDRESS":"127.0.0.1:9090",
|
||||
"FROSTFS_PROMETHEUS_SHUTDOWN_TIMEOUT":"15s"
|
||||
"FROSTFS_PROMETHEUS_SHUTDOWN_TIMEOUT":"15s",
|
||||
"FROSTFS_TRACING_ENABLED":"true",
|
||||
"FROSTFS_TRACING_EXPORTER":"otlp_grpc",
|
||||
"FROSTFS_TRACING_ENDPOINT":"127.0.0.1:4317",
|
||||
"FROSTFS_TRACING_ATTRIBUTES_0_KEY":"host.ip",
|
||||
"FROSTFS_TRACING_ATTRIBUTES_0_VALUE":"127.0.0.1:8080"
|
||||
},
|
||||
"postDebugTask": "env-down"
|
||||
},
|
||||
|
@ -129,7 +134,12 @@
|
|||
"FROSTFS_STORAGE_SHARD_1_PILORAMA_PATH":"${workspaceFolder}/.cache/storage/s2/pilorama1",
|
||||
"FROSTFS_PROMETHEUS_ENABLED":"true",
|
||||
"FROSTFS_PROMETHEUS_ADDRESS":"127.0.0.1:9091",
|
||||
"FROSTFS_PROMETHEUS_SHUTDOWN_TIMEOUT":"15s"
|
||||
"FROSTFS_PROMETHEUS_SHUTDOWN_TIMEOUT":"15s",
|
||||
"FROSTFS_TRACING_ENABLED":"true",
|
||||
"FROSTFS_TRACING_EXPORTER":"otlp_grpc",
|
||||
"FROSTFS_TRACING_ENDPOINT":"127.0.0.1:4317",
|
||||
"FROSTFS_TRACING_ATTRIBUTES_0_KEY":"host.ip",
|
||||
"FROSTFS_TRACING_ATTRIBUTES_0_VALUE":"127.0.0.1:8082"
|
||||
},
|
||||
"postDebugTask": "env-down"
|
||||
},
|
||||
|
@ -180,7 +190,12 @@
|
|||
"FROSTFS_STORAGE_SHARD_1_PILORAMA_PATH":"${workspaceFolder}/.cache/storage/s3/pilorama1",
|
||||
"FROSTFS_PROMETHEUS_ENABLED":"true",
|
||||
"FROSTFS_PROMETHEUS_ADDRESS":"127.0.0.1:9092",
|
||||
"FROSTFS_PROMETHEUS_SHUTDOWN_TIMEOUT":"15s"
|
||||
"FROSTFS_PROMETHEUS_SHUTDOWN_TIMEOUT":"15s",
|
||||
"FROSTFS_TRACING_ENABLED":"true",
|
||||
"FROSTFS_TRACING_EXPORTER":"otlp_grpc",
|
||||
"FROSTFS_TRACING_ENDPOINT":"127.0.0.1:4317",
|
||||
"FROSTFS_TRACING_ATTRIBUTES_0_KEY":"host.ip",
|
||||
"FROSTFS_TRACING_ATTRIBUTES_0_VALUE":"127.0.0.1:8084"
|
||||
},
|
||||
"postDebugTask": "env-down"
|
||||
},
|
||||
|
@ -231,7 +246,12 @@
|
|||
"FROSTFS_STORAGE_SHARD_1_PILORAMA_PATH":"${workspaceFolder}/.cache/storage/s4/pilorama1",
|
||||
"FROSTFS_PROMETHEUS_ENABLED":"true",
|
||||
"FROSTFS_PROMETHEUS_ADDRESS":"127.0.0.1:9093",
|
||||
"FROSTFS_PROMETHEUS_SHUTDOWN_TIMEOUT":"15s"
|
||||
"FROSTFS_PROMETHEUS_SHUTDOWN_TIMEOUT":"15s",
|
||||
"FROSTFS_TRACING_ENABLED":"true",
|
||||
"FROSTFS_TRACING_EXPORTER":"otlp_grpc",
|
||||
"FROSTFS_TRACING_ENDPOINT":"127.0.0.1:4317",
|
||||
"FROSTFS_TRACING_ATTRIBUTES_0_KEY":"host.ip",
|
||||
"FROSTFS_TRACING_ATTRIBUTES_0_VALUE":"127.0.0.1:8086"
|
||||
},
|
||||
"postDebugTask": "env-down"
|
||||
}
|
||||
|
|
|
@ -14,3 +14,17 @@ services:
|
|||
- ./neo-go/node-wallet.json:/wallets/node-wallet.json
|
||||
- ./neo-go/config.yml:/wallets/config.yml
|
||||
- ./neo-go/wallet.json:/wallets/wallet.json
|
||||
jaeger:
|
||||
image: jaegertracing/all-in-one:latest
|
||||
container_name: jaeger
|
||||
ports:
|
||||
- '4317:4317' #OTLP over gRPC
|
||||
- '4318:4318' #OTLP over HTTP
|
||||
- '16686:16686' #frontend
|
||||
stop_signal: SIGKILL
|
||||
environment:
|
||||
- COLLECTOR_OTLP_ENABLED=true
|
||||
- SPAN_STORAGE_TYPE=badger
|
||||
- BADGER_EPHEMERAL=false
|
||||
- BADGER_DIRECTORY_VALUE=/tmp/badger/data
|
||||
- BADGER_DIRECTORY_KEY=/tmp/badger/key
|
2
go.mod
2
go.mod
|
@ -134,3 +134,5 @@ require (
|
|||
)
|
||||
|
||||
replace github.com/nspcc-dev/neo-go => git.frostfs.info/TrueCloudLab/neoneo-go v0.106.1-0.20241015133823-8aee80dbdc07
|
||||
|
||||
replace git.frostfs.info/TrueCloudLab/frostfs-observability => ./../frostfs-observability
|
||||
|
|
BIN
go.sum
BIN
go.sum
Binary file not shown.
Loading…
Reference in a new issue