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

Add 'tag' to Status structs #396

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion cpp/csp/engine/StatusAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct StatusMessage
std::shared_ptr<Int64StructField> level;
std::shared_ptr<Int64StructField> statusCode;
std::shared_ptr<StringStructField> msg;
std::shared_ptr<StringStructField> tag;
};

struct StatusLevelTraits
Expand Down Expand Up @@ -45,14 +46,17 @@ class StatusAdapter : public PushInputAdapter
m_statusAccess.level = meta -> getMetaField<int64_t>( "level", "Status" );
m_statusAccess.statusCode = meta -> getMetaField<int64_t>( "status_code", "Status" );
m_statusAccess.msg = meta -> getMetaField<std::string>( "msg", "Status" );
m_statusAccess.tag = meta -> getMetaField<std::string>( "tag", "Status" );
}

void pushStatus( int64_t level, int64_t statusCode, const std::string & msg, PushBatch *batch = nullptr )
void pushStatus( int64_t level, int64_t statusCode, const std::string & msg, PushBatch *batch = nullptr, const std::string & tag = "" )
{
StructPtr data = m_statusAccess.meta -> create();
m_statusAccess.level -> setValue( data.get(), level );
m_statusAccess.statusCode -> setValue( data.get(), statusCode );
m_statusAccess.msg -> setValue( data.get(), msg );
if( !tag.empty() )
m_statusAccess.tag -> setValue( data.get(), tag);

pushTick( std::move( data ), batch );
}
Expand Down
1 change: 1 addition & 0 deletions csp/adapters/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Status(Struct):
level: int
status_code: int
msg: str
tag: str


class Level(IntEnum):
Expand Down
Loading