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

[receiver/azureeventhub] support parsing more time format #36762

Merged
merged 5 commits into from
Dec 16, 2024

Conversation

hgaol
Copy link
Member

@hgaol hgaol commented Dec 10, 2024

Description

Support parsing more time format by configuration instead of only iso8601.

Link to tracking issue

Fixes #36650

Testing

  • Added unit test for time parsing function
  • Validated locally to send data with time format in the issue and received successfully

Documentation

Add some new configurations, including time_format and time_offset.

receivers
  azureeventhub:
    connection: "xxxxx"
    format: "azure"
    # optional
    time_format:
      # All supported time format. Default is empty string array, which means using the current iso8601 parser. The format is based on https://pkg.go.dev/time#Layout. If no time-zone info, will use UTC time.
      logs: ["01/02/2006 15:04:05","2006-01-02 15:04:05","2006-01-02T15:04:05Z07:00"]
      metrics: [""]
      traces: [""]
    # optional
    time_offset:
      # The offset hours to parsed time. Mainly for cases when there's no time-zone info in time string. default is 0.
      logs: -8
      metrics: +8
      traces: -8

.chloggen/36650.yaml Outdated Show resolved Hide resolved
@atoulme
Copy link
Contributor

atoulme commented Dec 10, 2024

Please consider breaking this in 2 and having offset offered in a separate PR.

@hgaol
Copy link
Member Author

hgaol commented Dec 11, 2024

Please consider breaking this in 2 and having offset offered in a separate PR.

Thanks @atoulme for the careful review! I've removed time_offset in this PR and resolved issues in comments.

.chloggen/36650.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

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

looks good now. Some nits, but not necessary. Approved.

@hgaol
Copy link
Member Author

hgaol commented Dec 13, 2024

Hi @cparkins , could you help to take a look? thanks!

@atoulme atoulme added the ready to merge Code review completed; ready to merge by maintainers label Dec 14, 2024
@andrzej-stencel andrzej-stencel merged commit f72ef07 into open-telemetry:main Dec 16, 2024
170 checks passed
@github-actions github-actions bot added this to the next release milestone Dec 16, 2024
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…etry#36762)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Support parsing more time format by configuration instead of only
iso8601.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#36650 

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

- Added unit test for time parsing function
- Validated locally to send data with time format in the issue and
received successfully

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

Add some new configurations, including `time_format` and `time_offset`.

```yaml
receivers
  azureeventhub:
    connection: "xxxxx"
    format: "azure"
    # optional
    time_format:
      # All supported time format. Default is empty string array, which means using the current iso8601 parser. The format is based on https://pkg.go.dev/time#Layout. If no time-zone info, will use UTC time.
      logs: ["01/02/2006 15:04:05","2006-01-02 15:04:05","2006-01-02T15:04:05Z07:00"]
      metrics: [""]
      traces: [""]
    # optional
    time_offset:
      # The offset hours to parsed time. Mainly for cases when there's no time-zone info in time string. default is 0.
      logs: -8
      metrics: +8
      traces: -8
```

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

---------

Co-authored-by: Antoine Toulme <[email protected]>
mterhar pushed a commit to mterhar/opentelemetry-collector-contrib that referenced this pull request Dec 19, 2024
…etry#36762)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Support parsing more time format by configuration instead of only
iso8601.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#36650 

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

- Added unit test for time parsing function
- Validated locally to send data with time format in the issue and
received successfully

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

Add some new configurations, including `time_format` and `time_offset`.

```yaml
receivers
  azureeventhub:
    connection: "xxxxx"
    format: "azure"
    # optional
    time_format:
      # All supported time format. Default is empty string array, which means using the current iso8601 parser. The format is based on https://pkg.go.dev/time#Layout. If no time-zone info, will use UTC time.
      logs: ["01/02/2006 15:04:05","2006-01-02 15:04:05","2006-01-02T15:04:05Z07:00"]
      metrics: [""]
      traces: [""]
    # optional
    time_offset:
      # The offset hours to parsed time. Mainly for cases when there's no time-zone info in time string. default is 0.
      logs: -8
      metrics: +8
      traces: -8
```

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

---------

Co-authored-by: Antoine Toulme <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/translator/azure ready to merge Code review completed; ready to merge by maintainers receiver/azureeventhub
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure Functions logs dropped due to timestamp parsing error
4 participants