Skip to content

Commit e3dcd5f

Browse files
fix: update metrics example (#1815)
* fix: update metrics example * Update examples/metrics_sdk/metrics_collect.rb Co-authored-by: Kayla Reopelle <87386821+kaylareopelle@users.noreply.github.com> * Update examples/metrics_sdk/metrics_collect_otlp.rb Co-authored-by: Kayla Reopelle <87386821+kaylareopelle@users.noreply.github.com> --------- Co-authored-by: Kayla Reopelle <87386821+kaylareopelle@users.noreply.github.com>
1 parent c7a0008 commit e3dcd5f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

examples/metrics_sdk/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ receivers:
3232
otlp:
3333
protocols:
3434
grpc:
35+
endpoint: 0.0.0.0:4317
3536
http:
36-
# Default endpoints: 0.0.0.0:4317 for gRPC and 0.0.0.0:4318 for HTTP
37+
endpoint: 0.0.0.0:4318
3738

3839
exporters:
3940
debug:

examples/metrics_sdk/metrics_collect.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
require 'opentelemetry/sdk'
1616
require 'opentelemetry-metrics-sdk'
1717

18+
# this example manually configures the exporter, turn off automatic configuration
19+
ENV['OTEL_METRICS_EXPORTER'] = 'none'
20+
1821
OpenTelemetry::SDK.configure
1922

2023
console_metric_exporter = OpenTelemetry::SDK::Metrics::Export::ConsoleMetricPullExporter.new

examples/metrics_sdk/metrics_collect_otlp.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
require 'opentelemetry-metrics-sdk'
1919
require 'opentelemetry-exporter-otlp-metrics'
2020

21+
# this example manually configures the exporter, turn off automatic configuration
22+
ENV['OTEL_METRICS_EXPORTER'] = 'none'
23+
2124
OpenTelemetry::SDK.configure
2225

2326
otlp_metric_exporter = OpenTelemetry::Exporter::OTLP::Metrics::MetricsExporter.new

0 commit comments

Comments
 (0)