Openmetrics support using textparser#27269
Conversation
|
This pull request is now in conflicts. Could you fix it? 🙏 |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
|
This pull request is now in conflicts. Could you fix it? 🙏 |
|
This pull request is now in conflicts. Could you fix it? 🙏 |
|
This pull request is now in conflicts. Could you fix it? 🙏 |
|
Pinging @elastic/integrations (Team:Integrations) |
|
/test |
ChrsMark
left a comment
There was a problem hiding this comment.
Thank for this PR @premendrasingh , it is going into the right direction I think!
I left some comments inline, mostly about minors, but overall the patch looks good. My two main concenrs are:
- I see a lot of code duplication between between this module and prometheus module around helper functionalities. Wondering if we could handle it better by introducing one common library?
- I see we add new types with PR. Maybe this needs evaluation product-wise.
@exekias @jsoriano your feedback is more than welcome here :).
| return m.skipFamilyName(*family.Name) | ||
| } | ||
|
|
||
| func (m *MetricSet) skipFamilyName(family string) bool { |
There was a problem hiding this comment.
I see/expect some replication of code between the 2 modules (prometheus and openmetircs) so maybe we can move those methods to a utility library when we refactor prometheus module too.
There was a problem hiding this comment.
I think it will be better to have a separate PR for refactoring this into a utility library.
There was a problem hiding this comment.
Yeap, doing this when we change prometheus module to use textparser or in a different follow-up sounds good.
| ) | ||
|
|
||
| const ( | ||
| openMetricsTestSamples = `# TYPE first_metric gauge |
There was a problem hiding this comment.
Maybe also add a case with exemplars?
premendrasingh
left a comment
There was a problem hiding this comment.
Thanks for the review comments.
| - name: type | ||
| type: keyword | ||
| description: > | ||
| metric type |
There was a problem hiding this comment.
changed to Metric
| if m.skipFamily(family) { | ||
| continue | ||
| } | ||
| promEvents := m.promEventsGen.GenerateOpenMetricsEvents(family) |
There was a problem hiding this comment.
Yes, you are right. Changed to openMetricsEvents
| eventList[promEvent.Type][labelsHash]["exemplar"] = promEvent.Exemplars | ||
| } | ||
| // Accumulate metrics in the event | ||
| eventList[promEvent.Type][labelsHash].DeepUpdate(promEvent.Data) |
There was a problem hiding this comment.
jsoriano
left a comment
There was a problem hiding this comment.
I haven't looked into the details of how each metric type is handled, but overall this is looking good.
| github.com/Azure/go-autorest => github.com/Azure/go-autorest v14.2.0+incompatible | ||
| github.com/Microsoft/go-winio => github.com/bi-zone/go-winio v0.4.15 | ||
| github.com/Shopify/sarama => github.com/elastic/sarama v1.19.1-0.20210120173147-5c8cb347d877 | ||
| github.com/cucumber/godog => github.com/cucumber/godog v0.8.1 |
There was a problem hiding this comment.
Many changes here seem unrelated.
There was a problem hiding this comment.
Upstream rebase removed it.
There was a problem hiding this comment.
Umnm, there are still many other changes in go.sum that look unrelated (for google could, oracle, azure...).
There was a problem hiding this comment.
Cleaned up go.mod, go.sum. Please guide me if it is still not right.
|
This pull request is now in conflicts. Could you fix it? 🙏 |
|
/test |
|
/test |
|
/test |
ChrsMark
left a comment
There was a problem hiding this comment.
LGTM, thank you for contributing this one!
|
This pull request does not have a backport label. Could you fix it @premendrasingh? 🙏
NOTE: |
|
Thanks a lot @ChrsMark |
|
Happy to see this merged 🙂 Thanks @premendrasingh and @ChrsMark! |
Enhancement - Added openmetrics module to use Openmetrics parser.
What does this PR do?
This PR updated metricset in Openmetrics module. It handles metrics endpoints returning data with
Content-Type: application/openmetrics-textWhy is it important?
Many of our customers have data exposed in OpenMetrics format, but existing module piggy backs on Prometheus module which processes metrics only in expfmt, Openmetrics data is not handled properly. Hence the need for Openmetrics support also.
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.How to test this PR locally
Unit tests in openmetrics/collector can be used to test the metrics locally.
Setup a http server to serve Openmetrics data with HTTP header
Content-Type: application/openmetrics-textChange metricset in metricbeat.yml to use openmetrics/collector as shown below