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

Allow multiple Inst or resource for export #92

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

rdooley
Copy link
Contributor

@rdooley rdooley commented Mar 13, 2024

  • Currently if 2 tracer providers or 2 tracers are exporting, there is a first one in batch wins condition for exporting spans
  • This change moves encoding the body into its own function, and adds unittests for spans from different tracers and from different trace providers to ensure resource and il parts of the otlp export are set properly

lib/opentelemetry/trace/exporter/otlp.lua Outdated Show resolved Hide resolved
providers[spans[1].tracer.provider] = 1
for i, span in ipairs(spans) do
local rs_idx = providers[span.tracer.provider]
local ils_idx = tracers[span.tracer]
Copy link
Contributor

Choose a reason for hiding this comment

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

what is ils short for here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

instrumentation library, maybe this should become il_idx and rs_idx should become r_idx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh because rs is for resource spans and ils is for instrumentation library spans so this makes sense

lib/opentelemetry/trace/exporter/otlp.lua Outdated Show resolved Hide resolved
lib/opentelemetry/trace/exporter/otlp.lua Outdated Show resolved Hide resolved
* Currently if 2 tracer providers or 2 tracers are exporting, there is a
  first one in batch wins condition for exporting spans
* This change moves encoding the body into its own function, and adds
  unittests for spans from different tracers and from different trace
  providers to ensure resource and il parts of the otlp export are set
  properly
@@ -96,12 +96,57 @@ function _M.export_spans(self, spans)
}
}
}
local tracers = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is like tracer_ils_idx_map? 1:1 relationship between tracer and instrumentation library span index?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the set of all tracers in the incomoing set of spans, and the value stored is the index of that span's il on the ils of the span's provider's resource

@@ -96,12 +96,57 @@ function _M.export_spans(self, spans)
}
}
}
local tracers = {}
local providers = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto here - provider_resource_span_idx_map right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the short names for clarity, but not a blocking opinion for sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ln 103-104 make pretty clear how this is being used in my mind which is already polluted with knowledge of the underlying otlp proto structure

@yangxikun yangxikun merged commit f4fe913 into yangxikun:main Mar 17, 2024
4 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.

3 participants