Skip to content

feat(examples): add dice roller getting started reference application#2048

Merged
kaylareopelle merged 6 commits into
open-telemetry:mainfrom
arjun-rajappa:add-dice-roller-example
Apr 6, 2026
Merged

feat(examples): add dice roller getting started reference application#2048
kaylareopelle merged 6 commits into
open-telemetry:mainfrom
arjun-rajappa:add-dice-roller-example

Conversation

@arjun-rajappa
Copy link
Copy Markdown
Contributor

Add a dice roller example application as the reference implementation for the OpenTelemetry Getting Started guide, as specified in: https://opentelemetry.io/docs/getting-started/reference-application-specification/

Includes:

  • Uninstrumented version (baseline Sinatra app)
  • Instrumented version with OpenTelemetry SDK, traces, metrics and logs
  • Dockerfile for containerized usage
  • README with setup and usage instructions
  • GitHub Actions workflow and composite action for CI

Closes #1928

Add a dice roller example application as the reference implementation
for the OpenTelemetry Getting Started guide, as specified in:
https://opentelemetry.io/docs/getting-started/reference-application-specification/

Includes:
- Uninstrumented version (baseline Sinatra app)
- Instrumented version with OpenTelemetry SDK, traces, metrics and logs
- Dockerfile for containerized usage
- README with setup and usage instructions
- GitHub Actions workflow and composite action for CI

Closes open-telemetry#1928

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
@arjun-rajappa arjun-rajappa force-pushed the add-dice-roller-example branch from c8cd36d to 2fa5c93 Compare March 2, 2026 05:35
@kaylareopelle
Copy link
Copy Markdown
Contributor

Thank you for opening this, @arjun-rajappa! Taking a look today.

Comment thread examples/dice_roller/README.md
Comment thread examples/dice_roller/instrumented/Gemfile Outdated
Comment thread examples/dice_roller/instrumented/app.rb Outdated
Comment thread examples/dice_roller/uninstrumented/app.rb Outdated
@kaylareopelle
Copy link
Copy Markdown
Contributor

Hi @arjun-rajappa - In the middle of a review, but not quite done yet. Will pick things up tomorrow. Sorry about the delay here.

Copy link
Copy Markdown
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

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

This is awesome, @arjun-rajappa! Thank you so much for this contribution. I think we're really close to being ready to merge. The main issue I see is one that @hannahramadan pointed out in her review.

The spec says:

if rolls is set to a 0 or a negative integer: status code 500 and no JSON output. The error examples will be used to demonstrate how OpenTelemetry can be used to identify errors.

There's a bit of cleanup to do to incorporate this behavior. Check out @hannahramadan's comments for good callouts. That was the main issue I noticed. I'll re-review after the 500 feature is added to the app.

Comment thread examples/dice_roller/instrumented/app.rb
Comment thread .github/actions/test_dice_roller/action.yml Outdated
Comment thread .github/workflows/ci-example-dice-roller.yml
Comment thread examples/dice_roller/README.md Outdated
Add container resource detector based on review feedback.

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Comment thread examples/dice_roller/instrumented/otel.rb Outdated
Copy link
Copy Markdown
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

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

Thank you for the updates, @arjun-rajappa! I noticed a few more things.

Comment thread examples/dice_roller/instrumented/otel.rb Outdated
Comment thread examples/dice_roller/instrumented/otel.rb Outdated
Comment thread examples/dice_roller/uninstrumented/app.rb Outdated
Comment thread examples/dice_roller/README.md
Comment thread examples/dice_roller/README.md Outdated
Comment thread examples/dice_roller/instrumented/app.rb Outdated
arjun-rajappa added a commit to arjun-rajappa/opentelemetry-ruby that referenced this pull request Mar 26, 2026
Remove redundant metrics and logs configuration code that is already
handled by OpenTelemetry::SDK.configure through configuration hooks.
Improve validation and code organization based on review comments.

Changes:
- Remove manual metrics/logs provider setup (handled by SDK configurator)
- Use OpenTelemetry.logger_provider.shutdown for consistency
- Move rolls assignment after validation for better code flow
- Update regex to only accept positive integers (/\A\d+\z/)
- Add multi-exporter example to README
- Document OTEL_LOG_LEVEL default value
- Fix markdown linting errors

Addresses review feedback from PR open-telemetry#2048

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
arjun-rajappa added a commit to arjun-rajappa/opentelemetry-ruby that referenced this pull request Mar 26, 2026
Remove redundant metrics and logs configuration code that is already
handled by OpenTelemetry::SDK.configure through configuration hooks.
Improve validation and code organization based on review comments.

Changes:
- Remove manual metrics/logs provider setup (handled by SDK configurator)
- Use OpenTelemetry.logger_provider.shutdown for consistency
- Move rolls assignment after validation for better code flow
- Update regex to only accept positive integers (/\A\d+\z/)
- Add multi-exporter example to README
- Document OTEL_LOG_LEVEL default value
- Fix markdown linting errors

Addresses review feedback from PR open-telemetry#2048

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
@arjun-rajappa arjun-rajappa force-pushed the add-dice-roller-example branch from eef0f5c to c2bcdb7 Compare March 26, 2026 16:54
Remove redundant metrics and logs configuration code that is already
handled by OpenTelemetry::SDK.configure through configuration hooks.
Improve validation and code organization based on review comments.

Changes:
- Remove manual metrics/logs provider setup (handled by SDK configurator)
- Use OpenTelemetry.logger_provider.shutdown for consistency
- Move rolls assignment after validation for better code flow
- Add multi-exporter example to README
- Document OTEL_LOG_LEVEL default value
- Fix markdown linting errors

Addresses review feedback from PR open-telemetry#2048

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
@arjun-rajappa arjun-rajappa force-pushed the add-dice-roller-example branch from c2bcdb7 to 63aefde Compare March 26, 2026 17:23
Copy link
Copy Markdown
Contributor

@xuan-cao-swi xuan-cao-swi left a comment

Choose a reason for hiding this comment

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

LGTM, please fix the Spelling Check ci


| Span name | Kind | Attributes |
|-----------------|------------|---------------------------------------------------------------------|
| `GET /rolldice` | `SERVER` | HTTP semantic conventions (via Sinatra instrumentation) |
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As this is an endpoint mentioned in the specification - incontent/en/docs/getting-started/reference-application-specification.md
Will be adding this word to ignored words CI / Spelling Check

The 'rolldice' endpoint is mentioned in the specification at
content/en/docs/getting-started/reference-application-specification.md
and should be excluded from spell checking.

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Copy link
Copy Markdown
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

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

Thank you for all your adjustments @arjun-rajappa! I noticed one small markdown formatting thing. After that's addressed, this is good to go.

OTEL_LOGS_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
OTEL_SERVICE_NAME=dice_roller \
ruby app.rb
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small formatting suggestion:

Suggested change
ruby app.rb
ruby app.rb
```

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Copy link
Copy Markdown
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

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

Thank you!

@kaylareopelle kaylareopelle merged commit 55e0215 into open-telemetry:main Apr 6, 2026
72 checks passed
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.

Add reference application for new Getting Started

4 participants