Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Distributed Tracing for Attestation SDK client. #3706

Merged
merged 19 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions doc/DistributedTracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ And construct the new tracing factory in the service constructor:
Azure::Core::Context const& context = Azure::Core::Context{})
{
// Create a new context and span for this request.
auto contextAndSpan = m_tracingFactory.CreateSpan(
"ServiceMethod", Azure::Core::Tracing::_internal::SpanKind::Internal, context);
auto contextAndSpan = m_tracingFactory.CreateSpan("ServiceMethod", context);

// contextAndSpan.Context is the new context for the operation.
// contextAndSpan.Span is the new span for the operation.
Expand All @@ -179,7 +178,6 @@ And construct the new tracing factory in the service constructor:
{
// Register that the exception has happened and that the span is now in error.
contextAndSpan.Span.AddEvent(ex);
contextAndSpan.Span.SetStatus(Azure::Core::Tracing::_internal::SpanStatus::Error);
throw;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "azure/attestation/attestation_client_models.hpp"
#include "azure/attestation/attestation_client_options.hpp"
#include <azure/core/context.hpp>
#include <azure/core/internal/tracing/service_tracing.hpp>
#include <azure/core/url.hpp>
#include <string>

Expand Down Expand Up @@ -68,10 +69,7 @@ namespace Azure { namespace Security { namespace Attestation {
* @param attestationClient An existing attestation client.
*/
AttestationAdministrationClient(AttestationAdministrationClient const& attestationClient)
: m_endpoint(attestationClient.m_endpoint), m_apiVersion(attestationClient.m_apiVersion),
m_pipeline(attestationClient.m_pipeline),
m_tokenValidationOptions(attestationClient.m_tokenValidationOptions),
m_attestationSigners(attestationClient.m_attestationSigners){};
= default;

/**
* @brief Destructor.
Expand Down Expand Up @@ -258,6 +256,7 @@ namespace Azure { namespace Security { namespace Attestation {
std::shared_ptr<Azure::Core::Credentials::TokenCredential const> m_credentials;
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
AttestationTokenValidationOptions m_tokenValidationOptions;
Azure::Core::Tracing::_internal::TracingContextFactory m_tracingFactory;

std::vector<Models::AttestationSigner> m_attestationSigners;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "azure/attestation/attestation_client_models.hpp"
#include "azure/attestation/attestation_client_options.hpp"
#include <azure/core/context.hpp>
#include <azure/core/internal/tracing/service_tracing.hpp>
#include <azure/core/url.hpp>
#include <string>

Expand Down Expand Up @@ -162,11 +163,7 @@ namespace Azure { namespace Security { namespace Attestation {
*
* @param attestationClient An existing attestation client.
*/
AttestationClient(AttestationClient const& attestationClient)
: m_endpoint(attestationClient.m_endpoint), m_apiVersion(attestationClient.m_apiVersion),
m_pipeline(attestationClient.m_pipeline),
m_tokenValidationOptions(attestationClient.m_tokenValidationOptions),
m_attestationSigners(attestationClient.m_attestationSigners){};
AttestationClient(AttestationClient const& attestationClient) = default;

std::string const Endpoint() const { return m_endpoint.GetAbsoluteUrl(); }

Expand Down Expand Up @@ -255,6 +252,7 @@ namespace Azure { namespace Security { namespace Attestation {
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
AttestationTokenValidationOptions m_tokenValidationOptions;
std::vector<Models::AttestationSigner> m_attestationSigners;
Azure::Core::Tracing::_internal::TracingContextFactory m_tracingFactory;

/** @brief Construct a new Attestation Client object
*
Expand Down
Loading