Skip to content

Commit

Permalink
[NFC] Improve scope/instrument names in metrics ostream exporter (ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
bsarden authored Aug 11, 2022
1 parent b4ed047 commit 86c9f2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions exporters/ostream/src/metric_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ void OStreamMetricExporter::printInstrumentationInfoMetricData(
// sout_ is shared
const std::lock_guard<opentelemetry::common::SpinLockMutex> 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_;

Expand Down
16 changes: 8 additions & 8 deletions exporters/ostream/test/ostream_metric_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:"
Expand Down

0 comments on commit 86c9f2b

Please sign in to comment.