mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 16:52:54 +08:00
Tracing: chore make insecure option configurable (#99236)
* Tracing: chore: make insecure option configurable In case of insecure set to false, default system cert pool will be used to create otlpgrpc client. * test: add tracing/insecure config checks This is to verify whether insecure configuration is properly parsed. * chore: update configura Grafana docs with new setting * chore: also update comment in the ini files --------- Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
This commit is contained in:
@ -61,6 +61,7 @@ func TestTracingConfig(t *testing.T) {
|
||||
Env map[string]string
|
||||
ExpectedExporter string
|
||||
ExpectedAddress string
|
||||
ExpectedInsecure bool
|
||||
ExpectedPropagator string
|
||||
ExpectedAttrs []attribute.KeyValue
|
||||
|
||||
@ -72,6 +73,7 @@ func TestTracingConfig(t *testing.T) {
|
||||
Name: "default config uses noop exporter",
|
||||
Cfg: "",
|
||||
ExpectedExporter: noopExporter,
|
||||
ExpectedInsecure: true,
|
||||
ExpectedAttrs: []attribute.KeyValue{},
|
||||
},
|
||||
{
|
||||
@ -81,6 +83,7 @@ func TestTracingConfig(t *testing.T) {
|
||||
custom_attributes = key1:value1,key2:value2
|
||||
`,
|
||||
ExpectedExporter: noopExporter,
|
||||
ExpectedInsecure: true,
|
||||
ExpectedAttrs: []attribute.KeyValue{attribute.String("key1", "value1"), attribute.String("key2", "value2")},
|
||||
},
|
||||
{
|
||||
@ -101,6 +104,19 @@ func TestTracingConfig(t *testing.T) {
|
||||
`,
|
||||
ExpectedExporter: otlpExporter,
|
||||
ExpectedAddress: "otlp.example.com:4317",
|
||||
ExpectedInsecure: true,
|
||||
ExpectedAttrs: []attribute.KeyValue{},
|
||||
},
|
||||
{
|
||||
Name: "OTLP insecure is parsed",
|
||||
Cfg: `
|
||||
[tracing.opentelemetry.otlp]
|
||||
address = otlp.example.com:4317
|
||||
insecure = false
|
||||
`,
|
||||
ExpectedExporter: otlpExporter,
|
||||
ExpectedAddress: "otlp.example.com:4317",
|
||||
ExpectedInsecure: false,
|
||||
ExpectedAttrs: []attribute.KeyValue{},
|
||||
},
|
||||
{
|
||||
@ -154,6 +170,7 @@ func TestTracingConfig(t *testing.T) {
|
||||
`,
|
||||
ExpectedExporter: otlpExporter,
|
||||
ExpectedAddress: "otlp.example.com:4317",
|
||||
ExpectedInsecure: true,
|
||||
ExpectedAttrs: []attribute.KeyValue{},
|
||||
ExpectedSampler: "remote",
|
||||
ExpectedSamplerParam: 0.5,
|
||||
@ -179,6 +196,7 @@ func TestTracingConfig(t *testing.T) {
|
||||
assert.Equal(t, test.ExpectedAddress, tracingConfig.Address)
|
||||
assert.Equal(t, test.ExpectedPropagator, tracingConfig.Propagation)
|
||||
assert.Equal(t, test.ExpectedAttrs, tracingConfig.CustomAttribs)
|
||||
assert.Equal(t, test.ExpectedInsecure, tracingConfig.Insecure)
|
||||
|
||||
if test.ExpectedSampler != "" {
|
||||
assert.Equal(t, test.ExpectedSampler, tracingConfig.Sampler)
|
||||
|
Reference in New Issue
Block a user