opentelemetry-collector-contrib icon indicating copy to clipboard operation
opentelemetry-collector-contrib copied to clipboard

Add custom time format configuration option

Open nanorobocop opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. Opentelemetry stores time in timestamps with nanoseconds. But different storages or later processing may expect time in some different format. This is request to add custom time format to telemetry data. Custom time field could be just another attribute.

Describe the solution you'd like There're different places where adding attribute in desired time format could be added:

Custom time format is most useful for logs, since variety of log formats, so stanza time_parser looks more suitable for me. But I'd like to listen if this could be interesting to somebody else in some different place.

Describe alternatives you've considered no

Additional context no

nanorobocop avatar Aug 05 '22 01:08 nanorobocop

Added implementation of this idea - https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/12977

nanorobocop avatar Aug 05 '22 08:08 nanorobocop

This is request to add custom time format to telemetry data.

If I'm understanding correctly, you want a mechanism that will format a timestamp according to a custom format and write the resulting string value to a specified field.

I think this functionality would need to be implemented in the transformprocessor, and that it would need to be generic enough to apply to any pdata.Timestamp field. (Logs, metrics, and traces all have more than one timestamp field in their data models.)

I don't think it would be appropriate to implement this within pkg/stanza, since this is focused on log ingestion. That is not to say that the timestamp format logic could not be reused.

My suggestion is that we need a detailed proposal for a transform processor function.

djaglowski avatar Aug 05 '22 13:08 djaglowski

Pinging code owners: @TylerHelmuth @kentquirk @bogdandrutu. See Adding Labels via Comments if you do not have permissions to add labels yourself.

github-actions[bot] avatar Aug 05 '22 13:08 github-actions[bot]

I think a factory function could be created in the telemetry query language that could take a Path that returns a timestamp and converts it to a string based on a supplied format.

TylerHelmuth avatar Aug 05 '22 14:08 TylerHelmuth

Thanks for suggestions! Let me take a closer look at TQL.

nanorobocop avatar Aug 08 '22 00:08 nanorobocop

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

  • processor/transform: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley

See Adding Labels via Comments if you do not have permissions to add labels yourself.

github-actions[bot] avatar Nov 10 '22 03:11 github-actions[bot]

This issue has been closed as inactive because it has been stale for 120 days with no activity.

github-actions[bot] avatar May 27 '23 02:05 github-actions[bot]