Skip to content

Commit

Permalink
Finish otel upgrade (#6772)
Browse files Browse the repository at this point in the history
* handle otel feedback

* minor documentation and test updates for updating otel to 0.96.0

* remove todos
  • Loading branch information
mattdurham authored Mar 27, 2024
1 parent 59e7451 commit e908a2f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/26115
* [otelcol.connector.spanmetrics] Add a new `events` metric.
https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/27451
* [otelcol.connector.spanmetrics] A new `max_per_data_point` argument for exemplar generation.
* https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/22620
* https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/29242
* [ottl] Add IsBool Converter
https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/27897
* [otelcol.processor.tail_sampling] Optimize memory performance of tailsamplingprocessor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ otelcol.connector.spanmetrics "LABEL" {
| `metrics_flush_interval` | `duration` | How often to flush generated metrics. | `"15s"` | no |
| `namespace` | `string` | Metric namespace. | `""` | no |
| `resource_metrics_cache_size` | `number` | The size of the cache holding metrics for a service. | `1000` | no |
| `resource_metrics_key_attributes` | `list(string)` | Span resources with the same values for those resource attributes are aggregated together. | `[]` | no |
| `resource_metrics_key_attributes` | `list(string)` | Limits the resource attributes used to create the metrics. | `[]` | no |

Adjusting `dimensions_cache_size` can improve the Agent process' memory usage.

Expand Down Expand Up @@ -808,4 +808,4 @@ Connecting some components may not be sensible or components may require further
Refer to the linked documentation for more details.
{{< /admonition >}}

<!-- END GENERATED COMPATIBLE COMPONENTS -->
<!-- END GENERATED COMPATIBLE COMPONENTS -->
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ Before enabling this option, consider whether changes to idle connection setting

If `http2_ping_timeout` is unset or set to `0s`, it will default to `15s`.

If `http2_read_idle_timeout` is unset or set to `0s`, then no health check will be performed.

{{< docs/shared lookup="flow/reference/components/otelcol-compression-field.md" source="agent" version="<AGENT_VERSION>" >}}

### tls block
Expand Down Expand Up @@ -177,4 +179,4 @@ Connecting some components may not be sensible or components may require further
Refer to the linked documentation for more details.
{{< /admonition >}}

<!-- END GENERATED COMPATIBLE COMPONENTS -->
<!-- END GENERATED COMPATIBLE COMPONENTS -->
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ headless: true

The following attributes are supported:

Name | Type | Description | Default | Required
------------|----------|----------------------------------------------------------------------------------------|---------|---------
`from` | `string` | The source of the labels or annotations. Allowed values are `pod` and `namespace`. | `pod` | no
`key_regex` | `string` | A regular expression used to extract a key that matches the regular expression. | `""` | no
`key` | `string` | The annotation or label name. This key must exactly match an annotation or label name. | `""` | no
`regex` | `string` | An optional field used to extract a sub-string from a complex field value. | `""` | no
`tag_name` | `string` | The name of the resource attribute added to logs, metrics, or spans. | `""` | no
Name | Type | Description | Default | Required
------------|----------|-----------------------------------------------------------------------------------------------|---------|---------
`from` | `string` | The source of the labels or annotations. Allowed values are `pod`, `namespace`, and `node`. | `pod` | no
`key_regex` | `string` | A regular expression used to extract a key that matches the regular expression. | `""` | no
`key` | `string` | The annotation or label name. This key must exactly match an annotation or label name. | `""` | no
`regex` | `string` | An optional field used to extract a sub-string from a complex field value. | `""` | no
`tag_name` | `string` | The name of the resource attribute added to logs, metrics, or spans. | `""` | no

When you don't specify the `tag_name`, a default tag name is used with the format:
* `k8s.pod.annotations.<annotation key>`
Expand Down
3 changes: 2 additions & 1 deletion internal/component/otelcol/exporter/otlphttp/otlphttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package otlphttp

import (
"errors"
"fmt"
"time"

"github.com/grafana/agent/internal/component"
Expand Down Expand Up @@ -100,7 +101,7 @@ func (args *Arguments) Validate() error {
return errors.New("at least one endpoint must be specified")
}
if args.Encoding != EncodingProto && args.Encoding != EncodingJSON {
return errors.New("invalid encoding type")
return fmt.Errorf("invalid encoding type %s", args.Encoding)
}
return nil
}
Expand Down
10 changes: 3 additions & 7 deletions internal/static/traces/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ type InstanceConfig struct {
// Hides the value of the string during marshaling.
type SecretString string

var (
_ yaml.Marshaler = (*SecretString)(nil)
)
var _ yaml.Marshaler = (*SecretString)(nil)

// MarshalYAML implements yaml.Marshaler.
func (s SecretString) MarshalYAML() (interface{}, error) {
Expand All @@ -182,9 +180,7 @@ func (s SecretString) MarshalYAML() (interface{}, error) {
// ReceiverMap will marshal as YAML to the text "<secret>".
type JaegerRemoteSamplingConfig map[string]interface{}

var (
_ yaml.Marshaler = (*JaegerRemoteSamplingConfig)(nil)
)
var _ yaml.Marshaler = (*JaegerRemoteSamplingConfig)(nil)

// MarshalYAML implements yaml.Marshaler.
func (jrsm JaegerRemoteSamplingConfig) MarshalYAML() (interface{}, error) {
Expand Down Expand Up @@ -1024,7 +1020,7 @@ func otelcolConfigFromStringMap(otelMapStructure map[string]interface{}, factori
func validateConfigFromFactories(factories otelcol.Factories) error {
var errs error

//TODO: We should not use componenttest in non-test code
// TODO: We should not use componenttest in non-test code
for _, factory := range factories.Receivers {
errs = multierr.Append(errs, componenttest.CheckConfigStruct(factory.CreateDefaultConfig()))
}
Expand Down
12 changes: 2 additions & 10 deletions internal/static/traces/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1159,8 +1159,8 @@ remote_write:
scopes: ["api.metrics"]
timeout: 2s
`,
//TODO(ptodev): Look into why we need to add a "cipher_suites: []" explicitly.
// The expected config should unmarshal it to [], but instead it sets it to nil.
// The tls.ciphersuites would appear that it should output nothing or nil but during the conversion otelcolConfigFromStringMap the otelcol.Unmarshal converts the nil array to a blank one []. This is specifically used
// in confmap.go that transforms nil arrays into [] on the zeroSliceHookFunc.
expectedConfig: `
receivers:
push_receiver: {}
Expand Down Expand Up @@ -1221,8 +1221,6 @@ remote_write:
min_version: 1.3
reload_interval: 1h
`,
//TODO(ptodev): Look into why we need to add a "cipher_suites: []" explicitly.
// The expected config should unmarshal it to [], but instead it sets it to nil.
expectedConfig: `
receivers:
push_receiver: {}
Expand Down Expand Up @@ -1292,8 +1290,6 @@ remote_write:
max_version: 1.2
reload_interval: 1h
`,
//TODO: Look into why we need to add a "cipher_suites: []" explicitly.
// The expected config should unmarshal it to [], but instead it sets it to nil.
expectedConfig: `
receivers:
push_receiver: {}
Expand Down Expand Up @@ -1361,8 +1357,6 @@ remote_write:
scopes: ["api.metrics"]
timeout: 2s
`,
//TODO: Look into why we need to add a "cipher_suites: []" explicitly.
// The expected config should unmarshal it to [], but instead it sets it to nil.
expectedConfig: `
receivers:
push_receiver: {}
Expand Down Expand Up @@ -1431,8 +1425,6 @@ remote_write:
tls:
insecure: true
`,
//TODO: Look into why we need to add a "cipher_suites: []" explicitly.
// The expected config should unmarshal it to [], but instead it sets it to nil.
expectedConfig: `
receivers:
push_receiver: {}
Expand Down

0 comments on commit e908a2f

Please sign in to comment.