-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'open-telemetry:main' into otel-webserver-samplers
- Loading branch information
Showing
58 changed files
with
3,890 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# See Clang docs: http://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
BasedOnStyle: Chromium | ||
|
||
# Allow double brackets such as std::vector<std::vector<int>>. | ||
Standard: Cpp11 | ||
|
||
# Indent 2 spaces at a time. | ||
IndentWidth: 2 | ||
|
||
# Keep lines under 100 columns long. | ||
ColumnLimit: 100 | ||
|
||
# Always break before braces | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
# TODO(lujc) wait for clang-format-9 support in Chromium tools | ||
# AfterCaseLabel: true | ||
AfterClass: true | ||
AfterControlStatement: true | ||
AfterEnum: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterStruct: true | ||
AfterUnion: true | ||
BeforeCatch: true | ||
BeforeElse: true | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
|
||
# Keeps extern "C" blocks unindented. | ||
AfterExternBlock: false | ||
|
||
# Indent case labels. | ||
IndentCaseLabels: true | ||
|
||
# Right-align pointers and references | ||
PointerAlignment: Right | ||
|
||
# ANGLE likes to align things as much as possible. | ||
AlignOperands: true | ||
AlignConsecutiveAssignments: true | ||
|
||
# Use 2 space negative offset for access modifiers | ||
AccessModifierOffset: -2 | ||
|
||
# TODO(jmadill): Decide if we want this on. Doesn't have an "all or none" mode. | ||
AllowShortCaseLabelsOnASingleLine: false | ||
|
||
# Useful for spacing out functions in classes | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
|
||
# Indent nested PP directives. | ||
IndentPPDirectives: AfterHash | ||
|
||
# Include blocks style | ||
IncludeBlocks: Preserve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
exporters/fluentd/include/opentelemetry/exporters/geneva/geneva_exporter_options.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include <opentelemetry/exporters/fluentd/common/fluentd_common.h> | ||
#include<string> | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
|
||
namespace exporters { | ||
|
||
namespace geneva { | ||
|
||
constexpr const char *kUnixDomainScheme = "unix://"; | ||
constexpr const size_t kUnixDomainSchemeLength = 7; // length of "unix://" | ||
struct GenevaExporterOptions { | ||
|
||
/** socker path for unix domain socket. Should start with unix:// | ||
* Example unix:///tmp/.socket_geneva_exporter | ||
*/ | ||
std::string socket_endpoint ; | ||
|
||
/* number of retries before failing */ | ||
|
||
size_t retry_count = 2; | ||
|
||
/** | ||
* The maximum buffer/queue size. After the size is reached, spans/logs are | ||
* dropped. | ||
*/ | ||
size_t max_queue_size = 2048; // max buffer size dropping logs/spans | ||
|
||
/* The time interval between two consecutive exports. */ | ||
std::chrono::milliseconds schedule_delay_millis = std::chrono::milliseconds(5000); | ||
|
||
/** | ||
* The maximum batch size of every export. It must be smaller or | ||
* equal to max_queue_size. | ||
*/ | ||
size_t max_export_batch_size = 512; | ||
}; | ||
|
||
} | ||
} | ||
OPENTELEMETRY_END_NAMESPACE | ||
|
49 changes: 49 additions & 0 deletions
49
exporters/fluentd/include/opentelemetry/exporters/geneva/geneva_logger_exporter.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include "geneva_exporter_options.h" | ||
#include <opentelemetry/exporters/fluentd/common/socket_tools.h> | ||
#include <opentelemetry/exporters/fluentd/log/fluentd_exporter.h> | ||
#include <opentelemetry/sdk/logs/batch_log_record_processor.h> | ||
#include <opentelemetry/sdk/logs/logger_provider.h> | ||
#include <opentelemetry/logs/provider.h> | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
|
||
namespace exporters { | ||
|
||
namespace geneva { | ||
|
||
class GenevaLoggerExporter { | ||
|
||
public: | ||
|
||
static inline bool InitializeGenevaExporter( const GenevaExporterOptions options ) { | ||
// Use only unix-domain IPC for agent connectivity | ||
if (options.socket_endpoint.size() > kUnixDomainSchemeLength && options.socket_endpoint.substr(0, kUnixDomainSchemeLength) == std::string(kUnixDomainScheme)){ | ||
opentelemetry::exporter::fluentd::common::FluentdExporterOptions fluentd_options; | ||
fluentd_options.retry_count = options.retry_count; | ||
fluentd_options.endpoint = options.socket_endpoint; | ||
auto exporter = std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter>( | ||
new opentelemetry::exporter::fluentd::logs::FluentdExporter(fluentd_options)); | ||
auto processor = std::unique_ptr<opentelemetry::sdk::logs::LogRecordProcessor>( | ||
new opentelemetry::sdk::logs::BatchLogRecordProcessor(std::move(exporter), options.max_queue_size, options.schedule_delay_millis, options.max_export_batch_size)); | ||
auto provider = std::shared_ptr<opentelemetry::logs::LoggerProvider>( | ||
new opentelemetry::sdk::logs::LoggerProvider(std::move(processor))); | ||
// Set the global logger provider | ||
opentelemetry::logs::Provider::SetLoggerProvider(provider); | ||
return true; | ||
} else { | ||
#if defined(__EXCEPTIONS) | ||
throw new std::runtime_error("Invalid endpoint! Unix domain socket should have unix:// as url-scheme"); | ||
#endif | ||
return false; | ||
} | ||
} | ||
|
||
}; | ||
} | ||
} | ||
OPENTELEMETRY_END_NAMESPACE |
Oops, something went wrong.