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

feat: add basic implementation of asynchronous metrics #1610

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

xuan-cao-swi
Copy link
Contributor

Description

I'd like to make contribution on basic implementation on asynchronous metrics.

Related: #1386, Asynchronous Up Down Counter card, Asynchronous Gauge.
Spec: asynchronous-instrument-api

WIP:

  1. when multiple callbacks exist in single instrument, they may all impose (accumulative) modification on data points, which need further consideration of use case.

Copy link
Contributor

github-actions bot commented Apr 4, 2024

👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot

@github-actions github-actions bot added the stale label Apr 4, 2024
@kaylareopelle kaylareopelle added keep and removed stale labels Apr 4, 2024
end
end

def create_callback(callbacks)

Choose a reason for hiding this comment

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

I think create_callback is a bit of left over from some experimentation. We should probably remove it.

class ObservableCounter < OpenTelemetry::Metrics::Instrument::ObservableCounter
attr_reader :name, :unit, :description
# {ObservableCounter} is the SDK implementation of {OpenTelemetry::SDK::Metrics::Instrument::AsynchronousInstrument}.
# Asynchronous Counter is an asynchronous Instrument which reports non-additive, monotonically increasing value(s) when the instrument is being observed.

Choose a reason for hiding this comment

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

This comment is a bit confusing. I think it should read

Asynchronous Counter is an asynchronous Instrument which reports monotonically increasing value(s) when the instrument is being observed.

See the spec
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter

@@ -125,6 +125,10 @@ def register_synchronous_instrument(instrument)
end
end

def register_asynchronous_instrument(instrument)

Choose a reason for hiding this comment

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

Do we need both register_asynchronous_instrument and register_synchronous_instrument?
Could we not have just one function

# @api private
def register_instrument(instrument)
...
end

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.

None yet

4 participants