-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metric: propagate OTel parent span for service-call and conversation
An execution::context that hold * current service * current execution span * parent service * parent execution span During a service call the current service and execution span will be propagated as parent service and parent execution span. Service invocation (callee side) will update the execution::context with the parent information. Added execution span and parent span to service metric, and appended these to the event-service-log. New versions of messages to include execution span: * service-call-request * service-call-reply (the same for now) * conversation-connect-request
- Loading branch information
Showing
56 changed files
with
752 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
//! | ||
//! Copyright (c) 2015, The casual project | ||
//! | ||
//! This software is licensed under the MIT license, https://opensource.org/licenses/MIT | ||
//! | ||
|
||
#pragma once | ||
|
||
#include "common/strong/id.h" | ||
#include <string> | ||
|
||
namespace casual | ||
{ | ||
namespace common::execution | ||
{ | ||
|
||
using type = strong::execution::id; | ||
|
||
namespace context | ||
{ | ||
struct Parent | ||
{ | ||
strong::execution::span::id span; | ||
std::string service; | ||
|
||
inline friend bool operator == ( const Parent&, const Parent&) = default; | ||
|
||
CASUAL_CONST_CORRECT_SERIALIZE( | ||
CASUAL_SERIALIZE( span); | ||
CASUAL_SERIALIZE( service); | ||
) | ||
}; | ||
|
||
} // context | ||
|
||
struct Context | ||
{ | ||
strong::execution::id id; | ||
strong::execution::span::id span; | ||
std::string service; | ||
context::Parent parent; | ||
|
||
CASUAL_LOG_SERIALIZE( | ||
CASUAL_SERIALIZE( id); | ||
CASUAL_SERIALIZE( span); | ||
CASUAL_SERIALIZE( service); | ||
CASUAL_SERIALIZE( parent); | ||
) | ||
}; | ||
|
||
namespace context | ||
{ | ||
//! @returns the curren execution context | ||
const Context& get(); | ||
|
||
//! clears all execution context state | ||
void clear(); | ||
|
||
//! resets/regenerate id, span. clears parent | ||
void reset(); | ||
|
||
namespace id | ||
{ | ||
//! sets a new execution id. @returns the old. | ||
strong::execution::id set( strong::execution::id id); | ||
|
||
//! sets a new random execution id. | ||
strong::execution::id reset(); | ||
} // id | ||
|
||
namespace span | ||
{ | ||
strong::execution::span::id set( strong::execution::span::id id); | ||
strong::execution::span::id reset(); | ||
} // span | ||
|
||
namespace service | ||
{ | ||
//! Sets the current service | ||
void set( const std::string& service); | ||
|
||
//! clear the service name | ||
void clear(); | ||
} // service | ||
|
||
namespace parent | ||
{ | ||
namespace service | ||
{ | ||
void set( const std::string& service); | ||
} // service | ||
|
||
namespace span | ||
{ | ||
void set( strong::execution::span::id id); | ||
} // span | ||
|
||
} // parent | ||
|
||
} // context | ||
|
||
} // common::execution | ||
} // casual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.