Skip to content

Commit

Permalink
chore: test otelcol configs from example directory (#1173)
Browse files Browse the repository at this point in the history
* chore: test otelcol configs from example directory

* fixes after review
  • Loading branch information
dmolenda-sumo authored Jun 26, 2023
1 parent e517a9f commit a353505
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ Span ID:
Flags: 0
```

Example configuration with example log can be found in [/examples/logs_json/](/examples/logs_json/) directory.
Example configuration with example log can be found in [/examples/otelcolconfigs/logs_json/](/examples/otelcolconfigs/logs_json/) directory.

[json_parser]: https://github.com/open-telemetry/opentelemetry-log-collection/blob/main/docs/operators/json_parser.md
[filelogreceiver_readme]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.80.0/receiver/filelogreceiver
Expand Down
7 changes: 4 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Examples

- [ansible](ansible) - example Ansible playbook to install Sumo Logic Distribution for OpenTelemetry Collector
- [config_cpu_load_metrics.yaml](config_cpu_load_metrics.yaml) - example configuration to collect CPU load metrics using [Host Metrics Receiver][hostmetricsreceiver]
- [puppet](puppet) - example manifest and module to install Sumo Logic Distribution for OpenTelemetry Collector with Puppet
- [chef](chef) - example cookbook to install Sumo Logic Distribution for OpenTelemetry Collector with Chef
- [config_logging.yaml](config_logging.yaml) - example configuration to collect CPU load metrics using
- [otelcolconfigs](otelcolconfigs) - a directory that contains sample opentelemetry collector configurations, such as:
- [config_cpu_load_metrics.yaml](otelcolconfigs/config_cpu_load_metrics.yaml) - example configuration to collect CPU load metrics using [Host Metrics Receiver][hostmetricsreceiver]
- [config_logging.yaml](otelcolconfigs/config_logging.yaml) - example configuration to collect CPU load metrics using
[Host Metrics Receiver][hostmetricsreceiver] without sending them to Sumo Logic.
- [logs_json](logs_json) - example configuration to parse logs using [json_parser][json_parser] with example log
- [logs_json](otelcolconfigs/logs_json) - example configuration to parse logs using [json_parser][json_parser] with example log

[hostmetricsreceiver]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.52.0/receiver/hostmetricsreceiver
[json_parser]: https://github.com/open-telemetry/opentelemetry-log-collection/blob/main/docs/operators/json_parser.md
1 change: 0 additions & 1 deletion examples/logs_json/example.log

This file was deleted.

9 changes: 9 additions & 0 deletions examples/otelcolconfigs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Examples

- [config_cpu_load_metrics.yaml](config_cpu_load_metrics.yaml) - example configuration to collect CPU load metrics using [Host Metrics Receiver][hostmetricsreceiver]
- [config_logging.yaml](config_logging.yaml) - example configuration to collect CPU load metrics using
[Host Metrics Receiver][hostmetricsreceiver] without sending them to Sumo Logic.
- [logs_json](logs_json) - example configuration to parse logs using [json_parser][json_parser] with example log

[hostmetricsreceiver]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.52.0/receiver/hostmetricsreceiver
[json_parser]: https://github.com/open-telemetry/opentelemetry-log-collection/blob/main/docs/operators/json_parser.md
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ exporters:
receivers:
filelog:
include:
- /sumologic/examples/logs_json/example.log
- examples/otelcolconfigs/logs_json/example.log
start_at: beginning
operators:
- type: json_parser
- type: json_parser
parse_from: message
parse_from: body.message
service:
pipelines:
logs:
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions otelcolbuilder/cmd/collector_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ func TestBuiltCollectorWithConfigurationFiles(t *testing.T) {
name: "multiple config files can be handled by the glob config provider",
configFile: "glob:testdata/multiple/*.yaml",
},
{
name: "collect CPU load metrics using Host Metrics Receiver",
configFile: "../../examples/otelcolconfigs/config_logging.yaml",
},
{
name: "config to parse logs using json_parser",
configFile: "../../examples/otelcolconfigs/logs_json/config.yaml",
},
}

for _, tc := range testcases {
Expand Down

0 comments on commit a353505

Please sign in to comment.