Skip to content

Conversation

@dmehala
Copy link
Collaborator

@dmehala dmehala commented Jun 14, 2024

Description

Update the API:

  • extract_or_create_span always returns a span, either the extracted one or a new span if the extraction fail.
  • override_sampling_priority accepts SamplingPriority.

Motivation

create_span always returns a span, while extract_span may or may not return a span. Logically, one can think the behavior of extract_or_create_span should first attempt to extract_span, and if the extraction fails, it should then call create_span. At least, that's what the name of the function suggest and I think the desired behavior.

The other one is for simplicity's sake.

@dmehala dmehala requested a review from a team as a code owner June 14, 2024 09:12
@dmehala dmehala requested review from Anilm3 and pablomartinezbernardo and removed request for a team June 14, 2024 09:12
Copy link
Contributor

@pablomartinezbernardo pablomartinezbernardo left a comment

Choose a reason for hiding this comment

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

What is our policy for incompatible changes in the sdk? We are not following semver right?

@dmehala
Copy link
Collaborator Author

dmehala commented Jun 19, 2024

I think we used to follow semver. At least, that's the policy we are following rn.

@dmehala dmehala merged commit 32f0338 into main Jul 8, 2024
@dmehala dmehala deleted the dmehala/revise-api branch July 8, 2024 08:59
Comment on lines 76 to 78
// new trace (see `create_span`). Optionally specify a `config` indicating
// the attributes of the span. If a failure occurs, then return an error.
// Note that the absence of a span to extract is not considered an error.
Copy link
Contributor

Choose a reason for hiding this comment

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

  // Return a span extracted from the specified `reader` (see `extract_span`).
  // If there is no span to extract, or if an error occurs during extraction,
  // then return a span that is the root of a new trace (see `create_span`).
  // Optionally specify a `config` indicating the attributes of the span.

Fight the entropy!

At least, that's what the name of the function suggest and I think the desired behavior

Desired by whom? The advantage of allowing extraction errors to be returned is that the caller can, if desired, log the error. I anticipated "traces/sampling broken in Istio thingy" bugs whose root cause is extraction failing without making any noise. Likely you weighed this possibility and decided the benefit of Expected<Span> → Span outweighed the risk.

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.

4 participants