From b4ed0471d0a570dcb454deea81d945430e94bb59 Mon Sep 17 00:00:00 2001 From: Bryce Arden Date: Wed, 10 Aug 2022 22:25:36 -0500 Subject: [PATCH 1/2] build: fix IWYU error in instruments.h (#1555) --- sdk/include/opentelemetry/sdk/metrics/instruments.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/include/opentelemetry/sdk/metrics/instruments.h b/sdk/include/opentelemetry/sdk/metrics/instruments.h index 565fd05d95..22fdba2879 100644 --- a/sdk/include/opentelemetry/sdk/metrics/instruments.h +++ b/sdk/include/opentelemetry/sdk/metrics/instruments.h @@ -3,6 +3,7 @@ #pragma once #ifndef ENABLE_METRICS_PREVIEW +# include # include "opentelemetry/sdk/common/attribute_utils.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk From 86c9f2bc7164dadf07a13fdefd37169a4fa59cab Mon Sep 17 00:00:00 2001 From: Bryce Arden Date: Wed, 10 Aug 2022 23:07:58 -0500 Subject: [PATCH 2/2] [NFC] Improve scope/instrument names in metrics ostream exporter (#1544) --- exporters/ostream/src/metric_exporter.cc | 4 ++-- exporters/ostream/test/ostream_metric_test.cc | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/exporters/ostream/src/metric_exporter.cc b/exporters/ostream/src/metric_exporter.cc index e05597f6ec..3b9887097b 100644 --- a/exporters/ostream/src/metric_exporter.cc +++ b/exporters/ostream/src/metric_exporter.cc @@ -127,14 +127,14 @@ void OStreamMetricExporter::printInstrumentationInfoMetricData( // sout_ is shared const std::lock_guard locked(lock_); sout_ << "{"; - sout_ << "\n name\t\t: " << info_metric.scope_->GetName() + sout_ << "\n scope name\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) << "\n end time\t: " << timeToString(record.end_ts) - << "\n name\t\t: " << record.instrument_descriptor.name_ + << "\n instrument name\t: " << record.instrument_descriptor.name_ << "\n description\t: " << record.instrument_descriptor.description_ << "\n unit\t\t: " << record.instrument_descriptor.unit_; diff --git a/exporters/ostream/test/ostream_metric_test.cc b/exporters/ostream/test/ostream_metric_test.cc index 0dd95bc37f..ea46c09bbe 100644 --- a/exporters/ostream/test/ostream_metric_test.cc +++ b/exporters/ostream/test/ostream_metric_test.cc @@ -66,12 +66,12 @@ TEST(OStreamMetricsExporter, ExportSumPointData) std::string expected_output = "{" - "\n name\t\t: library_name" + "\n scope name\t: library_name" "\n schema url\t: " "\n version\t: 1.2.0" "\n start time\t: Thu Jan 1 00:00:00 1970" "\n end time\t: Thu Jan 1 00:00:00 1970" - "\n name\t\t: library_name" + "\n instrument name\t: library_name" "\n description\t: description" "\n unit\t\t: unit" "\n type\t\t: SumPointData" @@ -137,12 +137,12 @@ TEST(OStreamMetricsExporter, ExportHistogramPointData) std::string expected_output = "{" - "\n name\t\t: library_name" + "\n scope name\t: library_name" "\n schema url\t: " "\n version\t: 1.2.0" "\n start time\t: Thu Jan 1 00:00:00 1970" "\n end time\t: Thu Jan 1 00:00:00 1970" - "\n name\t\t: library_name" + "\n instrument name\t: library_name" "\n description\t: description" "\n unit\t\t: unit" "\n type : HistogramPointData" @@ -215,12 +215,12 @@ TEST(OStreamMetricsExporter, ExportLastValuePointData) std::string expected_output = "{" - "\n name\t\t: library_name" + "\n scope name\t: library_name" "\n schema url\t: " "\n version\t: 1.2.0" "\n start time\t: Thu Jan 1 00:00:00 1970" "\n end time\t: Thu Jan 1 00:00:00 1970" - "\n name\t\t: library_name" + "\n instrument name\t: library_name" "\n description\t: description" "\n unit\t\t: unit" "\n type : LastValuePointData" @@ -278,12 +278,12 @@ TEST(OStreamMetricsExporter, ExportDropPointData) std::string expected_output = "{" - "\n name\t\t: library_name" + "\n scope name\t: library_name" "\n schema url\t: " "\n version\t: 1.2.0" "\n start time\t: Thu Jan 1 00:00:00 1970" "\n end time\t: Thu Jan 1 00:00:00 1970" - "\n name\t\t: library_name" + "\n instrument name\t: library_name" "\n description\t: description" "\n unit\t\t: unit" "\n resources\t:"