Skip to content

Conversation

@cretz
Copy link
Member

@cretz cretz commented Nov 4, 2024

What was changed

  • Added Temporalio::Metric::Meter and Temporalio::Metric and supporting structure
  • Exposed metric_meter in Temporalio::Runtime and Temporalio::Activity::Context for use by users

Checklist

  1. Closes [Feature Request] Metric meter implementation #169

@cretz cretz requested a review from a team November 4, 2024 14:50
# Conflicts:
#	temporalio/test/sig/test.rbs
#	temporalio/test/test.rb
Copy link
Member

@Sushisource Sushisource 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 one suggested change

Comment on lines +136 to +139
# @param opentelemetry [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is
# mutually exclusive with `prometheus`.
# @param prometheus [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually
# exclusive with `opentelemetry`.
Copy link
Member

Choose a reason for hiding this comment

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

Don't really love that. Can we just have two methods?

Copy link
Member Author

@cretz cretz Nov 4, 2024

Choose a reason for hiding this comment

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

This is a constructor and Ruby does not have overloads so you can't separate out the methods unless you made non-constructor static helpers which I don't think we'd want here. One thing we can do is have one union option. This is what we do in Python, but in .NET for typing reasons we have separate mutually exclusive fields. Granted Python brought these "metrics" specific options up to the Telemetry layer which we shouldn't do again, so they got to call this field metrics: Optional[Union[OpenTelemetryConfig, PrometheusConfig, MetricBuffer]]. If we combine for Ruby, what should we call the field? Surely not "metrics" (this is already inside of "metrics"). Open to names here. Otherwise, I think the mutually exclusive options like .NET is fine.

Copy link
Member

Choose a reason for hiding this comment

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

Static helpers would be OK by me I think, but, if that's atypical we don't have to

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's a bit atypical. Having mutually exclusive kwargs is pretty common. MetricsOptions.new(opentelemetry: whatever) or MetricsOptions.new(prometheus: whatever) reads well.

@cretz cretz merged commit 4599b85 into temporalio:main Nov 12, 2024
6 checks passed
@cretz cretz deleted the metric-meter branch November 12, 2024 15:17
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.

[Feature Request] Metric meter implementation

2 participants