Skip to content

Commit

Permalink
Merge branch 'main' into multi-callback-approach
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Aug 1, 2022
2 parents 25e8e50 + d452e8e commit d52451c
Show file tree
Hide file tree
Showing 76 changed files with 658 additions and 591 deletions.
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,34 @@ Increment the:

## [Unreleased]

## [1.5.0] 2022-07-29

* [EXPORTER BUILD] Add resources to dep list of prometheus exporter test [#1527](https://github.com/open-telemetry/opentelemetry-cpp/pull/1527)
* [BUILD] Don't require applications using jaeger exporter to know about libcurl
[#1518](https://github.com/open-telemetry/opentelemetry-cpp/pull/1518)
* [EXPORTER] Inline print_value() in ostream exporter [#1512](https://github.com/open-telemetry/opentelemetry-cpp/pull/1512)
* [SDK] fix: urlPaser will incorrect parsing url like "http://abc.com/xxx@xxx/a/b"
[#1511](https://github.com/open-telemetry/opentelemetry-cpp/pull/1511)
* [SDK] Rename `InstrumentationLibrary` to `InstrumentationScope` [#1507](https://github.com/open-telemetry/opentelemetry-cpp/pull/1507)
* [BUILD] Try to build nlohmann-json only it's depended. [#1505](https://github.com/open-telemetry/opentelemetry-cpp/pull/1505)
* [EXPORTER BUILD] Link opentelemetry_api to ETW exporter test [#1503](https://github.com/open-telemetry/opentelemetry-cpp/pull/1503)
* [SDK] Add automatically semantic conventions from the spec (#873) [#1497](https://github.com/open-telemetry/opentelemetry-cpp/pull/1497)
* [SDK] Use template class for in-memory data. [#1496](https://github.com/open-telemetry/opentelemetry-cpp/pull/1496)
* [SDK] fix compiler warnings [#1499](https://github.com/open-telemetry/opentelemetry-cpp/pull/1499)
* [TRACE SDK] Add trace sdk builders (#1393) [#1471](https://github.com/open-telemetry/opentelemetry-cpp/pull/1471)
* [METRICS BUILD] Enable bazel build for metrics proto files [#1489](https://github.com/open-telemetry/opentelemetry-cpp/pull/1489)
* [METRICS EXPORTER] Add metrics OTLP/HTTP exporter [#1487](https://github.com/open-telemetry/opentelemetry-cpp/pull/1487)
* [EXPORTER] fix otlp grpc exporter naming [#1488](https://github.com/open-telemetry/opentelemetry-cpp/pull/1488)
* [BUILD] Remove `--config Debug` when installing. [#1480](https://github.com/open-telemetry/opentelemetry-cpp/pull/1480)
* [EXPORTER] Fix endpoint in otlp grpc exporter [#1474](https://github.com/open-telemetry/opentelemetry-cpp/pull/1474)
* [EXAMPLE] Fix memory ownership of InMemorySpanExporter (#1473) [#1471](https://github.com/open-telemetry/opentelemetry-cpp/pull/1471)
* [EXPORTER] Add metrics OTLP/HTTP exporter [#1487](https://github.com/open-telemetry/opentelemetry-cpp/pull/1487)
* [EXPORTER] OTLP http exporter allow concurrency session ([#1209](https://github.com/open-telemetry/opentelemetry-cpp/pull/1209))
* [EXPORTER TESTS] Prometheus unit test [#1461](https://github.com/open-telemetry/opentelemetry-cpp/pull/1461)
* [DOCS] Update docs to use relative code links. [#1447](https://github.com/open-telemetry/opentelemetry-cpp/pull/1447)
* [SDK] Remove reference to deprecated InstrumentationLibrary in OTLP [#1469](https://github.com/open-telemetry/opentelemetry-cpp/pull/1469)
* [SDK] Fix trace kIsSampled flag set incorrectly [#1465](https://github.com/open-telemetry/opentelemetry-cpp/pull/1465)
* [METRICS EXPORTER] OTLP gRPC Metrics Exporter [#1454](https://github.com/open-telemetry/opentelemetry-cpp/pull/1454)
* [EXPORTER] fix prometheus exporter failure type [#1460](https://github.com/open-telemetry/opentelemetry-cpp/pull/1460)
* [SDK] Fix build warnings about missing aggregates. [#1368](https://github.com/open-telemetry/opentelemetry-cpp/pull/1368)
* [EXT] `curl::HttpClient` use `curl_multi_handle` instead of creating a thread
for every request and it's able to reuse connections now. ([#1317](https://github.com/open-telemetry/opentelemetry-cpp/pull/1317))
* [SEMANTIC CONVENTIONS] Upgrade to version 1.12.0 [#873](https://github.com/open-telemetry/opentelemetry-cpp/pull/873)
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "opentelemetry/detail/preprocessor.h"

#define OPENTELEMETRY_ABI_VERSION_NO 1
#define OPENTELEMETRY_VERSION "1.4.1"
#define OPENTELEMETRY_VERSION "1.5.0"
#define OPENTELEMETRY_ABI_VERSION OPENTELEMETRY_STRINGIFY(OPENTELEMETRY_ABI_VERSION_NO)

// clang-format off
Expand Down
2 changes: 1 addition & 1 deletion docs/cpp-metrics-api-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ implementation of the `MeterProvider` into the API
**`GetMeter(name, version)` method must be supported**

* Expects 2 string arguments:
* name (required): identifies the instrumentation library.
* name (required): identifies the instrumentation scope.
* version (optional): specifies the version of the instrumenting library (the
library injecting OpenTelemetry calls into the code)

Expand Down
4 changes: 2 additions & 2 deletions docs/cpp-metrics-sdk-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ implementation of the `MeterProvider` into the API.
**`GetMeter(name, version)` method must be supported**

* Expects 2 string arguments:
* name (required): identifies the instrumentation library.
* name (required): identifies the instrumentation scope.
* version (optional): specifies the version of the instrumenting library (the
library injecting OpenTelemetry calls into the code).

Expand Down Expand Up @@ -142,7 +142,7 @@ public:
*
* Arguments:
* MeterProvider, the MeterProvider object that spawned this Meter.
* InstrumentationInfo, the name of the instrumentation library and, optionally,
* InstrumentationInfo, the name of the instrumentation scope and, optionally,
* the version.
*
*/
Expand Down
1 change: 1 addition & 0 deletions docs/public/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ INPUT = \
../../api/include/opentelemetry/nostd/unique_ptr.h \
../../api/include/opentelemetry/nostd/variant.h \
../../api/include/opentelemetry/trace \
../../sdk/include/opentelemetry/sdk/instrumentationscope \
../../sdk/include/opentelemetry/sdk/instrumentationlibrary \
../../sdk/include/opentelemetry/sdk/resource \
../../sdk/include/opentelemetry/sdk/trace
Expand Down
2 changes: 1 addition & 1 deletion docs/public/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
author = 'OpenTelemetry authors'

# The full version, including alpha/beta/rc tags
release = '1.4.1'
release = "1.5.0"

# Run sphinx on subprojects and copy output
# -----------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# include <unordered_map>

# include "nlohmann/json.hpp"
# include "opentelemetry/common/macros.h"
# include "opentelemetry/sdk/common/attribute_utils.h"
# include "opentelemetry/sdk/logs/recordable.h"
# include "opentelemetry/version.h"
Expand Down Expand Up @@ -201,27 +202,34 @@ class ElasticSearchRecordable final : public sdk::logs::Recordable
nlohmann::json GetJSON() noexcept { return json_; }

/**
* Set instrumentation_library for this log.
* @param instrumentation_library the instrumentation library to set
* Set instrumentation_scope for this log.
* @param instrumentation_scope the instrumentation scope to set
*/
void SetInstrumentationLibrary(
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
&instrumentation_library) noexcept
void SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope
&instrumentation_scope) noexcept override
{
json_["name"] = instrumentation_library.GetName();
instrumentation_library_ = &instrumentation_library;
json_["name"] = instrumentation_scope.GetName();
instrumentation_scope_ = &instrumentation_scope;
}

/** Returns the associated instruementation library */
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary &
GetInstrumentationLibrary() const noexcept
OPENTELEMETRY_DEPRECATED_MESSAGE("Please use GetInstrumentationScope instead")
const opentelemetry::sdk::instrumentationscope::InstrumentationScope &GetInstrumentationLibrary()
const noexcept
{
return *instrumentation_library_;
return GetInstrumentationScope();
}

/** Returns the associated instruementation library */
const opentelemetry::sdk::instrumentationscope::InstrumentationScope &GetInstrumentationScope()
const noexcept
{
return *instrumentation_scope_;
}

private:
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
*instrumentation_library_ = nullptr;
const opentelemetry::sdk::instrumentationscope::InstrumentationScope *instrumentation_scope_ =
nullptr;
};
} // namespace logs
} // namespace exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ class JaegerRecordable final : public sdk::trace::Recordable

void SetDuration(std::chrono::nanoseconds duration) noexcept override;

void SetInstrumentationLibrary(
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
&instrumentation_library) noexcept override;
void SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope
&instrumentation_scope) noexcept override;

private:
void AddTag(const std::string &key, const std::string &value, std::vector<thrift::Tag> &tags);
Expand Down
10 changes: 5 additions & 5 deletions exporters/jaeger/src/recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ void JaegerRecordable::AddEvent(nostd::string_view name,
logs_.push_back(log);
}

void JaegerRecordable::SetInstrumentationLibrary(
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
&instrumentation_library) noexcept
void JaegerRecordable::SetInstrumentationScope(
const opentelemetry::sdk::instrumentationscope::InstrumentationScope
&instrumentation_scope) noexcept
{
AddTag("otel.library.name", instrumentation_library.GetName(), tags_);
AddTag("otel.library.version", instrumentation_library.GetVersion(), tags_);
AddTag("otel.library.name", instrumentation_scope.GetName(), tags_);
AddTag("otel.library.version", instrumentation_scope.GetVersion(), tags_);
}

void JaegerRecordable::AddLink(const trace::SpanContext &span_context,
Expand Down
14 changes: 7 additions & 7 deletions exporters/jaeger/test/jaeger_recordable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <vector>
#include "opentelemetry/exporters/jaeger/recordable.h"
#include "opentelemetry/sdk/instrumentationlibrary/instrumentation_library.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/sdk/trace/simple_processor.h"
#include "opentelemetry/sdk/trace/span_data.h"
#include "opentelemetry/sdk/trace/tracer_provider.h"
Expand All @@ -18,7 +18,7 @@ namespace common = opentelemetry::common;

using namespace jaegertracing;
using namespace opentelemetry::exporter::jaeger;
using namespace opentelemetry::sdk::instrumentationlibrary;
using namespace opentelemetry::sdk::instrumentationscope;
using std::vector;

using Attributes = std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>;
Expand Down Expand Up @@ -247,15 +247,15 @@ TEST(JaegerSpanRecordable, SetAttributes)
EXPECT_EQ(tags, expected_tags);
}

TEST(JaegerSpanRecordable, SetInstrumentationLibrary)
TEST(JaegerSpanRecordable, SetInstrumentationScope)
{
JaegerRecordable rec;

std::string library_name = "opentelemetry-cpp";
std::string library_version = "0.1.0";
auto instrumentation_library = InstrumentationLibrary::Create(library_name, library_version);
std::string library_name = "opentelemetry-cpp";
std::string library_version = "0.1.0";
auto instrumentation_scope = InstrumentationScope::Create(library_name, library_version);

rec.SetInstrumentationLibrary(*instrumentation_library);
rec.SetInstrumentationScope(*instrumentation_scope);

auto tags = rec.Tags();
EXPECT_EQ(tags.size(), 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class OStreamMetricExporter final : public opentelemetry::sdk::metrics::MetricEx
bool is_shutdown_ = false;
mutable opentelemetry::common::SpinLockMutex lock_;
bool isShutdown() const noexcept;
void printInstrumentationInfoMetricData(
const sdk::metrics::InstrumentationInfoMetrics &info_metrics);
void printInstrumentationInfoMetricData(const sdk::metrics::ScopeMetrics &info_metrics);
void printPointData(const opentelemetry::sdk::metrics::PointType &point_data);
void printPointAttributes(const opentelemetry::sdk::metrics::PointAttributes &point_attributes);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ class OStreamSpanExporter final : public opentelemetry::sdk::trace::SpanExporter

void printResources(const opentelemetry::sdk::resource::Resource &resources);

void printInstrumentationLibrary(
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
&instrumentation_library);
void printInstrumentationScope(
const opentelemetry::sdk::instrumentationscope::InstrumentationScope &instrumentation_scope);
};
} // namespace trace
} // namespace exporter
Expand Down
12 changes: 6 additions & 6 deletions exporters/ostream/src/metric_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,27 @@ sdk::common::ExportResult OStreamMetricExporter::Export(
if (isShutdown())
{
OTEL_INTERNAL_LOG_ERROR("[OStream Metric] Exporting "
<< data.instrumentation_info_metric_data_.size()
<< data.scope_metric_data_.size()
<< " records(s) failed, exporter is shutdown");
return sdk::common::ExportResult::kFailure;
}

for (auto &record : data.instrumentation_info_metric_data_)
for (auto &record : data.scope_metric_data_)
{
printInstrumentationInfoMetricData(record);
}
return sdk::common::ExportResult::kSuccess;
}

void OStreamMetricExporter::printInstrumentationInfoMetricData(
const sdk::metrics::InstrumentationInfoMetrics &info_metric)
const sdk::metrics::ScopeMetrics &info_metric)
{
// sout_ is shared
const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(lock_);
sout_ << "{";
sout_ << "\n name\t\t: " << info_metric.instrumentation_library_->GetName()
<< "\n schema url\t: " << info_metric.instrumentation_library_->GetSchemaURL()
<< "\n version\t: " << info_metric.instrumentation_library_->GetVersion();
sout_ << "\n name\t\t: " << info_metric.scope_->GetName()
<< "\n schema url\t: " << info_metric.scope_->GetSchemaURL()
<< "\n version\t: " << info_metric.scope_->GetVersion();
for (const auto &record : info_metric.metric_data_)
{
sout_ << "\n start time\t: " << timeToString(record.start_ts)
Expand Down
11 changes: 5 additions & 6 deletions exporters/ostream/src/span_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ sdk::common::ExportResult OStreamSpanExporter::Export(
sout_ << "\n resources : ";
printResources(span->GetResource());
sout_ << "\n instr-lib : ";
printInstrumentationLibrary(span->GetInstrumentationLibrary());
printInstrumentationScope(span->GetInstrumentationScope());
sout_ << "\n}\n";
}
}
Expand Down Expand Up @@ -161,12 +161,11 @@ void OStreamSpanExporter::printResources(const opentelemetry::sdk::resource::Res
}
}

void OStreamSpanExporter::printInstrumentationLibrary(
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
&instrumentation_library)
void OStreamSpanExporter::printInstrumentationScope(
const opentelemetry::sdk::instrumentationscope::InstrumentationScope &instrumentation_scope)
{
sout_ << instrumentation_library.GetName();
auto version = instrumentation_library.GetVersion();
sout_ << instrumentation_scope.GetName();
auto version = instrumentation_scope.GetVersion();
if (version.size())
{
sout_ << "-" << version;
Expand Down
Loading

0 comments on commit d52451c

Please sign in to comment.