Skip to content

Commit

Permalink
Remove EmitEvent to follow open-telemetry/opentelemetry-specificati…
Browse files Browse the repository at this point in the history
…on#2941

Signed-off-by: owent <[email protected]>
Fix `-Werror=suggest-override` and style

Signed-off-by: owent <[email protected]>
Fix ostream_log_test

Signed-off-by: owent <[email protected]>
Fix ostream print_value for `AttributeValue`

Signed-off-by: owent <[email protected]>
New Recordable of logs

Signed-off-by: owent <[email protected]>
Restore .vscode/launch.json

Signed-off-by: owent <[email protected]>
Fix warning.

Signed-off-by: owent <[email protected]>
Fix warnings in maintainer mode and ETW exporter

Signed-off-by: owent <[email protected]>
Add CHANGELOG

Signed-off-by: owent <[email protected]>
Allow to move 'nostd::unique_ptr<T>' into `nostd::shared_ptr<T>`

Signed-off-by: owent <[email protected]>
Do not use `std/type_traits.h` any more. Maybe we should remove this file later.

Signed-off-by: owent <[email protected]>
Allow to add rvalue into `CircularBuffer`

Signed-off-by: owent <[email protected]>
Finish new `LogRecord` for exporters.

Signed-off-by: owent <[email protected]>
Finish unit tests in API and SDK.
Exporters are still work in progress.

Signed-off-by: owent <[email protected]>
New `LogRecord` and `Recordable` implementations.

Signed-off-by: WenTao Ou <[email protected]>
  • Loading branch information
owent committed Nov 29, 2022
1 parent 308ec88 commit f5a22e7
Show file tree
Hide file tree
Showing 77 changed files with 2,206 additions and 1,374 deletions.
44 changes: 22 additions & 22 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug on Windows",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/<path-to-bin-file>",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false
},
{
"name": "Debug on Linux",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}/bazel-bin/<path to the bin file>",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Debug on Windows",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/<path-to-bin-file>",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false
},
{
"name": "Debug on Linux",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}/bazel-bin/<path to the bin file>",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText"
}
]
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Increment the:
* [BUILD] Add CMake OTELCPP_PROTO_PATH [#1730](https://github.com/open-telemetry/opentelemetry-cpp/pull/1730)
* [SEMANTIC CONVENTIONS] Upgrade to version 1.15.0
[#1761](https://github.com/open-telemetry/opentelemetry-cpp/pull/1761)
* [LOGS SDK] New LogRecord and logs::Recordable implementations.
[#1766](https://github.com/open-telemetry/opentelemetry-cpp/pull/1766)

Deprecation notes:

Expand Down
8 changes: 8 additions & 0 deletions api/include/opentelemetry/common/key_value_iterable_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <utility>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/nostd/utility.h"
#include "opentelemetry/version.h"

Expand Down Expand Up @@ -73,5 +74,12 @@ class KeyValueIterableView final : public KeyValueIterable
private:
const T *container_;
};

template <class T, nostd::enable_if_t<detail::is_key_value_iterable<T>::value> * = nullptr>
KeyValueIterableView<T> MakeKeyValueIterableView(const T &container) noexcept
{
return KeyValueIterableView<T>(container);
}

} // namespace common
OPENTELEMETRY_END_NAMESPACE
81 changes: 81 additions & 0 deletions api/include/opentelemetry/logs/log_record.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once
#ifdef ENABLE_LOGS_PREVIEW

# include "opentelemetry/common/attribute_value.h"
# include "opentelemetry/common/key_value_iterable.h"
# include "opentelemetry/common/timestamp.h"
# include "opentelemetry/logs/severity.h"
# include "opentelemetry/trace/span_id.h"
# include "opentelemetry/trace/trace_flags.h"
# include "opentelemetry/trace/trace_id.h"
# include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace logs
{
/**
* Maintains a representation of a log in a format that can be processed by a recorder.
*
* This class is thread-compatible.
*/
class LogRecord
{
public:
virtual ~LogRecord() = default;

/**
* Set the timestamp for this log.
* @param timestamp the timestamp to set
*/
virtual void SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept = 0;

/**
* Set the observed timestamp for this log.
* @param timestamp the timestamp to set
*/
virtual void SetObservedTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept = 0;

/**
* Set the severity for this log.
* @param severity the severity of the event
*/
virtual void SetSeverity(opentelemetry::logs::Severity severity) noexcept = 0;

/**
* Set body field for this log.
* @param message the body to set
*/
virtual void SetBody(const opentelemetry::common::AttributeValue &message) noexcept = 0;

/**
* Set an attribute of a log.
* @param key the name of the attribute
* @param value the attribute value
*/
virtual void SetAttribute(nostd::string_view key,
const opentelemetry::common::AttributeValue &value) noexcept = 0;

/**
* Set the trace id for this log.
* @param trace_id the trace id to set
*/
virtual void SetTraceId(const opentelemetry::trace::TraceId &trace_id) noexcept = 0;

/**
* Set the span id for this log.
* @param span_id the span id to set
*/
virtual void SetSpanId(const opentelemetry::trace::SpanId &span_id) noexcept = 0;

/**
* Inject trace_flags for this log.
* @param trace_flags the trace flags to set
*/
virtual void SetTraceFlags(const opentelemetry::trace::TraceFlags &trace_flags) noexcept = 0;
};
} // namespace logs
OPENTELEMETRY_END_NAMESPACE
#endif
Loading

0 comments on commit f5a22e7

Please sign in to comment.