Skip to content

Commit 047e35c

Browse files
authored
Merge branch 'main' into implement_resource_detectors
2 parents 9bc07e1 + 5f6d99f commit 047e35c

33 files changed

+2313
-12
lines changed

.github/workflows/benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
submodules: 'recursive'
2323
- name: Mount Bazel Cache
24-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
24+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
2525
env:
2626
cache-name: bazel_cache
2727
with:
@@ -60,7 +60,7 @@ jobs:
6060
egress-policy: audit
6161

6262
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
63-
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # main March 2025
63+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # main March 2025
6464
with:
6565
name: benchmark_results
6666
path: benchmarks

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ jobs:
643643
with:
644644
submodules: 'recursive'
645645
- name: Mount Bazel Cache
646-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
646+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
647647
env:
648648
cache-name: bazel_cache
649649
with:
@@ -669,7 +669,7 @@ jobs:
669669
with:
670670
submodules: 'recursive'
671671
- name: Mount Bazel Cache
672-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
672+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
673673
env:
674674
cache-name: bazel_cache
675675
with:
@@ -695,7 +695,7 @@ jobs:
695695
with:
696696
submodules: 'recursive'
697697
- name: Mount Bazel Cache
698-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
698+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
699699
env:
700700
cache-name: bazel_cache
701701
with:
@@ -721,7 +721,7 @@ jobs:
721721
with:
722722
submodules: 'recursive'
723723
- name: Mount Bazel Cache
724-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
724+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
725725
env:
726726
cache-name: bazel_cache
727727
with:
@@ -747,7 +747,7 @@ jobs:
747747
with:
748748
submodules: 'recursive'
749749
- name: Mount Bazel Cache
750-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
750+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
751751
env:
752752
cache-name: bazel_cache
753753
with:
@@ -773,7 +773,7 @@ jobs:
773773
with:
774774
submodules: 'recursive'
775775
- name: Mount Bazel Cache
776-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
776+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
777777
env:
778778
cache-name: bazel_cache
779779
with:
@@ -799,7 +799,7 @@ jobs:
799799
with:
800800
submodules: 'recursive'
801801
- name: Mount Bazel Cache
802-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
802+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
803803
env:
804804
cache-name: bazel_cache
805805
with:
@@ -825,7 +825,7 @@ jobs:
825825
with:
826826
submodules: 'recursive'
827827
- name: Mount Bazel Cache
828-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
828+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
829829
env:
830830
cache-name: bazel_cache
831831
with:
@@ -851,7 +851,7 @@ jobs:
851851
with:
852852
submodules: 'recursive'
853853
- name: Mount Bazel Cache
854-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
854+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
855855
env:
856856
cache-name: bazel_cache
857857
with:
@@ -873,7 +873,7 @@ jobs:
873873
with:
874874
submodules: 'recursive'
875875
- name: Mount Bazel Cache
876-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
876+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
877877
env:
878878
cache-name: bazel_cache
879879
with:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#include "opentelemetry/sdk/common/global_log_handler.h"
5+
#include "opentelemetry/sdk/logs/read_write_log_record.h"
6+
#include "opentelemetry/sdk/logs/recordable.h"
7+
8+
#include "custom_log_record_exporter.h"
9+
10+
std::unique_ptr<opentelemetry::sdk::logs::Recordable>
11+
CustomLogRecordExporter::MakeRecordable() noexcept
12+
{
13+
auto recordable = std::make_unique<opentelemetry::sdk::logs::ReadWriteLogRecord>();
14+
return recordable;
15+
}
16+
17+
opentelemetry::sdk::common::ExportResult CustomLogRecordExporter::Export(
18+
const opentelemetry::nostd::span<std::unique_ptr<opentelemetry::sdk::logs::Recordable>>
19+
& /* records */) noexcept
20+
{
21+
OTEL_INTERNAL_LOG_ERROR("CustomLogRecordExporter::Export(): YOUR CODE HERE");
22+
return opentelemetry::sdk::common::ExportResult::kSuccess;
23+
}
24+
25+
bool CustomLogRecordExporter::ForceFlush(std::chrono::microseconds /* timeout */) noexcept
26+
{
27+
OTEL_INTERNAL_LOG_ERROR("CustomLogRecordExporter::ForceFlush(): YOUR CODE HERE");
28+
return false;
29+
}
30+
31+
bool CustomLogRecordExporter::Shutdown(std::chrono::microseconds /* timeout */) noexcept
32+
{
33+
OTEL_INTERNAL_LOG_ERROR("CustomLogRecordExporter::Shutdown(): YOUR CODE HERE");
34+
return false;
35+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <chrono>
7+
#include <memory>
8+
#include <string>
9+
10+
#include "opentelemetry/nostd/span.h"
11+
#include "opentelemetry/sdk/common/exporter_utils.h"
12+
#include "opentelemetry/sdk/logs/exporter.h"
13+
#include "opentelemetry/sdk/logs/recordable.h"
14+
15+
class CustomLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExporter
16+
{
17+
public:
18+
CustomLogRecordExporter(const std::string &comment) : comment_(comment) {}
19+
CustomLogRecordExporter(CustomLogRecordExporter &&) = delete;
20+
CustomLogRecordExporter(const CustomLogRecordExporter &) = delete;
21+
CustomLogRecordExporter &operator=(CustomLogRecordExporter &&) = delete;
22+
CustomLogRecordExporter &operator=(const CustomLogRecordExporter &other) = delete;
23+
~CustomLogRecordExporter() override = default;
24+
25+
std::unique_ptr<opentelemetry::sdk::logs::Recordable> MakeRecordable() noexcept override;
26+
27+
opentelemetry::sdk::common::ExportResult Export(
28+
const opentelemetry::nostd::span<std::unique_ptr<opentelemetry::sdk::logs::Recordable>>
29+
&records) noexcept override;
30+
31+
bool ForceFlush(std::chrono::microseconds timeout) noexcept override;
32+
33+
bool Shutdown(std::chrono::microseconds timeout) noexcept override;
34+
35+
private:
36+
std::string comment_;
37+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#include <string>
5+
#include <utility>
6+
7+
#include "opentelemetry/sdk/configuration/document_node.h"
8+
#include "opentelemetry/sdk/configuration/extension_log_record_exporter_configuration.h"
9+
#include "opentelemetry/sdk/configuration/registry.h"
10+
#include "opentelemetry/sdk/logs/exporter.h"
11+
12+
#include "custom_log_record_exporter.h"
13+
#include "custom_log_record_exporter_builder.h"
14+
15+
std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter> CustomLogRecordExporterBuilder::Build(
16+
const opentelemetry::sdk::configuration::ExtensionLogRecordExporterConfiguration *model) const
17+
{
18+
// Read yaml attributes
19+
std::string comment = model->node->GetRequiredString("comment");
20+
21+
auto sdk = std::make_unique<CustomLogRecordExporter>(comment);
22+
23+
return sdk;
24+
}
25+
26+
void CustomLogRecordExporterBuilder::Register(opentelemetry::sdk::configuration::Registry *registry)
27+
{
28+
auto builder = std::make_unique<CustomLogRecordExporterBuilder>();
29+
registry->SetExtensionLogRecordExporterBuilder("my_custom_log_record_exporter",
30+
std::move(builder));
31+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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/extension_log_record_exporter_builder.h"
9+
#include "opentelemetry/sdk/configuration/extension_log_record_exporter_configuration.h"
10+
#include "opentelemetry/sdk/configuration/registry.h"
11+
#include "opentelemetry/sdk/logs/exporter.h"
12+
13+
class CustomLogRecordExporterBuilder
14+
: public opentelemetry::sdk::configuration::ExtensionLogRecordExporterBuilder
15+
{
16+
public:
17+
static void Register(opentelemetry::sdk::configuration::Registry *registry);
18+
19+
std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter> Build(
20+
const opentelemetry::sdk::configuration::ExtensionLogRecordExporterConfiguration *model)
21+
const override;
22+
};
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 <utility>
5+
6+
#include "opentelemetry/sdk/common/global_log_handler.h"
7+
#include "opentelemetry/sdk/logs/read_write_log_record.h"
8+
#include "opentelemetry/sdk/logs/recordable.h"
9+
10+
#include "custom_log_record_processor.h"
11+
12+
std::unique_ptr<opentelemetry::sdk::logs::Recordable>
13+
CustomLogRecordProcessor::MakeRecordable() noexcept
14+
{
15+
auto recordable = std::make_unique<opentelemetry::sdk::logs::ReadWriteLogRecord>();
16+
return recordable;
17+
}
18+
19+
void CustomLogRecordProcessor::OnEmit(
20+
std::unique_ptr<opentelemetry::sdk::logs::Recordable> &&span) noexcept
21+
{
22+
OTEL_INTERNAL_LOG_ERROR("CustomLogRecordProcessor::OnEnd(): YOUR CODE HERE");
23+
auto unused = std::move(span);
24+
}
25+
26+
bool CustomLogRecordProcessor::ForceFlush(std::chrono::microseconds /* timeout */) noexcept
27+
{
28+
OTEL_INTERNAL_LOG_ERROR("CustomLogRecordProcessor::ForceFlush(): YOUR CODE HERE");
29+
return false;
30+
}
31+
32+
bool CustomLogRecordProcessor::Shutdown(std::chrono::microseconds /* timeout */) noexcept
33+
{
34+
OTEL_INTERNAL_LOG_ERROR("CustomLogRecordProcessor::Shutdown(): YOUR CODE HERE");
35+
return false;
36+
}
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 <chrono>
7+
#include <memory>
8+
#include <string>
9+
10+
#include "opentelemetry/sdk/logs/processor.h"
11+
#include "opentelemetry/sdk/logs/recordable.h"
12+
13+
class CustomLogRecordProcessor : public opentelemetry::sdk::logs::LogRecordProcessor
14+
{
15+
public:
16+
CustomLogRecordProcessor(const std::string &comment) : comment_(comment) {}
17+
CustomLogRecordProcessor(CustomLogRecordProcessor &&) = delete;
18+
CustomLogRecordProcessor(const CustomLogRecordProcessor &) = delete;
19+
CustomLogRecordProcessor &operator=(CustomLogRecordProcessor &&) = delete;
20+
CustomLogRecordProcessor &operator=(const CustomLogRecordProcessor &other) = delete;
21+
~CustomLogRecordProcessor() override = default;
22+
23+
std::unique_ptr<opentelemetry::sdk::logs::Recordable> MakeRecordable() noexcept override;
24+
25+
void OnEmit(std::unique_ptr<opentelemetry::sdk::logs::Recordable> &&record) noexcept override;
26+
27+
bool ForceFlush(std::chrono::microseconds timeout) noexcept override;
28+
29+
bool Shutdown(std::chrono::microseconds timeout) noexcept override;
30+
31+
private:
32+
std::string comment_;
33+
};
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+
#include <string>
5+
#include <utility>
6+
7+
#include "opentelemetry/sdk/configuration/document_node.h"
8+
#include "opentelemetry/sdk/configuration/extension_log_record_processor_configuration.h"
9+
#include "opentelemetry/sdk/configuration/registry.h"
10+
#include "opentelemetry/sdk/logs/processor.h"
11+
12+
#include "custom_log_record_processor.h"
13+
#include "custom_log_record_processor_builder.h"
14+
15+
std::unique_ptr<opentelemetry::sdk::logs::LogRecordProcessor>
16+
CustomLogRecordProcessorBuilder::Build(
17+
const opentelemetry::sdk::configuration::ExtensionLogRecordProcessorConfiguration *model) const
18+
{
19+
// Read yaml attributes
20+
std::string comment = model->node->GetRequiredString("comment");
21+
22+
auto sdk = std::make_unique<CustomLogRecordProcessor>(comment);
23+
24+
return sdk;
25+
}
26+
27+
void CustomLogRecordProcessorBuilder::Register(
28+
opentelemetry::sdk::configuration::Registry *registry)
29+
{
30+
auto builder = std::make_unique<CustomLogRecordProcessorBuilder>();
31+
registry->SetExtensionLogRecordProcessorBuilder("my_custom_log_record_processor",
32+
std::move(builder));
33+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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/extension_log_record_processor_builder.h"
9+
#include "opentelemetry/sdk/configuration/extension_log_record_processor_configuration.h"
10+
#include "opentelemetry/sdk/configuration/registry.h"
11+
#include "opentelemetry/sdk/logs/processor.h"
12+
13+
class CustomLogRecordProcessorBuilder
14+
: public opentelemetry::sdk::configuration::ExtensionLogRecordProcessorBuilder
15+
{
16+
public:
17+
static void Register(opentelemetry::sdk::configuration::Registry *registry);
18+
19+
std::unique_ptr<opentelemetry::sdk::logs::LogRecordProcessor> Build(
20+
const opentelemetry::sdk::configuration::ExtensionLogRecordProcessorConfiguration *model)
21+
const override;
22+
};

0 commit comments

Comments
 (0)