Skip to content

Unhandled exception when running "compiled-in" example code on Windows #170

@brotherpboon

Description

@brotherpboon

Hi. I'm trying to run the compiled-in example on a local Windows machine. I am getting an unhandled exception on line 91 file tracer_options.cpp (see attached image and code below). Please advise.

Here is my code:

#include <datadog/opentracing.h>
#include <datadog/tags.h>
#include <iostream>
#include <string>

int main()
{
	datadog::opentracing::TracerOptions tracer_options{ "localhost", 8126, "compiled-in example" };
	auto tracer = datadog::opentracing::makeTracer(tracer_options);  <=== this line leads to exception

	// Create some spans.
	{
		auto span_a = tracer->StartSpan("A");
		span_a->SetTag(datadog::tags::environment, "production");
		span_a->SetTag("tag", 123);
		auto span_b = tracer->StartSpan("B", { opentracing::ChildOf(&span_a->context()) });
		span_b->SetTag("tag", "value");
	}

	tracer->Close();
    std::cout << "Hello World!\n";
}

=====================================================================

exception

ot::expected<TracerOptions, const char *> applyTracerOptionsFromEnvironment(
    const TracerOptions &input) {
  TracerOptions opts = input;   <===== this line causes the exception

  auto environment = std::getenv("DD_ENV");
  if (environment != nullptr && std::strlen(environment) > 0) {
    opts.environment = environment;
  }

  auto service = std::getenv("DD_SERVICE");
  if (service != nullptr && std::strlen(service) > 0) {
    opts.service = service;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions