Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo committed Apr 12, 2022
1 parent 34e8b8e commit 454a2c9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
14 changes: 3 additions & 11 deletions examples/common/metrics_foo_library/foo_library.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@
// SPDX-License-Identifier: Apache-2.0

#ifndef ENABLE_METRICS_PREVIEW
#include <chrono>
#include <thread>
#include "opentelemetry/metrics/provider.h"
#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h"
#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h"
#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h"
#include "opentelemetry/sdk/metrics/meter.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include "opentelemetry/sdk/version/version.h"
# include <chrono>
# include <thread>
# include "opentelemetry/metrics/provider.h"

namespace metric_sdk = opentelemetry::sdk::metrics;
namespace nostd = opentelemetry::nostd;
namespace common = opentelemetry::common;
namespace metrics_api = opentelemetry::metrics;

void foo_library(const std::string &name)
Expand Down
2 changes: 1 addition & 1 deletion examples/common/metrics_foo_library/foo_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once
#ifndef ENABLE_METRICS_PREVIEW
#include <string>
# include <string>

void foo_library(const std::string &name);
#endif
7 changes: 1 addition & 6 deletions exporters/ostream/src/metric_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ namespace
{
std::string timeToString(opentelemetry::common::SystemTimestamp time_stamp)
{
auto duration = time_stamp.time_since_epoch().count();

std::chrono::nanoseconds dur(duration);
std::chrono::time_point<std::chrono::system_clock> dt(dur);
std::time_t epoch_time = std::chrono::system_clock::to_time_t(dt);

std::time_t epoch_time = std::chrono::system_clock::to_time_t(time_stamp);
return std::ctime(&epoch_time);
}
} // namespace
Expand Down

0 comments on commit 454a2c9

Please sign in to comment.