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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

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.

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.

None yet

2 participants