open-telemetry / open-telemetry/opentelemetry-cpp
Move implementation from SDK header files to SDK *.cc
@marcalff is already working on this.
Since Jul 18, 2022.
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 632
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 75
Description
This is a remaining item identified during review of PR #1420
For all the static variables found in SDK header files,
consider (to discuss) to either:
- move the code to the *.cc files instead,
- remove the static keyword,
- add comments to explain why use of static is safe.
List of variables identified:
File opentelemetry/sdk/common/empty_attributes.h
static const std::array<std::pair<std::string, int>, 0> array{};
static const opentelemetry::common::KeyValueIterableView<
std::array<std::pair<std::string, int>, 0>>
kEmptyAttributes(array);
File opentelemetry/sdk/metrics/aggregation/drop_aggregation.h
static DropPointData point_data;
File opentelemetry/sdk/metrics/exemplar/always_sample_filter.h
static nostd::shared_ptr<ExemplarFilter> alwaysSampleFilter{new AlwaysSampleFilter{}};
File opentelemetry/sdk/metrics/view/view_registry.h
static View view("otel-default-view");
File opentelemetry/sdk/resource/experimental_semantic_conventions.h
static const std::unordered_map<uint32_t, const char *> attribute_ids = { ... };
This one (attribute_ids) probably needs more investigation before doing any changes (strings resolved at compile time or runtime ?).
File opentelemetry/sdk/trace/multi_recordable.h
static std::unique_ptr<Recordable> empty(nullptr);
File opentelemetry/sdk/trace/span_data.h
static opentelemetry::sdk::resource::Resource resource =
static std::unique_ptr<opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary>
instrumentation_library =
Code cleanup, low priority.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.