[#549] Add tracing attributes
Signed-off-by: Roman Loginov <r.loginov@yadro.com>
This commit is contained in:
parent
31076796ce
commit
368c7d2acd
7 changed files with 75 additions and 13 deletions
|
@ -628,6 +628,13 @@ func (a *App) initTracing(ctx context.Context) {
|
|||
cfg.ServerCaCertPool = certPool
|
||||
}
|
||||
|
||||
attributes, err := fetchTracingAttributes(a.cfg)
|
||||
if err != nil {
|
||||
a.log.Warn(logs.FailedToInitializeTracing, zap.Error(err))
|
||||
return
|
||||
}
|
||||
cfg.Attributes = attributes
|
||||
|
||||
updated, err := tracing.Setup(ctx, cfg)
|
||||
if err != nil {
|
||||
a.log.Warn(logs.FailedToInitializeTracing, zap.Error(err))
|
||||
|
|
|
@ -163,10 +163,11 @@ const ( // Settings.
|
|||
cfgPProfAddress = "pprof.address"
|
||||
|
||||
// Tracing.
|
||||
cfgTracingEnabled = "tracing.enabled"
|
||||
cfgTracingExporter = "tracing.exporter"
|
||||
cfgTracingEndpoint = "tracing.endpoint"
|
||||
cfgTracingTrustedCa = "tracing.trusted_ca"
|
||||
cfgTracingEnabled = "tracing.enabled"
|
||||
cfgTracingExporter = "tracing.exporter"
|
||||
cfgTracingEndpoint = "tracing.endpoint"
|
||||
cfgTracingTrustedCa = "tracing.trusted_ca"
|
||||
cfgTracingAttributes = "tracing.attributes"
|
||||
|
||||
cfgListenDomains = "listen_domains"
|
||||
|
||||
|
@ -779,6 +780,30 @@ func fetchMultinetConfig(v *viper.Viper, logger *zap.Logger) (cfg internalnet.Co
|
|||
return
|
||||
}
|
||||
|
||||
func fetchTracingAttributes(v *viper.Viper) (map[string]string, error) {
|
||||
attributes := make(map[string]string)
|
||||
for i := 0; ; i++ {
|
||||
key := cfgTracingAttributes + "." + strconv.Itoa(i) + "."
|
||||
attrKey := v.GetString(key + "key")
|
||||
attrValue := v.GetString(key + "value")
|
||||
if attrKey == "" {
|
||||
break
|
||||
}
|
||||
|
||||
if _, ok := attributes[attrKey]; ok {
|
||||
return nil, fmt.Errorf("tracing attribute key %s defined more than once", attrKey)
|
||||
}
|
||||
|
||||
if attrValue == "" {
|
||||
return nil, fmt.Errorf("empty tracing attribute value for key %s", attrKey)
|
||||
}
|
||||
|
||||
attributes[attrKey] = attrValue
|
||||
}
|
||||
|
||||
return attributes, nil
|
||||
}
|
||||
|
||||
func newSettings() *viper.Viper {
|
||||
v := viper.New()
|
||||
|
||||
|
|
|
@ -185,6 +185,10 @@ S3_GW_TRACING_ENABLED=false
|
|||
S3_GW_TRACING_ENDPOINT="localhost:4318"
|
||||
S3_GW_TRACING_EXPORTER="otlp_grpc"
|
||||
S3_GW_TRACING_TRUSTED_CA=""
|
||||
S3_GW_TRACING_ATTRIBUTES_0_KEY=key0
|
||||
S3_GW_TRACING_ATTRIBUTES_0_VALUE=value
|
||||
S3_GW_TRACING_ATTRIBUTES_1_KEY=key1
|
||||
S3_GW_TRACING_ATTRIBUTES_1_VALUE=value
|
||||
|
||||
S3_GW_RUNTIME_SOFT_MEMORY_LIMIT=1073741824
|
||||
|
||||
|
|
|
@ -92,6 +92,11 @@ tracing:
|
|||
exporter: "otlp_grpc"
|
||||
endpoint: "localhost:4318"
|
||||
trusted_ca: ""
|
||||
attributes:
|
||||
- key: key0
|
||||
value: value
|
||||
- key: key1
|
||||
value: value
|
||||
|
||||
# Timeout to connect to a node
|
||||
connect_timeout: 10s
|
||||
|
|
|
@ -544,14 +544,35 @@ tracing:
|
|||
exporter: "otlp_grpc"
|
||||
endpoint: "localhost:4318"
|
||||
trusted_ca: "/etc/ssl/telemetry-trusted-ca.pem"
|
||||
attributes:
|
||||
- key: key0
|
||||
value: value
|
||||
- key: key1
|
||||
value: value
|
||||
```
|
||||
|
||||
| Parameter | Type | SIGHUP reload | Default value | Description |
|
||||
|--------------|----------|---------------|---------------|---------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `enabled` | `bool` | yes | `false` | Flag to enable the service. |
|
||||
| `exporter` | `string` | yes | `` | Type of tracing exporter. |
|
||||
| `endpoint` | `string` | yes | `` | Address that service listener binds to. |
|
||||
| `trusted_ca` | `string` | yes | | Path to certificate of a certification authority in pem format, that issued the TLS certificate of the telemetry remote server. |
|
||||
| Parameter | Type | SIGHUP reload | Default value | Description |
|
||||
| ------------ | -------------------------------------- | ------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `enabled` | `bool` | yes | `false` | Flag to enable the service. |
|
||||
| `exporter` | `string` | yes | | Type of tracing exporter. |
|
||||
| `endpoint` | `string` | yes | | Address that service listener binds to. |
|
||||
| `trusted_ca` | `string` | yes | | Path to certificate of a certification authority in pem format, that issued the TLS certificate of the telemetry remote server. |
|
||||
| `attributes` | [[]Attributes](#attributes-subsection) | yes | | An array of configurable attributes in key-value format. |
|
||||
|
||||
#### `attributes` subsection
|
||||
|
||||
```yaml
|
||||
attributes:
|
||||
- key: key0
|
||||
value: value
|
||||
- key: key1
|
||||
value: value
|
||||
```
|
||||
|
||||
| Parameter | Type | SIGHUP reload | Default value | Description |
|
||||
|-----------------------|----------|---------------|---------------|----------------------------------------------------------|
|
||||
| `key` | `string` | yes | | Attribute key. |
|
||||
| `value` | `string` | yes | | Attribute value. |
|
||||
|
||||
# `frostfs` section
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -5,7 +5,7 @@ go 1.22
|
|||
require (
|
||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241011114054-f0fc40e116d1
|
||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751d48b
|
||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20240909114314-666d326cc573
|
||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88
|
||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241022124111-5361f0ecebd3
|
||||
git.frostfs.info/TrueCloudLab/multinet v0.0.0-20241015075604-6cb0d80e0972
|
||||
git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240822104152-a3bc3099bd5b
|
||||
|
|
4
go.sum
4
go.sum
|
@ -42,8 +42,8 @@ git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751
|
|||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751d48b/go.mod h1:5fSm/l5xSjGWqsPUffSdboiGFUHa7y/1S0fvxzQowN8=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20240909114314-666d326cc573 h1:6qCcm1oqFbmf9C5AauXzrL5OPGnTbI9HoB/jAtD9274=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20240909114314-666d326cc573/go.mod h1:kbwB4v2o6RyOfCo9kEFeUDZIX3LKhmS0yXPrtvzkQ1g=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88 h1:9bvBDLApbbO5sXBKdODpE9tzy3HV99nXxkDWNn22rdI=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88/go.mod h1:kbwB4v2o6RyOfCo9kEFeUDZIX3LKhmS0yXPrtvzkQ1g=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241022124111-5361f0ecebd3 h1:f7jan6eBDN88DKnKj8GKyWpfjBbSzjDALcDejYKRgCs=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241022124111-5361f0ecebd3/go.mod h1:3txOjFJ8M/JFs01h7xOrnQHVn6hZgDNA16ivyUlu1iU=
|
||||
git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc=
|
||||
|
|
Loading…
Reference in a new issue