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

New component: timestamp processor #16562

Closed
2 tasks
atoulme opened this issue Dec 1, 2022 · 7 comments
Closed
2 tasks

New component: timestamp processor #16562

atoulme opened this issue Dec 1, 2022 · 7 comments
Labels
processor/transform Transform processor

Comments

@atoulme
Copy link
Contributor

atoulme commented Dec 1, 2022

The purpose and use-cases of the new component

The purpose of this processor is to change the timestamp of all data that it processes (logs, traces, metrics) by adding or removing a static time duration.

Example configuration for the component

processors:
  timestamp:
    offset: "0h"

  timestamp/add2h:
    offset: "2h"

  timestamp/remove3h:
    offset: "-3h"

receivers:
  nop:

exporters:
  nop:

service:
  pipelines:
    metrics:
      receivers: [nop]
      processors: [timestamp, timestamp/add2h, timestamp/remove3h]
      exporters: [nop]

Telemetry data types supported

all

Is this a vendor-specific component?

  • This is a vendor-specific component
  • If this is a vendor-specific component, I am proposing to contribute this as a representative of the vendor.

Sponsor (optional)

No response

Additional context

This was needed at one point as a stop gap solution for one of our PoCs and it's possible the transformprocessor and ottl is a better solution long term. See original discussion #14142

If others find this processor has merit, I can help contribute it to contrib and help maintain it.

The name of the processor might be instead better named "clockskew" - please suggest.

@atoulme atoulme added the needs triage New item requiring triage label Dec 1, 2022
@fatsheep9146
Copy link
Contributor

@TylerHelmuth can this feature be implemented by transformprocessor?

@fatsheep9146 fatsheep9146 added the discussion needed Community discussion needed label Dec 1, 2022
@TylerHelmuth
Copy link
Member

I am mostly tracking the timestamp work via this issue: #16067. I think that with a change to returning time.Time we'll gain flexibility to handle situations like these.

@fatsheep9146 fatsheep9146 added the processor/transform Transform processor label Dec 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

Pinging code owners for processor/transform: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@atoulme
Copy link
Contributor Author

atoulme commented Dec 1, 2022

I have built this code here: https://github.com/signalfx/splunk-otel-collector/tree/main/pkg/processor/timestamp so the work would consist of taking the code and migrating it upstream.
From a bit of lessons learned building this one-off, there is a bit going into changing timestamps across different metrics, metric types, logs, traces.

A good example is: https://github.com/signalfx/splunk-otel-collector/blob/main/pkg/processor/timestamp/metric_processor.go#L58

I think the transformprocessor is the right tool to change one timestamp field, but this solution is a bit more generic as it tries to applies to any timestamp reported by any data record.

@atoulme
Copy link
Contributor Author

atoulme commented Jan 7, 2023

Another example:

span := ss.Spans().At(k)
					span.SetStartTimestamp(offsetFn(span.StartTimestamp()))
					span.SetEndTimestamp(offsetFn(span.EndTimestamp()))
					for l := 0; l < span.Events().Len(); l++ {
						e := span.Events().At(l)
						e.SetTimestamp(offsetFn(e.Timestamp()))
					}

For each span, we need to change timestamps of start, end, and event timestamps. I think this approach cannot easily be taken with the transform processor. WDYT?

@atoulme
Copy link
Contributor Author

atoulme commented Jan 25, 2023

Discussed SIG meeting 1/25:

  • should have an ottl condition
  • Not sure if it's a common problem
  • Might be useful for browsers, reset to now
  • Useful if instead of fixed adjustment, use an offset from now
  • at least 2 companies have their own timestamp processors. Need more flexibility.
  • adjusting for timezone or truncating duration, or setting a field to a new value "now"
  • still a feeling that the transform processor is a better solution, rather than a new processor.
  • https://github.com/honeycombio/opentelemetry-collector-configs/tree/main/timestampprocessor exists as well, different use case
  • templatize config source functionality for the transform processor - apply config that is used, use a function.

@atoulme atoulme removed discussion needed Community discussion needed needs triage New item requiring triage labels Feb 12, 2023
@atoulme
Copy link
Contributor Author

atoulme commented Feb 12, 2023

Closing as there is no path forward and the timestamp processor we use is too narrow for the types of use cases considered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processor/transform Transform processor
Projects
None yet
Development

No branches or pull requests

3 participants