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 signaltometrics connector to produce metrics from all signals #169

Merged
merged 20 commits into from
Oct 10, 2024

Conversation

lahsivjar
Copy link
Contributor

@lahsivjar lahsivjar commented Oct 7, 2024

signaltometrics is built as a connector that is capable of producing metrics from all signal types. The component utilizes OTTL to allow configuring the data and the metric types used to generate the metrics.

Related to: https://github.com/elastic/opentelemetry-dev/issues/372

Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Thanks, I think this is looking great.

So just to make sure I understand: summary and histogram metrics have a default count of either 1 (log records & datapoints) or adjusted count (spans)? And then users can override this if they wish. I think that is sensible, just double checking my understanding.

Then where we currently aggregate a total span/transaction duration & count, we would create two metric definitions: one that sums up the durations, and one that sums up the adjusted counts. I think for the latter we'll need to either expose a new OTTL path for the adjusted count, or add a new OTTL converter, as discussed on Slack.

connector/signaltometrics/config/config.go Outdated Show resolved Hide resolved
connector/signaltometrics/config/config.go Outdated Show resolved Hide resolved
connector/signaltometrics/config/config.go Outdated Show resolved Hide resolved
connector/signaltometrics/connector.go Outdated Show resolved Hide resolved
@lahsivjar lahsivjar marked this pull request as ready for review October 8, 2024 18:00
@lahsivjar lahsivjar requested a review from a team as a code owner October 8, 2024 18:00
Copy link
Contributor Author

@lahsivjar lahsivjar left a comment

Choose a reason for hiding this comment

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

@axw @felixbarny The PR is ready for review.

Comment on lines +1 to +3
# Signal to metrics connector

WIP
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[For reviewers] I will update this in a follow-up after all the configuration changes are in.

}

// NewAggregator creates a new instance of aggregator.
func NewAggregator[K any](metrics pmetric.Metrics) *Aggregator[K] {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[For reviewers] This is currently missing unit-tests and is only tested via the connector tests, I will add these as a follow-up.


func TestConnectorWithMetrics(t *testing.T) {
testCases := []string{
"sum",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[For reviewers] I haven't added tests for histograms for the metric to metric case. This is because, I couldn't think of a good example for these without implementing conditions (will be a follow-up). Use-cases like gauge to histograms OR histograms to exponential histograms will only make sense if we can add conditions on metric types or metric names. So, these will be added with the PR for conditions.

@lahsivjar lahsivjar requested review from axw and felixbarny October 8, 2024 18:07
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Beautiful! Mostly LGTM with minor comments. I do think we need a plan for start timestamp - have you already thought about what we should do there?

.github/dependabot.yml Show resolved Hide resolved
Comment on lines +142 to +143
// MetricInfo for a data type
type MetricInfo struct {
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps "MetricDefinition" would be a more informative name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use MetricDef for the parsed config (in the model/*), maybe we can use MetricConfig here? WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Does it matter if they have the same name? I think it's still a metric definition from the user's perspective. I wouldn't go with MetricConfig, since it's in the config package.

Anyway, not critical that we address this atm, we can come back to it.

connector/signaltometricsconnector/metadata.yaml Outdated Show resolved Hide resolved
connector/signaltometrics/config/config.go Outdated Show resolved Hide resolved
@lahsivjar lahsivjar requested review from axw and felixbarny October 9, 2024 10:53
@lahsivjar
Copy link
Contributor Author

@axw @felixbarny Addressed the concerns, for some of them I have created issues. Should be ready for another pass.

Copy link
Member

@felixbarny felixbarny left a comment

Choose a reason for hiding this comment

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

LGTM! Just a small nit about using the appropriate unit in the test case.

connector/signaltometricsconnector/metadata.yaml Outdated Show resolved Hide resolved
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Love it, thank you!

@lahsivjar lahsivjar merged commit fdc781e into elastic:main Oct 10, 2024
11 checks passed
@lahsivjar lahsivjar deleted the signaltometrics branch October 10, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants