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

[Metricbeat] Migrate Ceph pool_disk to use ReporterV2 interface #11049

Merged

Conversation

berfinsari
Copy link
Contributor

@berfinsari berfinsari commented Mar 3, 2019

Refer to #10774 for more info

@berfinsari berfinsari requested a review from a team as a code owner March 3, 2019 06:08
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@sayden sayden added Metricbeat Metricbeat Team:Integrations Label for the Integrations team labels Mar 4, 2019
@sayden
Copy link
Contributor

sayden commented Mar 4, 2019

jenkins, test this please

Thank you very much for the contribution @berfinsari let's see what Jenkins says. It's awesome!

Copy link
Contributor

@sayden sayden left a comment

Choose a reason for hiding this comment

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

Hi @berfinsari sorry for the delay but we have had some issues with Ceph in previous migrations and I wanted to update with helpful info here. Guide to migration needed an update too.

In the guide we have introduced a new interface that looks like Fetch(reporter mb.ReporterV2) error (with error at the end) that is the preferred way now. You can omit this here however

@@ -36,6 +36,8 @@ var (
}.Build()
)

var logger = logp.NewLogger("ceph.pool_disk")
Copy link
Contributor

Choose a reason for hiding this comment

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

If you rebase to master, you can delete this and use base.Logger()

if err != nil {
return nil, err
logger.Error(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you rebase to master, you can use here m.Logger().Error(err) instead.

@@ -22,13 +22,20 @@ import (
"os"
"testing"

"github.com/stretchr/testify/assert"

mbtest "github.com/elastic/beats/metricbeat/mb/testing"
)

func TestData(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We have realized that this call mbtest.ReportingFetchV2(f) must be omitted here because this test must not be launched in CI and check is happening in mbtest.WriteEventsReporterV2 so it should end up looking more or less like this:

func TestData(t *testing.T) {
	f := mbtest.NewReportingMetricSetV2(t, getConfig())

	if err := mbtest.WriteEventsReporterV2(f, t, ""); err != nil {
		t.Fatal("write", err)
	}
}

This is the only important change here to avoid a flaky test that was happening

@sayden
Copy link
Contributor

sayden commented Mar 7, 2019

You can also check this Ceph PR #10990 as reference. Sorry about that, this module was one of the trickiest 😄

@berfinsari berfinsari force-pushed the migration/mb/reportv2/ceph/pool_disk branch from 0b4960c to aa09c23 Compare March 10, 2019 16:48
@berfinsari
Copy link
Contributor Author

Thank you for the review @sayden

@ruflin
Copy link
Member

ruflin commented Mar 13, 2019

jenkins, test this

@@ -32,6 +32,7 @@ import (

func TestFetchEventContents(t *testing.T) {
absPath, err := filepath.Abs("../_meta/testdata/")
assert.NoError(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

Copy link
Contributor

@sayden sayden left a comment

Choose a reason for hiding this comment

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

Good work!

@sayden sayden merged commit d27417b into elastic:master Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Metricbeat Metricbeat Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants