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

release: metrics-sdk metrics-api #1641

Merged
merged 14 commits into from
Jul 30, 2024

Conversation

xuan-cao-swi
Copy link
Contributor

I'd like to suggest an alpha release for the metrics-api and metrics-sdk.

Releasing an alpha version of these metrics components could provide benefits to end-users who wish to adopt the technology and to contributors looking to gather feedback and refine the implementation based on actual usage scenarios.

@dmathieu
Copy link
Member

.alpha is kinda unique (should there be .alpha2, .alpha.2?)
Also, the semantic versioning spec says:

Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.

Based on that, it feels like releasing 0.0.1 should be good for an alpha stability.

@xuan-cao-swi
Copy link
Contributor Author

Sample prometheus graph on histogram and counter
demo-promethesus-1
demo-promethesus-2

Here is the script that generate the graph

require 'opentelemetry/sdk'
require 'opentelemetry-metrics-sdk'
require 'opentelemetry/exporter/otlp'
require 'vmstat'

ENV['OTEL_SERVICE_NAME'] = 'prometheus-metrics'

OpenTelemetry::SDK.configure
console_metric_exporter = OpenTelemetry::Exporter::OTLP::MetricsExporter.new
OpenTelemetry.meter_provider.add_metric_reader(console_metric_exporter)
meter = OpenTelemetry.meter_provider.meter("sample_ruby_meter_name")

mem_free_hist = meter.create_histogram("ff6fdf6a349c_mem_free", unit: 'smidgen')
mem_active_hist = meter.create_histogram("ff6fdf6a349c_mem_active", unit: 'smidgen')
mem_inactive_hist = meter.create_histogram("ff6fdf6a349c_mem_inactive", unit: 'smidgen')
mem_wired_hist = meter.create_histogram("ff6fdf6a349c_mem_wired", unit: 'smidgen')

random_number_generator_1 = meter.create_counter("ff6fdf6a349c_rand_1", unit: 'smidgen')
random_number_generator_2 = meter.create_counter("ff6fdf6a349c_rand_2", unit: 'smidgen')
random_number_generator_3 = meter.create_counter("ff6fdf6a349c_rand_3", unit: 'smidgen')
random_number_generator_4 = meter.create_counter("ff6fdf6a349c_rand_4", unit: 'smidgen')

loop do
  vmstat = Vmstat.snapshot
  memory_info = vmstat.memory

  total_memory = memory_info.wired + memory_info.active + memory_info.inactive + memory_info.free
  free = (memory_info.free.to_f / total_memory) * 100
  active = (memory_info.active.to_f / total_memory) * 100
  inactive = (memory_info.inactive.to_f / total_memory) * 100
  wired = (memory_info.wired.to_f / total_memory) * 100

  mem_free_hist.record(free.round(2), attributes: {'sample_attr' => '1'})
  mem_active_hist.record(active.round(2), attributes: {'sample_attr' => '2'})
  mem_inactive_hist.record(inactive.round(2), attributes: {'sample_attr' => '3'})
  mem_wired_hist.record(wired.round(2), attributes: {'sample_attr' => '4'})

  random_number_generator_1.add(rand(0..10), attributes: {'sample_attr' => '10'})
  random_number_generator_2.add(rand(10..20), attributes: {'sample_attr' => '11'})
  random_number_generator_3.add(rand(20..30), attributes: {'sample_attr' => '12'})
  random_number_generator_4.add(rand(30..40), attributes: {'sample_attr' => '13'})

  sleep 5
  OpenTelemetry.meter_provider.metric_readers.each(&:pull)
  sleep 10
  puts "========================= collect finished ========================="
end

@xuan-cao-swi
Copy link
Contributor Author

xuan-cao-swi commented Jun 13, 2024

Based on that, it feels like releasing 0.0.1 should be good for an alpha stability.

@dmathieu I am open to change the name for alpha release.

@hwo411
Copy link

hwo411 commented Jun 27, 2024

Looking forward to having the first alpha version. We're currently integrating Opentelemetry metrics in our apps (we already have traces) and would be great to also do it for Ruby (instead of using prometheus endpoint).

Copy link
Member

@mwear mwear left a comment

Choose a reason for hiding this comment

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

I agree we should make the experimental metrics sdk and api available as it's being developed. I would just like to get agreement from the other maintainers (cc @fbogsany @robertlaurin @dazuma ) on the gem name, version, and general plan for when we are ready to declare the package as stable.

I'd propose that we use the current gem names and major version of 0 as pointed out here: #1641 (comment) to indicate the package is under development. When we decide the package is stable, we can either move the metrics api / sdk into the stable sdk and api packages, or we can leave them independent, bump their versions to 1.x.y and reference them from the stable api / sdk packages. In either case, I think we are leaving the door open if we release using the current proposal. Are there any objections or concerns anyone has with this plan?

Copy link
Member

@mwear mwear left a comment

Choose a reason for hiding this comment

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

As discussed at the SIG meeting, we would like to release this later this week. Two things we would like to have before releasing are a README describing the usage and experimental state of the SDK and an issue for early adopters to provide feedback on. We plan on moving forward as discussed in #1641 (review) barring additional feedback.

metrics_api/lib/opentelemetry/metrics/version.rb Outdated Show resolved Hide resolved
metrics_sdk/lib/opentelemetry/sdk/metrics/version.rb Outdated Show resolved Hide resolved
@kaylareopelle
Copy link
Contributor

@xuan-cao-swi - I opened a PR with readmes for the metrics-sdk and metrics-api gems. It also includes a few small updates to the text in this PR.

xuan-cao-swi#3

@mwear
Copy link
Member

mwear commented Jul 25, 2024

I'll plan to merge this at EOD on Monday barring any new feedback.

@mwear mwear merged commit 8de0bd7 into open-telemetry:main Jul 30, 2024
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants