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

Add alertmanager exporter implementation #28906

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

mcube8
Copy link
Member

@mcube8 mcube8 commented Nov 6, 2023

Description: Export Implementation of Alertmanager Exporter
Second PR - exporter implementation

Link to tracking Issue: #23659

Testing: Unit tests for exporter implementation

Documentation: Readme and Sample Configs to use Alertmanager exporter

@mcube8 mcube8 requested a review from a team November 6, 2023 17:53
@mcube8 mcube8 changed the title Am exporter impl Alertmanager Exporter implementation Nov 6, 2023
@mcube8 mcube8 changed the title Alertmanager Exporter implementation [chore] alertmanager exporter implementation Nov 6, 2023

func (s *alertmanagerExporter) convertEventsToAlertPayload(events []*alertmanagerEvent) []model.Alert {

var payload []model.Alert
Copy link
Contributor

Choose a reason for hiding this comment

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

you can preassign the length of the payload based on the size of the events slice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for your review, I have removed chore from the pull request title and added a commit addressing your suggestions.

@atoulme
Copy link
Contributor

atoulme commented Nov 13, 2023

This should not be marked as a chore, and a changelog should be present.

@mcube8 mcube8 changed the title [chore] alertmanager exporter implementation Add alertmanager exporter implementation Nov 15, 2023
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Other than the comment about logging vs. returning errors, this LGTM.


msg, err := json.Marshal(payload)
if err != nil {
s.settings.Logger.Debug("error marshaling alert to JSON", zap.Error(err))
Copy link
Member

Choose a reason for hiding this comment

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

When you are returning an error, avoid logging it. Otherwise, users will end up seeing the same message twice: here, and from the caller.

If you are NOT returning an error (ie, when the error isn't decisive to stop the processing), it's fine to log it.

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

We have yet another version being released now, v0.90.0.

go.opentelemetry.io/collector/exporter v0.88.1-0.20231112151805-b570812b1e06
go.opentelemetry.io/collector/pdata v1.0.0-rcv0017.0.20231112151805-b570812b1e06
go.opentelemetry.io/collector/semconv v0.88.1-0.20231112151805-b570812b1e06
go.opentelemetry.io/collector/component v0.89.0
Copy link
Member

Choose a reason for hiding this comment

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

Sorry about this, but we have a new release happening right now: 0.90.0/1.0.0. I tried to update your PR to use that, but ran into some dependency issues. Once this PR is rebased and the CI is green, I'll merge this one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you! I have updated the exporter to use the new release. One of the checks is failing due to a post error, will retry and update here.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jpkrohling All checks have passed on retry, thank you.

@jpkrohling
Copy link
Member

@mcube8, this is still missing a changelog entry (see the failing CI check).

@mcube8
Copy link
Member Author

mcube8 commented Dec 6, 2023

@mcube8, this is still missing a changelog entry (see the failing CI check).

I have added it back, please check my new commit. Thanks!

@jpkrohling jpkrohling merged commit 10a79dc into open-telemetry:main Dec 6, 2023
83 checks passed
@github-actions github-actions bot added this to the next release milestone Dec 6, 2023
jayasai470 pushed a commit to jayasai470/opentelemetry-collector-contrib that referenced this pull request Dec 8, 2023
**Description:** Export Implementation of Alertmanager Exporter
Second PR - exporter implementation

**Link to tracking Issue:**
[open-telemetry#23659](open-telemetry#23569)

**Testing:** Unit tests for exporter implementation

**Documentation:** Readme and Sample Configs to use Alertmanager
exporter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants