-
Notifications
You must be signed in to change notification settings - Fork 651
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
Allow for Custom Trace and Span IDs Generation - IdsGenerator
for TracerProvider
#1152
Comments
How does Java implement this? Have you considered configuring generator globally like propagators or the provider is registered? |
OTel Java has an I briefly considered it but I decided against it based on this blurb in the specifications:
I thought that if we have a global solution then it would make it difficult to create additional |
Custom IDs would allow for users to set IDs that they need right at the beginning of a span. This is important if the downstream services or eventual backend that receives these spans need them to be in a certain format. The opentelemtry-java SDK and opentelemetry-js SDK do this as well.
Is your feature request related to a problem?
Yes, some backends depend on the trace being in a certain format. Failure to be in the correct format can mean the trace is rejected and unusable with some backends.
For example, the AWS X-Ray service depends on the the trace id format being in a certain format.
If the trace-id is not valid (because the backend parses the id and decides the trace was sent more than 30 min ago) the trace is rejected.
Describe the solution you'd like
Like the SDKs mentioned above, it would be helpful to define a
IdsGenerator
interface from which all Id Generators Classes will conform to and provide thegenerate_trace_id()
andgenerate_span_id()
functions.This will replace the same functions in the root of the
opentelemetry.sdk.trace
directory atopentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
This way users can specify the IdsGenerator they want in the TracerProvider config (e.g.
TracerProvider(ids_generator=AWSXRayIdsGenerator())
. Otherwise by default, theRandomIdsGenerator()
will be used.Describe alternatives you've considered
Additional context
The main ideas behind this change are:
IdsGenerator
interfaceRandomIdsGenerator()
class which implementsIdsGenerator
and is used byTracerProvider
IdsGenerator
in the config ofTracerProvider
generate_trace_id()
andgenerate_span_id()
functions.I started a DRAFT PR here
The text was updated successfully, but these errors were encountered: