Skip to content

Commit 80a9bea

Browse files
authored
Merge branch 'main' into fixes_tsan_with_clang_20
2 parents 6ce13d8 + ac1172e commit 80a9bea

File tree

70 files changed

+1912
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1912
-87
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
runs-on: ubuntu-24.04
5959
env:
6060
CXX_STANDARD: '17'
61+
CMAKE_VERSION: '3.14.0'
6162
BUILD_TYPE: 'Debug'
6263
steps:
6364
- name: Harden the runner (Audit all outbound calls)
@@ -70,6 +71,7 @@ jobs:
7071
- name: setup
7172
run: |
7273
sudo -E ./ci/setup_ci_environment.sh
74+
sudo -E ./ci/setup_cmake.sh
7375
- name: install dependencies
7476
run: |
7577
sudo -E apt-get update

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ Increment the:
2727
* [SDK] Implements options for the ParentBasedSampler with default values
2828
[#3553](https://github.com/open-telemetry/opentelemetry-cpp/pull/3553)
2929

30+
* [SDK] View should not have a unit
31+
[#3552](https://github.com/open-telemetry/opentelemetry-cpp/pull/3552)
32+
33+
Breaking changes:
34+
35+
* [SDK] View should not have a unit
36+
[#3552](https://github.com/open-telemetry/opentelemetry-cpp/pull/3552)
37+
* The `unit` parameter has been removed from the `View` constructor
38+
and `ViewFactory::Create` methods.
39+
* Please adjust SDK configuration code accordingly.
40+
3041
## [1.22 2025-07-11]
3142

3243
* [DOC] Udpate link to membership document

cmake/nlohmann-json.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ if(NOT nlohmann_json_FOUND)
3535
# Set the nlohmann_json_VERSION variable from the git tag.
3636
string(REGEX REPLACE "^v([0-9]+\\.[0-9]+\\.[0-9]+)$" "\\1" nlohmann_json_VERSION "${nlohmann-json_GIT_TAG}")
3737

38-
#Disable iwyu and clang-tidy
39-
if(TARGET nlohmann_json)
38+
# Disable iwyu and clang-tidy only if the CMake version is greater or equal to 3.19.
39+
# CMake 3.19+ is needed to set the iwyu and clang-tidy properties on the INTERFACE target
40+
if(TARGET nlohmann_json AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
4041
set_target_properties(nlohmann_json PROPERTIES CXX_INCLUDE_WHAT_YOU_USE ""
4142
CXX_CLANG_TIDY "")
4243
endif()

examples/metrics_simple/metrics_ostream.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ void InitMetrics(const std::string &name)
7171

7272
auto meter_selector = metrics_sdk::MeterSelectorFactory::Create(name, version, schema);
7373

74-
auto sum_view = metrics_sdk::ViewFactory::Create(name, "description", unit,
75-
metrics_sdk::AggregationType::kSum);
74+
auto sum_view =
75+
metrics_sdk::ViewFactory::Create(name, "description", metrics_sdk::AggregationType::kSum);
7676

7777
provider->AddView(std::move(instrument_selector), std::move(meter_selector), std::move(sum_view));
7878

@@ -84,7 +84,7 @@ void InitMetrics(const std::string &name)
8484

8585
auto observable_meter_selector = metrics_sdk::MeterSelectorFactory::Create(name, version, schema);
8686

87-
auto observable_sum_view = metrics_sdk::ViewFactory::Create(name, "test_description", unit,
87+
auto observable_sum_view = metrics_sdk::ViewFactory::Create(name, "test_description",
8888
metrics_sdk::AggregationType::kSum);
8989

9090
provider->AddView(std::move(observable_instrument_selector), std::move(observable_meter_selector),
@@ -109,7 +109,7 @@ void InitMetrics(const std::string &name)
109109
std::move(histogram_aggregation_config));
110110

111111
auto histogram_view = metrics_sdk::ViewFactory::Create(
112-
name, "description", unit, metrics_sdk::AggregationType::kHistogram, aggregation_config);
112+
name, "description", metrics_sdk::AggregationType::kHistogram, aggregation_config);
113113

114114
provider->AddView(std::move(histogram_instrument_selector), std::move(histogram_meter_selector),
115115
std::move(histogram_view));
@@ -132,7 +132,7 @@ void InitMetrics(const std::string &name)
132132
std::move(histogram_base2_aggregation_config));
133133

134134
auto histogram_base2_view = metrics_sdk::ViewFactory::Create(
135-
name, "description", unit, metrics_sdk::AggregationType::kBase2ExponentialHistogram,
135+
name, "description", metrics_sdk::AggregationType::kBase2ExponentialHistogram,
136136
base2_aggregation_config);
137137

138138
provider->AddView(std::move(histogram_base2_instrument_selector),

examples/otlp/grpc_metric_main.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ void InitMetrics(std::string &name)
8383
std::move(histogram_aggregation_config));
8484

8585
auto histogram_view = metric_sdk::ViewFactory::Create(
86-
name, "des", unit, metric_sdk::AggregationType::kBase2ExponentialHistogram,
87-
aggregation_config);
86+
name, "des", metric_sdk::AggregationType::kBase2ExponentialHistogram, aggregation_config);
8887

8988
provider->AddView(std::move(histogram_instrument_selector), std::move(histogram_meter_selector),
9089
std::move(histogram_view));

examples/prometheus/main.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void InitMetrics(const std::string &name, const std::string &addr)
6666

6767
auto meter_selector = metrics_sdk::MeterSelectorFactory::Create(name, version, schema);
6868

69-
auto sum_view = metrics_sdk::ViewFactory::Create(counter_name, "description", counter_unit,
69+
auto sum_view = metrics_sdk::ViewFactory::Create(counter_name, "description",
7070
metrics_sdk::AggregationType::kSum);
7171

7272
p->AddView(std::move(instrument_selector), std::move(meter_selector), std::move(sum_view));
@@ -80,8 +80,8 @@ void InitMetrics(const std::string &name, const std::string &addr)
8080

8181
auto histogram_meter_selector = metrics_sdk::MeterSelectorFactory::Create(name, version, schema);
8282

83-
auto histogram_view = metrics_sdk::ViewFactory::Create(
84-
histogram_name, "description", histogram_unit, metrics_sdk::AggregationType::kHistogram);
83+
auto histogram_view = metrics_sdk::ViewFactory::Create(histogram_name, "description",
84+
metrics_sdk::AggregationType::kHistogram);
8585

8686
p->AddView(std::move(histogram_instrument_selector), std::move(histogram_meter_selector),
8787
std::move(histogram_view));
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <memory>
7+
8+
#include "opentelemetry/sdk/configuration/console_log_record_exporter_builder.h"
9+
#include "opentelemetry/sdk/configuration/console_log_record_exporter_configuration.h"
10+
#include "opentelemetry/sdk/configuration/registry.h"
11+
#include "opentelemetry/sdk/logs/exporter.h"
12+
#include "opentelemetry/version.h"
13+
14+
OPENTELEMETRY_BEGIN_NAMESPACE
15+
namespace exporter
16+
{
17+
namespace logs
18+
{
19+
20+
class OPENTELEMETRY_EXPORT ConsoleLogRecordBuilder
21+
: public opentelemetry::sdk::configuration::ConsoleLogRecordExporterBuilder
22+
{
23+
public:
24+
static void Register(opentelemetry::sdk::configuration::Registry *registry);
25+
26+
std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter> Build(
27+
const opentelemetry::sdk::configuration::ConsoleLogRecordExporterConfiguration *model)
28+
const override;
29+
};
30+
31+
} // namespace logs
32+
} // namespace exporter
33+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <memory>
7+
8+
#include "opentelemetry/sdk/configuration/console_push_metric_exporter_builder.h"
9+
#include "opentelemetry/sdk/configuration/console_push_metric_exporter_configuration.h"
10+
#include "opentelemetry/sdk/configuration/registry.h"
11+
#include "opentelemetry/sdk/metrics/push_metric_exporter.h"
12+
#include "opentelemetry/version.h"
13+
14+
OPENTELEMETRY_BEGIN_NAMESPACE
15+
namespace exporter
16+
{
17+
namespace metrics
18+
{
19+
20+
class OPENTELEMETRY_EXPORT ConsolePushMetricBuilder
21+
: public opentelemetry::sdk::configuration::ConsolePushMetricExporterBuilder
22+
{
23+
public:
24+
static void Register(opentelemetry::sdk::configuration::Registry *registry);
25+
26+
std::unique_ptr<opentelemetry::sdk::metrics::PushMetricExporter> Build(
27+
const opentelemetry::sdk::configuration::ConsolePushMetricExporterConfiguration *model)
28+
const override;
29+
};
30+
31+
} // namespace metrics
32+
} // namespace exporter
33+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <memory>
7+
8+
#include "opentelemetry/sdk/configuration/console_span_exporter_builder.h"
9+
#include "opentelemetry/sdk/configuration/console_span_exporter_configuration.h"
10+
#include "opentelemetry/sdk/configuration/registry.h"
11+
#include "opentelemetry/sdk/trace/exporter.h"
12+
#include "opentelemetry/version.h"
13+
14+
OPENTELEMETRY_BEGIN_NAMESPACE
15+
namespace exporter
16+
{
17+
namespace trace
18+
{
19+
20+
class OPENTELEMETRY_EXPORT ConsoleSpanBuilder
21+
: public opentelemetry::sdk::configuration::ConsoleSpanExporterBuilder
22+
{
23+
public:
24+
static void Register(opentelemetry::sdk::configuration::Registry *registry);
25+
26+
std::unique_ptr<opentelemetry::sdk::trace::SpanExporter> Build(
27+
const opentelemetry::sdk::configuration::ConsoleSpanExporterConfiguration *model)
28+
const override;
29+
};
30+
31+
} // namespace trace
32+
} // namespace exporter
33+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#include <memory>
5+
#include <utility>
6+
7+
#include "opentelemetry/exporters/ostream/console_log_record_builder.h"
8+
#include "opentelemetry/exporters/ostream/log_record_exporter_factory.h"
9+
#include "opentelemetry/sdk/configuration/console_log_record_exporter_builder.h"
10+
#include "opentelemetry/sdk/configuration/console_log_record_exporter_configuration.h"
11+
#include "opentelemetry/sdk/configuration/registry.h"
12+
#include "opentelemetry/sdk/logs/exporter.h"
13+
#include "opentelemetry/version.h"
14+
15+
OPENTELEMETRY_BEGIN_NAMESPACE
16+
namespace exporter
17+
{
18+
namespace logs
19+
{
20+
21+
void ConsoleLogRecordBuilder::Register(opentelemetry::sdk::configuration::Registry *registry)
22+
{
23+
auto builder = std::make_unique<ConsoleLogRecordBuilder>();
24+
registry->SetConsoleLogRecordBuilder(std::move(builder));
25+
}
26+
27+
std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter> ConsoleLogRecordBuilder::Build(
28+
const opentelemetry::sdk::configuration::ConsoleLogRecordExporterConfiguration * /* model */)
29+
const
30+
{
31+
return OStreamLogRecordExporterFactory::Create();
32+
}
33+
34+
} // namespace logs
35+
} // namespace exporter
36+
OPENTELEMETRY_END_NAMESPACE

0 commit comments

Comments
 (0)