Commit Graph

88 Commits

Author SHA1 Message Date
Bogdan Drutu 2bc783c7d3
Deprecated everything in exporterqueue, alias from exporterhelper (#12706)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-03-24 18:49:07 +00:00
Bogdan Drutu 12dd09fc2a
Deprecate exportehelper WithRequestQueue in favor of WithQueueBatch (#12679)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-03-19 23:02:29 +00:00
Bogdan Drutu d510c864ab
Remove exporterqueue.Factory and simplify exportehelper.WithQueueRequest (#12509)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-02-28 23:03:04 +00:00
Sindy Li 2efeae4bed
[exporter] moved mergeBatchFunc and mergeBatchSplitFunc to request (#11459)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This PR changes `mergeBatchFunc` and `mergeBatchSplit` function as a
member function of `batchRequest`.

<!-- Issue number if applicable -->
#### Link to tracking issue

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->
2024-10-21 13:39:25 -07:00
Sindy Li 527df61589
[exporter] Disable the API to pass in configurations using a callback that operates on batch sender (#11448)
#### Description

As part of the effort to solve
https://github.com/open-telemetry/opentelemetry-collector/issues/10368,
we no longer guarantee to initialize a `batchSender` when `batcher` is
enabled. Therefore, we would like to remove the interface to set
`mergeFunc` and `mergeSplitFunc` as a callback that operates on
`batchSender`. Instead, users should use the alternative
`WithBatchFuncs` that is a callback that operates `baseExporter`.

Context:
https://github.com/open-telemetry/opentelemetry-collector/pull/11414

#### Link to tracking issue

https://github.com/open-telemetry/opentelemetry-collector/issues/8122
https://github.com/open-telemetry/opentelemetry-collector/issues/10368

---------

Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-10-15 18:15:07 -07:00
Jade Guiton 368cdd0425
[exporterhelper] Remove deprecated aliases for Queue/TimeoutSettings (#11264)
#### Description

Follow-up to #11132 now that 0.110 has been released.

#### Link to tracking issue

Should be the final step for #6767.
2024-09-25 09:44:44 -07:00
Damien Mathieu df3c9e38a8
[chore] split exporterhelper so a separate profiles module can use it (#11215)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This is part of #11131, splitting the exporterhelper module with a new
`internal` submodule that holds everything shared by the signals.
This is so a new `exporterhelperprofiles` module can make use of the
shared structs.
2024-09-19 13:17:38 +02:00
Bogdan Drutu 8027d80aef
Avoid public APIs with internal params in custom Options (#11054)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-09-17 13:08:41 -07:00
Jade Guiton 6c2697c445
[exporterhelper] Rename Timeout/QueueSettings to Config (#11132)
#### Description

This PR renames `TimeoutSettings` and `QueueSettings` (as well as the
corresponding `NewDefault` functions) to `TimeoutConfig` and
`QueueConfig`, for naming consistency reasons.

The previous struct/function names are kept as deprecated aliases of the
new ones for now.

#### Link to tracking issue

Updates #6767  (edit: reworded by @mx-psi)

#### Testing

No behavior changes were made, so no additional testing should be
necessary.

The references to the aforementioned structs/functions in existing tests
have been renamed as well. This means the deprecated function aliases
are not tested, lowering the coverage a bit.

#### Documentation

The new functions are documented identically to the previous ones.
2024-09-11 18:27:12 +02:00
Sindy Li 79660359a6
[exporter] [chore] Initialize batchSender and queueSender after configuration (#11041)
#### Description

This PR changes initialization of `batchSender` and `queueSender` to
AFTER configuration. That way we get to access `queueConfig` and
`batcherConfig` in the same place.

Context: This is some pre-work for changing queue->batch from a pushing
model to a pulling model. We will be initialization a
`queueBatchSender(queueConfig, batcherConfig)` if both queue and batcher
are enabled and initialize `batchSender(batchConfig)` if only batcher is
enabled. This change enables us to achieve the goal without changing
config API.

#### Link to tracking issue

https://github.com/open-telemetry/opentelemetry-collector/issues/10368

#### Testing

Ran `opentelemetry-collector$ make` to make sure all tests still pass.

Co-authored-by: Pablo Baeyens <pablo.baeyens@datadoghq.com>
2024-09-06 14:31:43 +02:00
Alex Boten 11c5071c2e
[chore] newObsReport is no longer needed (#10957)
This is leftover from the refactor to make that func private to the
package. Removing it as all the callers can use newExporter directly.

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-08-26 12:16:41 -07:00
Antoine Toulme c469394c52
[exporterhelper] delete deprecated `exporterhelper.ObsReport` (#10779)
#### Description
Delete deprecated `exporterhelper.ObsReport` and
`exporterhelper.NewObsReport`

#### Link to tracking issue
Relates to
https://github.com/open-telemetry/opentelemetry-collector/issues/10592
2024-08-07 10:45:13 -07:00
Dmitrii Anoshin c239e73bbb
[exporterhelper] Add data_type attribute to internal queue metrics (#10593)
Add `data_type` attribute to the internal otelcol_exporter_queue_size
metric to report the type of data being processed.

All other metrics have the data type reported as part of their names. We
could've done the same for queue metrics, but that would introduce a
significant breaking change. We want to avoid that until we have all the
metrics standardized with OpenTelemetry semantic conventions.

Fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/9943
2024-07-23 14:02:54 -07:00
Carson Ip 4e1c2150b5
[exporterhelper] Fix small batch due to scheduling in batch sender (#10337)
#### Description

- Correctly keep track of bs.activeRequests, which denotes the number of
send waiting for next sender in chain to return. This is already done
before this PR, but in a way that is vulnerable to unfavorable goroutine
scheduling
- Decrease bs.activeRequests by the number of requests blocked by an
activeBatch at once, so that it workarounds the "bug" mentioned in (1).


#### Link to tracking issue
Fixes #9952

---------

Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
2024-06-12 10:11:29 -07:00
Alex Boten 7704414027
[exporterhelper] move queue metrics to mdatagen (#10318)
This uses mdatagen to generate the queue metrics. This will allow users
to see the metric in the documentation for exporter helper

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-06-10 12:25:57 -07:00
Alex Boten f0c8787d2b
[exporter] deprecate CreateSettings -> Settings (#10335)
This deprecates CreateSettings in favour of Settings.
NewNopCreateSettings is also being deprecated in favour of
NewNopSettings
    
Part of #9428

~Follows
https://github.com/open-telemetry/opentelemetry-collector/pull/10333~

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-06-06 08:03:40 -07:00
Dmitrii Anoshin 109173d9cf
[exporterhelper] Fix `enabled` config option for batch sender (#10076)
`enabled` config option for batch sender was ignored. This PR fixes it.
2024-05-03 09:40:40 -07:00
Dmitrii Anoshin 4b5d68ed28
[exporterhelper] Add default batching for OTLP data type (#9738)
Introduce default batching functionality based on the internal data type
(pdata). This makes the exporter batching capability available to the
regular exporter helpers without using custom requests.

Updates #8122
2024-03-27 16:04:08 -07:00
Dmitrii Anoshin 241334609f
[exporterhelper] Introduce batching functionality (#8685)
This change introduces new experimental batching functionality to the
exporter helper. The batch sender is fully concurrent and synchronous.
It's set after the queue sender, which, if enabled, introduces the
asynchronous behavior and ensures no data loss with the permanent queue.

Follow-up TODO list:
- Add pre-built merge funcs for pdata
- Handle partial errors
- A missing part compared to the batch processor is the ability to shard
the batches by context value.

Updates
https://github.com/open-telemetry/opentelemetry-collector/issues/8122
2024-03-07 16:42:01 -08:00
Pablo Baeyens a10268405b
[exporterhelper] Turn panics into errors (#9717) 2024-03-07 14:09:47 -08:00
Dmitrii Anoshin 0e6a9a0ace
[chore] [exporterhelper] Update notes for the experimental API (#9719)
Addressing
https://github.com/open-telemetry/opentelemetry-collector/pull/8685#discussion_r1514315859
2024-03-06 15:43:35 -08:00
Dmitrii Anoshin e7770fc00d
[chore] [exporterhelper] Remove duplicated code between exporter helpers (#9603) 2024-02-19 21:39:45 -08:00
Dmitrii Anoshin bdbb5f3d51
[exporterhelper] Add WithRequestQueue option to the exporter (#8853)
Introduce a way to enable queue in the new exporter helper with a
developer interface suggested in
https://github.com/open-telemetry/opentelemetry-collector/pull/8248#discussion_r1302102261.

The new configuration interface for the end users provides a new
`queue_size_items` option to limit the queue by a number of spans, log
records, or metric data points. The previous way to limit the queue by
number of requests is preserved under the same field, `queue_size,`
which will later be deprecated through a longer transition process.

Tracking issue:
https://github.com/open-telemetry/opentelemetry-collector/issues/8122
2024-02-03 09:24:05 -08:00
Dmitrii Anoshin 55a8c6b651
[exporterhelper] Cleanup logging for export failures (#9282)
This change makes the logging of the exported error failures cleaner.
1. Ensure an error message is logged every time and only once when data
is dropped/rejected due to export failure.
2. Update the wording. Specifically, don't use "dropped" term when an
error is reported back to the pipeline. If there is no queue configured,
the exporter doesn't drop data by itself but rather rejects it. Keep the
"dropped" wording for failures after the enabled queue.
3. Properly report any error reported by a queue. For example, a
persistent storage error must be reported as a storage error, not as
"queue overflow".

Fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/9219
2024-01-12 18:18:19 -08:00
Bogdan Drutu 6b12cc3203
Deprecate exporterhelper.RetrySettings in favor of configretry.BackOffConfig (#9091)
Depends on
https://github.com/open-telemetry/opentelemetry-collector/pull/9089

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-12-14 21:31:20 -08:00
Dmitrii Anoshin ef4a5be399
[exporterhelper] Do not re-enqueue failed requests (#9090)
The current re-enqueuing behavior is not obvious and cannot be
configured. It takes place only for persistent queue and only if
`retry_on_failure::enabled=true` even if `retry_on_failure` is a setting
for a different backoff retry strategy.

This change removes the re-enqueuing behavior in favor of the
`retry_on_failure` option. Consider increasing
`retry_on_failure::max_elapsed_time` to reduce chances of data loss.

Resolves
https://github.com/open-telemetry/opentelemetry-collector/issues/8382
2023-12-14 20:41:02 -08:00
Dmitrii Anoshin 8cec790c1c
[chore] [exporterhelper] Remove retry sender -> queue sender callback (#8985)
Use returned error instead to simplify the senders feedback loop. This
change preserves the behavior. Re-enqueueing of the temporary failures
depends on the enabled retry sender. This will be changed in the next
step when re-queueing becomes a configurable option
2023-11-26 16:46:30 -08:00
Dmitrii Anoshin a6c0bd4cba
[exporterhelper] Remove redundant request interfaces (#8867)
Pass request+context through the senders pipeline similar to what we do
in the collector's pipeline. Use a helper QueueRequest struct for
passing requests through queues

This changes also moves the experimental Request interface to a separate
package.
2023-11-13 18:37:16 -08:00
Bogdan Drutu 8e0f68261d
Avoid nil queue in queue_sender, consolidate implementation (#8862)
Also, fixes `WithRetry` called with a config that is disabled.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-11-13 09:59:47 -08:00
Bogdan Drutu 23500dda16
Use standard component Start/Shutdown func in exporterhelper (#8861)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-11-12 21:22:29 -08:00
Bogdan Drutu fd79d43c7a
Rename ProducerConsumerQueue to Queue (#8838)
* Rename Stop to Shutdown, add context and return error.
* Fix test nits.
* Return errors from Shutdown instead of log them.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-11-10 14:02:56 -08:00
David Ashpole 29c16a2bca
Log errors even when retry_on_failure is not used (#8792)
**Description:**

Fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/8791.
Logging errors normally happens in the retry exporter helper if
retry_on_failure is disabled:


66166c4cc3/exporter/exporterhelper/retry_sender.go (L108-L115)

When WithRetry is not specified in the component, no logging happens at
all. This change makes the "base" retry sender log errors, so that if a
component does not specify WithRetry, it still has errors logged,
similar to the behavior with disabled retry.
2023-11-01 16:05:46 -07:00
Alex Boten 844b628cf7
[exporterhelper] make enqueue failures available (#8674)
These metrics were only exporter either via OC or via the prometheus
exporter. Fixes #8673

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
2023-10-20 11:28:01 -07:00
Antonio Jimenez 7c5ecef11d
[telemetry] Enable sampling logging by default and apply it to all components (#8134)
The sampled logger configuration can be disabled easily by setting the `service::telemetry::logs::sampling::enabled` to `false`.
2023-09-29 09:36:09 -07:00
Alex Boten f9e0f1c836
rename exporterhelper obsreport method (#8499)
This aligns better with the other new methods in the various helper
modules.

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-09-20 16:28:49 -07:00
Alex Boten b80683375c
deprecate exporter API in obsreport (#8493)
The functionality has been moved into exporter helper. This is part of
#8492

There is no functional changes, just:
- code moved from `obsreport` to `exporterhelper`
- tests moved
- updated references to `obsreport.Exporter`,
`obsreport.ExporterSettings`, `obsreport.NewExporter`
- added aliases and temporary methods to replace ^^^ 
- removed duplicated Exporter name in new code location:
  - `obsreport.Exporter` -> `exporterhelper.Exporter`
  - `obsreport.ExporterSettings` -> `exporterhelper.Settings`
  - `obsreport.NewExporter` -> `exporterhelper.New`

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-09-20 09:32:43 -07:00
Dmitrii Anoshin 767b95e73a
[chore] [exporterhelper] Split exporter senders into different files (#8398)
This is a follow-up to
https://github.com/open-telemetry/opentelemetry-collector/pull/8369. No
functional changes, just moving the code around
2023-09-13 13:15:45 -07:00
Dmitrii Anoshin 4e71dc1a3c
[exporterhelper] Refactor options and baseExporter (#8369)
Separate all the parts of the baseExporter into an explicit chain of
request senders. It makes it easier to follow the data flow and add
additional senders.

This change also removes the baseSettings, because keeping the settings
is not needed anymore. All the options update the internal senders in
place.

This change also removes confusing error messages like "Exporting
failed. Dropping data. Try enabling sending_queue to survive temporary
failures" when the Queue is not even available in the exporter
(WithQueue option is not applied) which means users don't
`sending_queue` config option. Now, such messages are only shown when
the sending_queue (or retry_on_failure) is available, but not enabled by
the user.
2023-09-08 13:10:31 -07:00
Dmitrii Anoshin 7030388dde
[chore] [exporterhelper] Refactor queue initialization (#8284)
Make the queue initialization process consistent for both queue types.
Instead of having different workflows for memory and persistent queues,
this change breaks the initialization of both into two generic steps:
1. Queue factory: `NewBoundedMemoryQueue`, `NewPersistentQueue`
2. Start method: `queue.Start(context.Context, component.Host,
QueueSettings)`

This change:
- reduces coupling between `queuedRetrySender` and the queues;
- allows future refactoring of `queuedRetrySender`;
- allows future extraction of the queue package from the exporterhelper;
- makes it possible to have `WithRequestQueue` option for the new
exporter helper API as drafted in
https://github.com/open-telemetry/opentelemetry-collector/pull/8275.
2023-08-30 15:30:03 -07:00
Dmitrii Anoshin a2242f7c88
[exporterhelper] New exporter helper for custom requests (#8178)
Introduce a new exporter helper that operates over client-provided
requests instead of pdata. The helper user now has to provide
`Converter` - an interface with a function implementing translation of
pdata Metrics/Traces/Logs into a user-defined `Request`. `Request` is an
interface with only one required function `Export`.

It opens a door for moving batching to the exporter, where batches will
be built from client data format, instead of pdata. The batches can be
properly sized by custom request size, which can be different from OTLP.
The same custom request sizing will be applied to the sending queue. It
will also improve the performance of the sending queue retries for
non-OTLP exporters, they don't need to translate pdata on every retry.

This is an implementation alternative to
https://github.com/open-telemetry/opentelemetry-collector/pull/7874 as
suggested in
https://github.com/open-telemetry/opentelemetry-collector/pull/7874#discussion_r1278444371

Tracking Issue:
https://github.com/open-telemetry/opentelemetry-collector/issues/8122

---------

Co-authored-by: Alex Boten <alex@boten.ca>
2023-08-21 08:58:55 -07:00
Alex Boten 80d704deb4
[chore] use license shortform (#7694)
* [chore] use license shortform

To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052

Signed-off-by: Alex Boten <aboten@lightstep.com>

* make goporto

Signed-off-by: Alex Boten <aboten@lightstep.com>

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-05-18 13:11:17 -07:00
Bogdan Drutu 6a2dc302a9
Move exporter Factory and types to exporter package (#6672)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-12-07 10:20:34 -08:00
Bogdan Drutu d0fe772781
Deprecate component.Config.ID(), add helper for obsreporttest (#5870)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-11-29 14:35:49 -08:00
Bogdan Drutu 1028e3d2a2
Deprecate special Configs for each component type, use a standard opaque Config (#6617)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-11-23 15:02:54 -08:00
Gustavo Paiva 20e3aac004
deprecate obsreport.Must functions in favor of obsreport.New (#6510)
* deprecate obsreport.Must functions in favor of obsreport.New

* add changelog

* fix lint

* split changelog in two

* Update .chloggen/return_error_for_obsreport_new_functions.yaml

Co-authored-by: Bogdan Drutu <lazy@splunk.com>

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
2022-11-10 14:26:31 -08:00
Bogdan d6ed8246b6 Deprecate all types and funcs in config package
The main reason is to remove the circular dependency between the config (including sub-packages) and component. Here is the current state:
* component depends on config
* config/sub-package[grpc, http, etc.] depends on config & component

Because of this "circular" dependency, we cannot split for example "config" into its own module, only if all the other config sub-packages are also split.

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-11-05 10:04:49 -07:00
Bogdan Drutu 8bde9ee423
Unify exporterhelper.request and internal.PersistentRequest (#5841)
Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-08 11:35:49 -07:00
Bogdan Drutu fe226f3d86
Deprecate obsreport.[Processor|Exporter]Settings.Level and use MetricsLevel from CreateSettings (#5824)
Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-05 07:12:23 -07:00
Bogdan Drutu ce71309a1d
Deprecate consumerhelper, move helpers to consumer (#5006)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-03-16 05:24:33 -07:00
Bogdan Drutu b9a10cdc6e
Remove all deprecated funcs/structs from v0.46.0 (#4995)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-03-14 11:19:49 -07:00