Skip to content

Commit

Permalink
Fix linter issue, document remote_sampling change
Browse files Browse the repository at this point in the history
  • Loading branch information
ptodev committed Jul 12, 2023
1 parent d4377d4 commit d06c667
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Main (unreleased)
- Rename `discovery.file` to `local.file_match` to make it more clear that it
discovers file on the local filesystem, and so it doesn't get confused with
Prometheus' file discovery. (@rfratto)

- In the traces subsystem for Static mode, some metrics are removed and others are renamed. (@ptodev)
- Removed metrics:
- "blackbox_exporter_config_last_reload_success_timestamp_seconds" (gauge)
Expand All @@ -54,6 +54,8 @@ Main (unreleased)
- "traces_receiver_accepted_spans" is renamed to "traces_receiver_refused_spans_total"
- "traces_exporter_sent_metric_points" is renamed to "traces_exporter_sent_metric_points_total"

- The `remote_sampling` block has been removed from `otelcol.receiver.jaeger`. (@ptodev)

### Features

- The Pyroscope scrape component computes and sends delta profiles automatically when required to reduce bandwidth usage. (@cyriltovena)
Expand Down
29 changes: 29 additions & 0 deletions component/otelcol/processor/tail_sampling/tail_sampling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,35 @@ func TestBadRiverConfig(t *testing.T) {
require.Error(t, river.Unmarshal([]byte(exampleBadRiverConfig), &args), "num_traces must be greater than zero")
}

func TestBadRiverConfigErrorMode(t *testing.T) {
exampleBadRiverConfig := `
decision_wait = "10s"
num_traces = 5
expected_new_traces_per_sec = 10
policy {
name = "test-policy-1"
type = "ottl_condition"
ottl_condition {
error_mode = ""
span = [
"attributes[\"test_attr_key_1\"] == \"test_attr_val_1\"",
"attributes[\"test_attr_key_2\"] != \"test_attr_val_1\"",
]
spanevent = [
"name != \"test_span_event_name\"",
"attributes[\"test_event_attr_key_2\"] != \"test_event_attr_val_1\"",
]
}
}
output {
// no-op: will be overridden by test code.
}
`

var args Arguments
require.ErrorContains(t, river.Unmarshal([]byte(exampleBadRiverConfig), &args), "\"\" unknown error mode")
}

func TestBadOtelConfig(t *testing.T) {
var exampleBadOtelConfig = `
decision_wait = "10s"
Expand Down
21 changes: 20 additions & 1 deletion component/otelcol/processor/tail_sampling/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,36 @@ var (

// Validate implements river.Validator.
func (e *ErrorMode) Validate() error {
if e == nil {
return nil
}

var ottlError ottl.ErrorMode
return ottlError.UnmarshalText([]byte(string(*e)))
}

// Convert the River type to the Otel type
func (e *ErrorMode) Convert() ottl.ErrorMode {
if e == nil || *e == "" {
return ottl.ErrorMode("")
}

var ottlError ottl.ErrorMode
ottlError.UnmarshalText([]byte(string(*e)))
err := ottlError.UnmarshalText([]byte(string(*e)))

//TODO: Rework this to return an error instead of panicking
if err != nil {
panic(err)
}

return ottlError
}

func (e *ErrorMode) UnmarshalText(text []byte) error {
if e == nil {
return nil
}

str := ErrorMode(strings.ToLower(string(text)))
switch str {
case ErrorModeIgnore, ErrorModePropagate:
Expand Down Expand Up @@ -434,6 +452,7 @@ func (andSubPolicyConfig AndSubPolicyConfig) Convert() tsp.AndSubPolicyCfg {
func mustDecodeMapStructure(source map[string]interface{}, otelConfig interface{}) {
err := mapstructure.Decode(source, otelConfig)

//TODO: Rework this to return an error instead of panicking
if err != nil {
panic(err)
}
Expand Down
5 changes: 5 additions & 0 deletions docs/sources/flow/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ Additional `instrumentation_scope` information will be added to the OTLP log sig
The `/` HTTP endpoint was the same as the `/sampling` endpoint. The `/sampling` endpoint is still functional.
The change was made in PR [#18070](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/18070) of opentelemetry-collector-contrib.

### The `remote_sampling` block has been removed from `otelcol.receiver.jaeger`

The `remote_sampling` block in `otelcol.receiver.jaeger` has been an undocumented no-op configuration for some time, and has now been removed.
Customers are advised to use `otelcol.extension.jaeger_remote_sampling` instead.

## v0.35

### Breaking change: `auth` and `version` attributes from `walk_params` block of `prometheus.exporter.snmp` have been removed
Expand Down

0 comments on commit d06c667

Please sign in to comment.