From a133a8efefbe34dd45d8d4c8473ebbd75f4bdcc3 Mon Sep 17 00:00:00 2001 From: Dominik Rosiek <58699848+sumo-drosiek@users.noreply.github.com> Date: Mon, 13 May 2024 10:05:36 +0200 Subject: [PATCH] [exporter/sumologic] change logs behavior (#32939) **Description:** * set OTLP as default format * add support for OTLP format * do not support metadata attributes * do not support source headers **Link to tracking Issue:** #32315 **Testing:** * unit tests **Documentation:** * inline comments * readme --------- Signed-off-by: Dominik Rosiek --- .chloggen/drosiek-exporter-logs.yaml | 31 + exporter/sumologicexporter/README.md | 43 +- exporter/sumologicexporter/compress.go | 77 -- exporter/sumologicexporter/compress_test.go | 142 --- exporter/sumologicexporter/config.go | 36 +- exporter/sumologicexporter/config_test.go | 99 +- exporter/sumologicexporter/exporter.go | 113 +-- exporter/sumologicexporter/exporter_test.go | 275 ++++-- exporter/sumologicexporter/factory.go | 2 - exporter/sumologicexporter/factory_test.go | 13 +- exporter/sumologicexporter/go.mod | 2 +- exporter/sumologicexporter/sender.go | 205 +++-- exporter/sumologicexporter/sender_test.go | 941 ++++++++++++++------ 13 files changed, 1117 insertions(+), 862 deletions(-) create mode 100644 .chloggen/drosiek-exporter-logs.yaml delete mode 100644 exporter/sumologicexporter/compress.go delete mode 100644 exporter/sumologicexporter/compress_test.go diff --git a/.chloggen/drosiek-exporter-logs.yaml b/.chloggen/drosiek-exporter-logs.yaml new file mode 100644 index 000000000000..c0181af0e02d --- /dev/null +++ b/.chloggen/drosiek-exporter-logs.yaml @@ -0,0 +1,31 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: sumologicexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: change logs behavior + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [31479] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + * set OTLP as default format + * add support for OTLP format + * do not support metadata attributes + * do not support source headers + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/exporter/sumologicexporter/README.md b/exporter/sumologicexporter/README.md index c678df2c3213..39267e26e61e 100644 --- a/exporter/sumologicexporter/README.md +++ b/exporter/sumologicexporter/README.md @@ -18,7 +18,7 @@ For some time we have been developing the [new Sumo Logic exporter](https://github.com/SumoLogic/sumologic-otel-collector/tree/main/pkg/exporter/sumologicexporter#sumo-logic-exporter) and now we are in the process of moving it into this repository. -The following options are deprecated for logs and already do not work for metrics: +The following options are no longer supported: - `metric_format: {carbon2, graphite}` - `metadata_attributes: []` @@ -30,7 +30,7 @@ The following options are deprecated for logs and already do not work for metric After the new exporter will be moved to this repository: - `carbon2` and `graphite` are no longer supported and `prometheus` or `otlp` format should be used -- all resource level attributes are going to be treated (are treated for metrics) as `metadata_attributes`. You can use [Group by Attributes processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/groupbyattrsprocessor) to move attributes from record level to resource level. For example: +- all resource level attributes are treated as `metadata_attributes` so this option is no longer supported. You can use [Group by Attributes processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/groupbyattrsprocessor) to move attributes from record level to resource level. For example: ```yaml # before switch to new collector @@ -45,7 +45,7 @@ After the new exporter will be moved to this repository: - my_attribute ``` -- Source templates (`source_category`, `source_name` and `source_host`) are going to be removed from the exporter and sources may be set using `_sourceCategory`, `sourceName` or `_sourceHost` resource attributes. This feature has been already disabled for metrics. We recommend to use [Transform Processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor/). For example: +- Source templates (`source_category`, `source_name` and `source_host`) are no longer supported. We recommend to use [Transform Processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor/). For example: ```yaml # before switch to new collector @@ -88,12 +88,12 @@ exporters: # List of regexes for attributes which should be send as metadata # default = [] # - # This option is deprecated: + # This option is unsupported: # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture metadata_attributes: [] - # format to use when sending logs to Sumo Logic, default = json, - log_format: {json, text} + # format to use when sending logs to Sumo Logic, default = otlp, + log_format: {otlp, json, text} # format to use when sending metrics to Sumo Logic, default = otlp, # NOTE: only `otlp` is supported when used with sumologicextension @@ -112,7 +112,7 @@ exporters: # Please regfer to Source temmplates for formatting explanation: # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#source-templates # - # This option is deprecated: + # This option is unsupported: # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture graphite_template: