Skip to content

Commit

Permalink
Merge branch 'master' into FixIncludeLib
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Jan 22, 2021
2 parents 1427052 + 51eef56 commit 7037c25
Show file tree
Hide file tree
Showing 39 changed files with 353 additions and 68 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,18 @@ jobs:
with:
file: /home/runner/build/coverage.info

misspell:
runs-on: ubuntu-latest
steps:
- name: check out code
uses: actions/checkout@v2
- name: install misspell
run: |
curl -L -o ./install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh
- name: run misspell
run: ./bin/misspell -error .

docfx_check:
name: DocFX check
runs-on: windows-latest
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ endif()
include(CMakePackageConfigHelpers)

include_directories(api/include)
add_subdirectory(api)
include_directories(sdk/include)
include_directories(sdk)
include_directories(ext/include)

add_subdirectory(api)
add_subdirectory(sdk)
add_subdirectory(exporters)
if(WITH_EXAMPLES)
Expand All @@ -212,12 +214,13 @@ add_subdirectory(ext)

# Export cmake config and support find_packages(opentelemetry-cpp CONFIG) Write
# config file for find_packages(opentelemetry-cpp CONFIG)
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/opentelemetry-cpp-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake"
PATH_VARS OPENTELEMETRY_ABI_VERSION_NO OPENTELEMETRY_VERSION PROJECT_NAME
CMAKE_INSTALL_LIBDIR
INCLUDE_INSTALL_DIR CMAKE_INSTALL_LIBDIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO)

# Write version file for find_packages(opentelemetry-cpp CONFIG)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ A PR is considered to be **ready to merge** when:
* Trivial changes (typo, cosmetic, doc, etc.) don't have to wait for one day.
* Urgent fixes can take exceptions as long as it has been actively communicated.

Any Maintainer can merge the PR once it is **ready to merge**.
Any Maintainer can merge the PR once it is **ready to merge**. Maintainer can make conscious judgement to merge pull requests which have not strictly met above mentioned requirements.

If a PR has been stuck (e.g. there are lots of debates and people couldn't agree on each other), the owner should try to get people aligned by:

Expand Down
2 changes: 1 addition & 1 deletion Versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Refer to the [ABI Policy](./docs/abi-policy.md) for more details. To summarise
The guidelines in creating feature flag would be:
- Naming:

- `ENABLE_<SIGNAL>_PREVIEW` : For experimetal release of signal api/sdks eg, `METRICS_PREVIEW`, `LOGGING_PREVIEW`,
- `ENABLE_<SIGNAL>_PREVIEW` : For experimental release of signal api/sdks eg, `METRICS_PREVIEW`, `LOGGING_PREVIEW`,

- `ENABLE_<SIGNAL>_<FEATURE_NAME>_PREVIEW` : For experimental release for any feature within stable signal. For example, `TRACING_JAEGER_PREVIEW` to release the experimental Jaeger exporter for tracing.

Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/common/spin_lock_mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SpinLockMutex
* Blocks until a lock can be obtained for the current thread.
*
* This mutex will spin the current CPU waiting for the lock to be available. This can have
* decent performance in scenarios where there is low lock contention and lock-holders acheive
* decent performance in scenarios where there is low lock contention and lock-holders achieve
* their work quickly. It degrades in scenarios where locked tasks take a long time.
*/
void lock() noexcept
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/metrics/instrument.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Instrument
* @param description explains what the metric captures
* @param unit specifies the data type held in the instrument
* @param enabled determines if the metric is currently capturing data
* @return Instrument type with the specified attirbutes
* @return Instrument type with the specified attributes
*/
Instrument(nostd::string_view name,
nostd::string_view description,
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/trace/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct StartSpanOptions
core::SystemTimestamp start_system_time;
core::SteadyTimestamp start_steady_time;

// Explicitely set the parent of a Span.
// Explicitly set the parent of a Span.
//
// This defaults to an invalid span context. In this case, the Span is
// automatically parented to the currently active span.
Expand Down
24 changes: 9 additions & 15 deletions api/include/opentelemetry/trace/span_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace trace_api = opentelemetry::trace;

/* SpanContext contains the state that must propagate to child Spans and across
* process boundaries. It contains the identifiers TraceId and SpanId,
* TraceFlags, TraceState, and whether it has a remote parent.
* TraceFlags, TraceState, and whether it was propagated from a remote parent.
*
* TODO: This is currently a placeholder class and requires revisiting
*/
Expand All @@ -38,14 +38,14 @@ class SpanContext final
*
* @param sampled_flag a required parameter specifying if child spans should be
* sampled
* @param has_remote_parent a required parameter specifying if this context has
* a remote parent
* @param is_remote true if this context was propagated from a remote parent.
*/
SpanContext(bool sampled_flag, bool has_remote_parent)
SpanContext(bool sampled_flag, bool is_remote)
: trace_id_(),
span_id_(),
trace_flags_(trace_api::TraceFlags((uint8_t)sampled_flag)),
remote_parent_(has_remote_parent){};
is_remote_(is_remote)
{}

// @returns whether this context is valid
bool IsValid() const noexcept { return trace_id_.IsValid() && span_id_.IsValid(); }
Expand All @@ -57,14 +57,8 @@ class SpanContext final

const trace_api::SpanId &span_id() const noexcept { return span_id_; }

SpanContext(TraceId trace_id,
SpanId span_id,
TraceFlags trace_flags,
bool has_remote_parent) noexcept
: trace_id_(trace_id),
span_id_(span_id),
trace_flags_(trace_flags),
remote_parent_(has_remote_parent)
SpanContext(TraceId trace_id, SpanId span_id, TraceFlags trace_flags, bool is_remote) noexcept
: trace_id_(trace_id), span_id_(span_id), trace_flags_(trace_flags), is_remote_(is_remote)
{}

SpanContext(const SpanContext &ctx) = default;
Expand All @@ -77,7 +71,7 @@ class SpanContext final
trace_flags() == that.trace_flags();
}

bool HasRemoteParent() const noexcept { return remote_parent_; }
bool IsRemote() const noexcept { return is_remote_; }

static SpanContext GetInvalid() { return SpanContext(false, false); }

Expand All @@ -87,7 +81,7 @@ class SpanContext final
trace_api::TraceId trace_id_;
trace_api::SpanId span_id_;
trace_api::TraceFlags trace_flags_;
bool remote_parent_ = false;
bool is_remote_ = false;
};
} // namespace trace
OPENTELEMETRY_END_NAMESPACE
7 changes: 3 additions & 4 deletions api/include/opentelemetry/trace/trace_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/unique_ptr.h"

namespace opentelemetry
{
OPENTELEMETRY_BEGIN_NAMESPACE
namespace trace
{

Expand Down Expand Up @@ -117,7 +116,7 @@ class TraceState
}

// Creates an Entry for the key-value pair and adds it to entries. Returns true if pair was added
// succesfully, false otherwise. If value is null or entries_ is full, this function is a no-op.
// successfully, false otherwise. If value is null or entries_ is full, this function is a no-op.
bool Set(nostd::string_view key, nostd::string_view value) noexcept
{
if (value.empty() || num_entries_ >= kMaxKeyValuePairs)
Expand Down Expand Up @@ -193,4 +192,4 @@ class TraceState
};

} // namespace trace
} // namespace opentelemetry
OPENTELEMETRY_END_NAMESPACE
2 changes: 1 addition & 1 deletion api/test/common/spinlock_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static void BM_ThreadYieldSpinLockThrashing(benchmark::State &s)
[](std::atomic<bool> &l) { l.store(false, std::memory_order_release); });
}

// Run the benchamrks at 2x thread/core and measure the amount of time to thrash around.
// Run the benchmarks at 2x thread/core and measure the amount of time to thrash around.
BENCHMARK(BM_SpinLockThrashing)
->RangeMultiplier(2)
->Range(1, std::thread::hardware_concurrency())
Expand Down
2 changes: 1 addition & 1 deletion api/test/trace/propagation/http_text_format_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ TEST(HTTPTextFormatTest, SetRemoteSpan)
EXPECT_EQ(Hex(span->GetContext().trace_id()), "4bf92f3577b34da6a3ce929d0e0e4736");
EXPECT_EQ(Hex(span->GetContext().span_id()), "0102030405060708");
EXPECT_EQ(span->GetContext().IsSampled(), true);
EXPECT_EQ(span->GetContext().HasRemoteParent(), true);
EXPECT_EQ(span->GetContext().IsRemote(), true);
}

TEST(HTTPTextFormatTest, GetCurrentSpan)
Expand Down
6 changes: 3 additions & 3 deletions api/test/trace/span_context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ TEST(SpanContextTest, IsSampled)
ASSERT_EQ(s2.IsSampled(), false);
}

TEST(SpanContextTest, HasRemoteParent)
TEST(SpanContextTest, IsRemote)
{
SpanContext s1(true, true);

ASSERT_EQ(s1.HasRemoteParent(), true);
ASSERT_EQ(s1.IsRemote(), true);

SpanContext s2(true, false);

ASSERT_EQ(s2.HasRemoteParent(), false);
ASSERT_EQ(s2.IsRemote(), false);
}

TEST(SpanContextTest, TraceFlags)
Expand Down
2 changes: 1 addition & 1 deletion ci/ports/protobuf/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ else()
endif()

if(NOT protobuf_BUILD_PROTOC_BINARIES AND NOT EXISTS ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/protobuf)
message(FATAL_ERROR "Cross-targetting protobuf requires the x86-windows protoc to be available. Please install protobuf:x86-windows first.")
message(FATAL_ERROR "Cross-targeting protobuf requires the x86-windows protoc to be available. Please install protobuf:x86-windows first.")
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
Expand Down
10 changes: 9 additions & 1 deletion ci/setup_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ set -e
export DEBIAN_FRONTEND=noninteractive
apt-get update

export CMAKE_VERSION=3.15.2

pushd /tmp
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh
chmod +x cmake-${CMAKE_VERSION}-Linux-x86_64.sh
./cmake-${CMAKE_VERSION}-Linux-x86_64.sh --prefix=/usr/local --skip-license
rm cmake-${CMAKE_VERSION}-Linux-x86_64.sh
popd

set +e
echo \
cmake \
libbenchmark-dev \
libgtest-dev \
zlib1g-dev \
Expand Down
3 changes: 1 addition & 2 deletions cmake/opentelemetry-proto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ foreach(IMPORT_DIR ${PROTOBUF_IMPORT_DIRS})
list(APPEND PROTOBUF_INCLUDE_FLAGS "-I${IMPORT_DIR}")
endforeach()

get_target_property(gRPC_CPP_PLUGIN_EXECUTABLE gRPC::grpc_cpp_plugin
IMPORTED_LOCATION_RELEASE)
set(gRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)

add_custom_command(
OUTPUT ${COMMON_PB_H_FILE}
Expand Down
6 changes: 3 additions & 3 deletions docs/cpp-metrics-api-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ public:
* @param name is the identifier of the instrumenting library
* @param description explains what the metric captures
* @param unit specified the data type held in the instrument
* @param enabled determins if the metric is currently capturing data
* @return Instrument type with the specified attirbutes
* @param enabled determines if the metric is currently capturing data
* @return Instrument type with the specified attributes
*/
Instrument(nostd::string_view name, nostd::string_view description, nostd::string_view unit, bool enabled);
Expand Down Expand Up @@ -412,7 +412,7 @@ public:

/**
* Captures data by activating the callback function associated with the
* instrument and storing its return value. Callbacks for asychronous
* instrument and storing its return value. Callbacks for asynchronous
* instruments are defined during construction.
*
* @param none
Expand Down
2 changes: 1 addition & 1 deletion examples/metrics_simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ shared_ptr<MetricsProcessor> processor = shared_ptr<MetricsProcessor>(new Ungrou
`metrics_sdk::PushController controller(meter, std::move(exporter), processor, 5);`
`controller.start();`

6. Instrument code with synchronous and asynchronous instrument. These instruments can be placed in areas of interest to collect metrics and are created by the meter. Synchronous instruments are updated whenever the user desires with a value and label set. Calling add on a counter instrument for example will increase its value. Asynchronous instruments can be updated the same way, but are intended to recieve updates from a callback function. The callback below observes a value of 1. The user never has to call this function as it is automatically called by the controller.
6. Instrument code with synchronous and asynchronous instrument. These instruments can be placed in areas of interest to collect metrics and are created by the meter. Synchronous instruments are updated whenever the user desires with a value and label set. Calling add on a counter instrument for example will increase its value. Asynchronous instruments can be updated the same way, but are intended to receive updates from a callback function. The callback below observes a value of 1. The user never has to call this function as it is automatically called by the controller.

```
Expand Down
4 changes: 2 additions & 2 deletions examples/otlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ receivers:
otlp:
protocols:
grpc:
endpoint: localhost:55680
endpoint: localhost:4317
exporters:
zipkin:
endpoint: "http://localhost:9411/api/v2/spans"
Expand All @@ -26,6 +26,6 @@ service:
exporters: [zipkin]
```

Note that the OTLP exporter connects to the Collector at `localhost:55680` by default. This can be changed with first argument from command-line, for example: `./example_otlp gateway.docker.internal:55680`.
Note that the OTLP exporter connects to the Collector at `localhost:4317` by default. This can be changed with first argument from command-line, for example: `./example_otlp gateway.docker.internal:4317`.

Once you have the Collector running, see [CONTRIBUTING.md](../../CONTRIBUTING.md) for instructions on building and running the example.
2 changes: 1 addition & 1 deletion exporters/elasticsearch/src/es_log_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ sdklogs::ExportResult ElasticsearchLogExporter::Export(
// End the session
session->FinishSession();

// If an error occured with the HTTP request
// If an error occurred with the HTTP request
if (!write_successful)
{
// TODO: retry logic
Expand Down
6 changes: 3 additions & 3 deletions exporters/otlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ auto exporter = std::unique_ptr<sdktrace::SpanExporter>(new otlp::OtlpExporter(o

### Configuration options

| Option | Default |
| ------------ |------------------ |
| `endpoint` | `localhost:55680` |
| Option | Default |
| ------------ |----------------- |
| `endpoint` | `localhost:4317` |

## Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace otlp
struct OtlpExporterOptions
{
// The endpoint to export to. By default the OpenTelemetry Collector's default endpoint.
std::string endpoint = "localhost:55680";
std::string endpoint = "localhost:4317";
};

/**
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/src/otlp_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ std::unique_ptr<proto::collector::trace::v1::TraceService::Stub> MakeServiceStub
return proto::collector::trace::v1::TraceService::NewStub(channel);
}

// -------------------------------- Contructors --------------------------------
// -------------------------------- Constructors --------------------------------

OtlpExporter::OtlpExporter() : OtlpExporter(OtlpExporterOptions()) {}

Expand Down
2 changes: 1 addition & 1 deletion ext/include/opentelemetry/ext/zpages/zpages_http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class zPagesHttpServer : public HTTP_SERVER_NS::HttpServer
}

/**
* Helper that replaces all occurances a string within a string
* Helper that replaces all occurrences a string within a string
* @param str string to modify
* @param search substring to remove from str
* @param replacement string to replace search with whenever search is found
Expand Down
6 changes: 3 additions & 3 deletions ext/src/zpages/tracez_data_aggregator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void TracezDataAggregator::AggregateSpans()
* If in the future this is added then clearing of running spans will not bee
* required.
* For now this step of clearing and recalculating running span data is
* required because it is unkown which spans have moved from running to
* required because it is unknown which spans have moved from running to
* completed since the previous call. Additionally, the span name can change
* for spans while they are running.
*
Expand All @@ -170,9 +170,9 @@ void TracezDataAggregator::AggregateSpans()
* unique identifiers to span data have not been added yet.
*
* A few things to note:
* i) Duplicate running spans may be recieved from the span processor in one
* i) Duplicate running spans may be received from the span processor in one
* multiple successive calls to this function.
* ii) Only the newly completed spans are recieved by this function.
* ii) Only the newly completed spans are received by this function.
* Completed spans will not be seen more than once
**/
ClearRunningSpanData();
Expand Down
1 change: 1 addition & 0 deletions ext/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(zpages)
add_subdirectory(http)
add_subdirectory(w3c_tracecontext_test)
Loading

0 comments on commit 7037c25

Please sign in to comment.