Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/sumologic]: deprecate options which are going to be removed #23337

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .chloggen/drosiek-sumoexporter-deprecations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Use this changelog template to create an entry for release notes.
# If your change doesn't affect end users, such as a test fix or a tooling change,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: deprecation

# 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: deprecating options which are going to be removed

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [23059]

# (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: |-
The following options are going to be deprecated and removed in the future:

- `metric_format: {carbon2, graphite}` (leaving only `prometheus`)
- `metadata_attributes: [<regex>]`
- `graphite_template: <template>`
- `source_category: <template>`
- `source_name: <template>`
- `source_host: <template>`
73 changes: 73 additions & 0 deletions exporter/sumologicexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,61 @@
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
<!-- end autogenerated section -->

## Migration to new architecture

**This exporter is undergoing major changes right now.**

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 and they will not exist in the new version:

- `metric_format: {carbon2, graphite}`
- `metadata_attributes: [<regex>]`
- `graphite_template: <template>`
- `source_category: <template>`
- `source_name: <template>`
- `source_host: <template>`
Comment on lines +21 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to drop some other settings from the distro exporter very soon as well:

  • clear_logs_timestamp
  • routing_atttribute_to_drop
  • json_logs.add_timestamp
  • json_logs.flatten_body

Do you think we should mention them here as well, even though we haven't dropped them yet in the fork?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't mention them here, as they never existed in this repository code


After the new exporter will be moved to this repository:

- `carbon2` and `graphite` are going to be no longer supported and `prometheus` or `otlp` format should be used
- all resource level attributes are going to be treated 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:

```yaml
# before switch to new collector
exporters:
sumologic:
metadata_attribute:
- my_attribute
# after switch to new collector
processors:
groupbyattrs:
keys:
- 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. 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
exporters:
sumologic:
source_category: "%{foo}/constant/%{bar}"
# after switch to new collector
processors:
transformprocessor:
log_statements:
context: log
statements:
# set default value to unknown
- set(attributes["foo"], "unknown") where attributes["foo"] == nil
- set(attributes["bar"], "unknown") where attributes["foo"] == nil
# set _sourceCategory as "%{foo}/constant/%{bar}"
- set(resource.attributes["_sourceCategory"], Concat([attributes["foo"], "/constant/", attributes["bar"]], ""))
```

## Configuration

This exporter supports sending logs and metrics data to [Sumo Logic](https://www.sumologic.com/).
Traces are exported using native otlphttp exporter as described
[here](https://help.sumologic.com/Traces/Getting_Started_with_Transaction_Tracing)
Expand All @@ -30,12 +85,18 @@ exporters:

# List of regexes for attributes which should be send as metadata
# default = []
#
# This option is deprecated:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture
metadata_attributes: [<regex>]

# format to use when sending logs to Sumo Logic, default = json,
log_format: {json, text}

# format to use when sending metrics to Sumo Logic, default = prometheus,
#
# carbon2 and graphite are deprecated:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture
metric_format: {carbon2, graphite, prometheus}

# Template for Graphite format.
Expand All @@ -44,24 +105,36 @@ 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:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture
graphite_template: <template>

# Desired source category. Useful if you want to override the source category configured for the source.
#
# 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:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture
source_category: <template>

# Desired source name. Useful if you want to override the source name configured for the source.
#
# 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:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture
source_name: <template>

# Desired source host. Useful if you want to override the source hosy configured for the source.
#
# 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:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture
source_host: <template>

# timeout is the timeout for every attempt to send data to the backend,
Expand Down
25 changes: 25 additions & 0 deletions exporter/sumologicexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,31 @@ type sumologicexporter struct {
}

func initExporter(cfg *Config, settings component.TelemetrySettings) (*sumologicexporter, error) {

if cfg.MetricFormat == GraphiteFormat {
settings.Logger.Warn("`metric_format: graphite` nad `graphite_template` are deprecated and are going to be removed in the future. See https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture for more information")
}

if cfg.MetricFormat == Carbon2Format {
settings.Logger.Warn("`metric_format: carbon` is deprecated and is going to be removed in the future. See https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture for more information")
}

if len(cfg.MetadataAttributes) > 0 {
settings.Logger.Warn("`metadata_attributes: []` is deprecated and is going to be removed in the future. See https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture for more information")
}

if cfg.SourceCategory != "" {
settings.Logger.Warn("`source_category: <template>` is deprecated and is going to be removed in the future. See https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture for more information")
}

if cfg.SourceHost != "" {
settings.Logger.Warn("`source_host: <template>` is deprecated and is going to be removed in the future. See https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture for more information")
}

if cfg.SourceName != "" {
settings.Logger.Warn("`source_name: <template>` is deprecated and is going to be removed in the future. See https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter#migration-to-new-architecture for more information")
}

sfs := newSourceFormats(cfg)

f, err := newFilter(cfg.MetadataAttributes)
Expand Down