feat: add stop after render and after render trace to s3 action

This commit is contained in:
Kjell Winblad 2024-04-24 15:21:33 +02:00
parent 22c7224267
commit 03e3ac19a9
1 changed files with 7 additions and 1 deletions

View File

@ -168,13 +168,14 @@ init_channel_state(#{parameters := Parameters}) ->
on_query(InstId, {Tag, Data}, #{client_config := Config, channels := Channels}) ->
case maps:get(Tag, Channels, undefined) of
ChannelState = #{} ->
run_simple_upload(InstId, Data, ChannelState, Config);
run_simple_upload(InstId, Tag, Data, ChannelState, Config);
undefined ->
{error, {unrecoverable_error, {invalid_message_tag, Tag}}}
end.
run_simple_upload(
InstId,
ChannelID,
Data,
#{
bucket := BucketTemplate,
@ -188,6 +189,11 @@ run_simple_upload(
Client = emqx_s3_client:create(Bucket, Config),
Key = render_key(KeyTemplate, Data),
Content = render_content(ContentTemplate, Data),
emqx_trace:rendered_action_template(ChannelID, #{
bucket => Bucket,
key => Key,
content => Content
}),
case emqx_s3_client:put_object(Client, Key, UploadOpts, Content) of
ok ->
?tp(s3_bridge_connector_upload_ok, #{