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

Figure out how to share test helpers and logic between adapters #18

Closed
fbogsany opened this issue Jun 25, 2020 · 3 comments
Closed

Figure out how to share test helpers and logic between adapters #18

fbogsany opened this issue Jun 25, 2020 · 3 comments
Labels
help wanted Extra attention is needed stale Marks an issue/PR stale

Comments

@fbogsany
Copy link
Contributor

fbogsany commented Jun 25, 2020

Example:

_(
  easy.instance_eval { @otel_original_headers['traceparent'] }
).must_equal "00-#{span.trace_id.unpack1('H*')}-#{span.span_id.unpack1('H*')}-01"

This is a very common pattern in the adapter tests. It’s worth thinking about extracting this to a helper in the API or SDK. It can be accomplished with something like:

OpenTelemetry::Trace::Propagation::TraceContext::TraceParent.from_context(span).to_s

but that’s pretty wordy, may not work exactly like this, and doesn’t really reveal the intent terribly well. Something like the following would be better:

OpenTelemetry::Trace.to_traceparent(trace_id: span.trace_id, span_id: span.span_id, sampled: true)

I guess that’s even longer, but I think it is clearer.

Originally posted by @fbogsany in open-telemetry/opentelemetry-ruby#280

@fbogsany
Copy link
Contributor Author

@mwear commented:

+1 on wanting a helper. TBH, I like the first option better, because the second implicitly couples the Trace module to W3C trace context. Both are wordy, and I could see sticking it somewhere else altogether.

A related issue is that we don't have a good way to share a) test helpers, b) shared logic between adapters. We should think about how we want to solve that moving forward.

@fbogsany
Copy link
Contributor Author

Discussed in the SIG meeting:

  • have an opentelemetry-common gem for common helpers (http response code to status, semantic conventions, etc.) -- this should only depend on API
  • have an opentelemetry-testing gem for test helpers

@fbogsany fbogsany added the help wanted Extra attention is needed label Sep 22, 2020
@plantfansam plantfansam transferred this issue from open-telemetry/opentelemetry-ruby Jun 14, 2022
@github-actions
Copy link
Contributor

👋 This issue 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 issue will be closed eventually by the stale bot.

@github-actions github-actions bot added the stale Marks an issue/PR stale label Apr 27, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed stale Marks an issue/PR stale
Projects
None yet
Development

No branches or pull requests

1 participant