Skip to content

Commit

Permalink
Fixed some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
LarryOsterman committed May 27, 2022
1 parent 48abd74 commit 72550ee
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,12 @@ class ServiceClientOptions : public Azure::Core::_internal::ClientOptions {
class ServiceClient {
private:
ServiceClientOptions m_clientOptions;
Azure::Core::Tracing::_internal::DiagnosticTracingFactory m_serviceTrace;
Azure::Core::Tracing::_internal::DiagnosticTracingFactory m_tracingFactory;
std::unique_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;

public:
explicit ServiceClient(ServiceClientOptions const& clientOptions = ServiceClientOptions{})
: m_serviceTrace(clientOptions, "Azure.Core.OpenTelemetry.Test.Service", "1.0.0.beta-2")
: m_tracingFactory(clientOptions, "Azure.Core.OpenTelemetry.Test.Service", "1.0.0.beta-2")
{
std::vector<std::unique_ptr<HttpPolicy>> policies;
policies.emplace_back(std::make_unique<TelemetryPolicy>(
Expand Down Expand Up @@ -566,7 +566,7 @@ class ServiceClient {
std::string const& inputString,
Azure::Core::Context const& context = Azure::Core::Context{})
{
auto contextAndSpan = m_serviceTrace.CreateSpan(
auto contextAndSpan = m_tracingFactory.CreateSpan(
"GetConfigurationString", Azure::Core::Tracing::_internal::SpanKind::Internal, context);

// <Call Into Service via an HTTP pipeline>
Expand All @@ -587,7 +587,7 @@ class ServiceClient {
std::string const&,
Azure::Core::Context const& context = Azure::Core::Context{})
{
auto contextAndSpan = m_serviceTrace.CreateSpan(
auto contextAndSpan = m_tracingFactory.CreateSpan(
"ApiWhichThrows", Azure::Core::Tracing::_internal::SpanKind::Internal, context);

try
Expand Down
51 changes: 26 additions & 25 deletions sdk/core/azure-core/src/http/log_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,32 @@ inline std::string GetResponseLogMessage(

Azure::Core::CaseInsensitiveSet const
Azure::Core::Http::Policies::_detail::g_defaultAllowedHttpHeaders
= {"traceparent",
"tracestate",
"x-ms-request-id",
"x-ms-client-request-id",
"x-ms-return-client-request-id",
"traceparent",
"Accept",
"Cache-Control",
"Connection",
"Content-Length",
"Content-Type",
"Date",
"ETag",
"Expires",
"If-Match",
"If-Modified-Since",
"If-None-Match",
"If-Unmodified-Since",
"Last-Modified",
"Pragma",
"Request-Id",
"Retry-After",
"Server",
"Transfer-Encoding",
"User-Agent"};
= {
"Accept",
"Cache-Control",
"Connection",
"Content-Length",
"Content-Type",
"Date",
"ETag",
"Expires",
"If-Match",
"If-Modified-Since",
"If-None-Match",
"If-Unmodified-Since",
"Last-Modified",
"Pragma",
"Request-Id",
"Retry-After",
"Server",
"traceparent",
"tracestate",
"Transfer-Encoding",
"User-Agent"
"x-ms-client-request-id",
"x-ms-request-id",
"x-ms-return-client-request-id",
};

std::unique_ptr<RawResponse> LogPolicy::Send(
Request& request,
Expand Down
6 changes: 4 additions & 2 deletions sdk/core/azure-core/src/http/request_activity_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,21 @@ std::unique_ptr<RawResponse> RequestActivityPolicy::Send(
}
}

// Propogate information from the scope to the HTTP headers.
// Propagate information from the scope to the HTTP headers.
//
// This will add the "traceparent" header and any other OpenTelemetry related headers.
scope.PropagateToHttpHeaders(request);

try
{
// Send the request on to the service.
auto response = nextPolicy.Send(request, contextAndSpan.first);

// And register the headers we received from the service.
scope.AddAttribute(
TracingAttributes::HttpStatusCode.ToString(),
std::to_string(static_cast<int>(response->GetStatusCode())));
auto& responseHeaders = response->GetHeaders();
auto const& responseHeaders = response->GetHeaders();
auto serviceRequestId = responseHeaders.find("x-ms-request-id");
if (serviceRequestId != responseHeaders.end())
{
Expand Down

0 comments on commit 72550ee

Please sign in to comment.