Skip to content

Commit

Permalink
Updates to docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Imshelledin21 committed Jun 10, 2024
1 parent 8bd02dd commit f538a9d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
1 change: 1 addition & 0 deletions docs/sources/reference/compatibility/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ The following components, grouped by namespace, _export_ OpenTelemetry `otelcol.
- [otelcol.connector.servicegraph](../components/otelcol.connector.servicegraph)
- [otelcol.connector.spanlogs](../components/otelcol.connector.spanlogs)
- [otelcol.connector.spanmetrics](../components/otelcol.connector.spanmetrics)
- [otelcol.exporter.awss3](../components/otelcol.exporter.awss3)
- [otelcol.exporter.kafka](../components/otelcol.exporter.kafka)
- [otelcol.exporter.loadbalancing](../components/otelcol.exporter.loadbalancing)
- [otelcol.exporter.logging](../components/otelcol.exporter.logging)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ otelcol.exporter.awss3 "logs" {

## Compatible components

`otelcol.exporter.otlp` has exports that can be consumed by the following components:
`otelcol.exporter.awss3` has exports that can be consumed by the following components:

- Components that consume [OpenTelemetry `otelcol.Consumer`](../../compatibility/#opentelemetry-otelcolconsumer-consumers)

Expand Down
49 changes: 25 additions & 24 deletions internal/component/otelcol/exporter/awss3/awss3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,71 @@ import (
"testing"

otelcolCfg "github.com/grafana/alloy/internal/component/otelcol/config"
"github.com/grafana/alloy/internal/component/otelcol/receiver/vcenter"
"github.com/grafana/alloy/internal/component/otelcol/exporter/awss3"
"github.com/grafana/alloy/syntax"
"github.com/stretchr/testify/require"
)

func TestDebugMetricsConfig(t *testing.T) {
tests := []struct {
testName string
alloyCfg string
agentCfg string
expected otelcolCfg.DebugMetricsArguments
}{
{
testName: "default",
alloyCfg: `
endpoint = "http://localhost:1234"
username = "user"
password = "pass"
output {}
agentCfg: `
s3_uploader {
s3_bucket = "test"
s3_prefix = "logs"
}
debug_metrics {
disable_high_cardinality_metrics = true
}
`,
expected: otelcolCfg.DebugMetricsArguments{
DisableHighCardinalityMetrics: true,
Level: otelcolCfg.LevelDetailed,
},
},
{
testName: "explicit_false",
alloyCfg: `
endpoint = "http://localhost:1234"
username = "user"
password = "pass"
agentCfg: `
s3_uploader {
s3_bucket = "test"
s3_prefix = "logs"
}
debug_metrics {
disable_high_cardinality_metrics = false
}
output {}
`,
expected: otelcolCfg.DebugMetricsArguments{
DisableHighCardinalityMetrics: false,
Level: otelcolCfg.LevelDetailed,
},
},
{
testName: "explicit_true",
alloyCfg: `
endpoint = "http://localhost:1234"
username = "user"
password = "pass"
agentCfg: `
s3_uploader {
s3_bucket = "test"
s3_prefix = "logs"
}
debug_metrics {
disable_high_cardinality_metrics = true
}
output {}
`,
expected: otelcolCfg.DebugMetricsArguments{
DisableHighCardinalityMetrics: true,
Level: otelcolCfg.LevelDetailed,
},
},
}

for _, tc := range tests {
t.Run(tc.testName, func(t *testing.T) {
var args vcenter.Arguments
require.NoError(t, syntax.Unmarshal([]byte(tc.alloyCfg), &args))
var args awss3.Arguments
require.NoError(t, syntax.Unmarshal([]byte(tc.agentCfg), &args))
_, err := args.Convert()
require.NoError(t, err)

Expand Down

0 comments on commit f538a9d

Please sign in to comment.