Datadog widget to display a value of a log in widget for dashboard view - widget

How to display the attributes of a log in datadog widget. I have a log that contains the current state of accounts and their number. I want get the last log with from the event and display it on a dashboard so people can see the current accounts number and their state.
{
closed: 778
is_prod: false
level: info
live: 43965
onHold: 4955
request: POST /v1/logs/accounts-states
}

Related

Cypress result reports do not show a "passed" status - how to get them to show "pass"?

Most test reporting frameworks show the number of tests run, number passed, number failed and number skipped or ignored. But with the Cypress test reporter options, be it the junit-reporter or the mocha-awesome reporter, they do not show the number passed. Is there a configurable option that would allow the cypress-junit-reporter to show the number of tests that passed?

Resource in Users.Undelete in AdminDirectory API (Google-Apps-Script)

AdminDirectory.Users.undelete(resource, userKey)
UserKey is the UserID/UserKey. Not sure what is the resource here.
Answer:
The only parameter required by Directory API: Users: undelete is orgUnitPath.
More Information:
As per the documentation:
In the request body, supply data with the following structure:
{
"orgUnitPath": string
}
Where the orgUnitPath is the path to the Organizationan unit you wish to restore the user to. You can get a list of your Organizational units from the [Orgunits: list]9v) method of the same API.
The orgUnitPath parameter needs to be preceded with a /, as per the resource representation documentation on Orgunits:
orgUnitPath: The full path to the organizational unit. The orgUnitPath is a derived property. When listed, it is derived from parentOrgunitPath and organizational unit's name. For example, for an organizational unit named 'apps' under parent organization '/engineering', the orgUnitPath is '/engineering/apps'. In order to edit an orgUnitPath, either update the name of the organization or the parentOrgunitPath.
So as for this example, you would need to provide the following resource:
{
"orgUnitPath": "/engineering/apps"
}
Something to remember:
When undeleting a user, unlike the delete method, you can not specify their email address in the userKey field to restore them. This is mentioned in the undelete documentation:
userKey: Identifies the user in the API request. The value must be the user's unique user ID.
Code Example:
function undeleteUser() {
AdminDirectory.Users.undelete(
{
orgUnitPath: '/My-Org-Unit-Path'
},
'21-character-unique-user-id'
);
}
The unique user ID can be obtained from a Users: list request.
References:
Directory API - Users: undelete
Orgunits - Resource Representation
Directory API - Users: list

AWS SDK in java - How to get activities from worker when multple execution on going for a state machine

AWS Step Function
My problem is to how to sendTaskSuccess or sendTaskFailuer to Activity which are running under the state machine in AWS .
My Actual intent is to Notify the specific activities which belongs to particular State machine execution.
I successfully send notification to all waiting activities by activityARN. But my actual need is to send notification to specific activity which belong to particular state machine execution .
Example . StateMachine - SM1
There two execution on going for SM1-- SM1E1, SM1E2 . In that case I want to sendTaskSuccess to activity which belongs to SM1E1 .
follwoing code i used . But it send notification to all activities
GetActivityTaskResult getActivityTaskResult = client.getActivityTask(new GetActivityTaskRequest()
.withActivityArn("arn detail"));
if (getActivityTaskResult.getTaskToken() != null) {
try {
JsonNode json = Jackson.jsonNodeOf(getActivityTaskResult.getInput());
String outputResult = patientRegistrationActivity.setStatus(json.get("patientId").textValue());
System.out.println("outputResult " + outputResult);
SendTaskSuccessRequest sendTaskRequest = new SendTaskSuccessRequest().withOutput(outputResult)
.withTaskToken(getActivityTaskResult.getTaskToken());
client.sendTaskSuccess(sendTaskRequest);
} catch (Exception e) {
client.sendTaskFailure(
new SendTaskFailureRequest().withTaskToken(getActivityTaskResult.getTaskToken()));
}
As far as I know you have no control over which task token is returned. You may get one for SM1E1 or SM1E2 and you cannot tell by looking at the task token. GetActivityTask returns "input" so based on that you may be able to tell which execution you are dealing with but if you get a token you are not interested in, I don't think there's a way to put it back so you won't be able to get it again with GetActivityTask later. I guess you could store it in a database somewhere for use later.
One idea you can try is to use the new callback integration pattern. You can specify the Payload parameter in the state definition to include the task token like this token.$: "$$.Task.Token" and then use GetExecutionHistory to find the TaskScheduled state of the execution you are interested in and retrieve the parameters.Payload.token value and then use that with sendTaskSuccess.
Here's a snippet of my serverless.yml file that describes the state
WaitForUserInput: #Wait for the user to do something
Type: Task
Resource: arn:aws:states:::lambda:invoke.waitForTaskToken
Parameters:
FunctionName:
Fn::GetAtt: [WaitForUserInputLambdaFunction, Arn]
Payload:
token.$: "$$.Task.Token"
executionArn.$: "$$.Execution.Id"
Next: DoSomethingElse
I did a POC to check and below is the solution .
if token is consumed by getActivityTaskResult.getTaskToken() and if your conditions not satisfied by request input then you can use below line to avoid token consumption .awsStepFunctionClient.sendTaskHeartbeat(new SendTaskHeartbeatRequest().withTaskToken(taskToken))

Dashing job get_event?

In my dashboard I have a job where I would like to get a value from my widget.
# :first_in sets how long it takes before the job is first run. In this case, it is run immediately
SCHEDULER.every '1s', :first_in => 0 do |job|
send_event('my_widget', { value: rand(400) })
end
This is the code to send data to my widget, but how could I get the data? What is the "get_event" that I'm looking for?
From this issue in dashing github repository, You can use server sent events to get data from dashing dashboard.
Dashing provides data from the same API end point
http://dashingdemo.herokuapp.com/events
Excerpt from returned data
data: {"current":77,"last":82,"id":"valuation","updatedAt":1461840437}
data: {"current":104578,"last":89199,"id":"karma","updatedAt":1461840437}
data: {"value":62,"id":"synergy","updatedAt":1461840437}

CEP Producer - Timed file adapter

In Fiware CEP's User Manual (pdf), page 12, it's mentioned you can create an event Producer of the type 'Timed', that will retrieve events from a file at intervals of time based on their 'OccurranceTime' property.
In my Fi-Lab's intance I don't find this 'Timed' type of producer in the dropdown list, only: File, JMS, Rest and Custom.
So I thought this feature could be implemented in the type 'File', but I can't get it to work, the property 'sendingDelay' in the Producer, always dictates the reading speed, not 'OccurrenceTime' in the event payload. Deleting 'sendingDelay' from the Producer makes it not send events at all.
OccurranceTime is said, in the manual, to be in milliseconds and in the authoring tool it has variable type of 'Date', so "OccurranceTime":"1000" should mean one second.
So, how can I get events produced at desired times? Is it just a matter of correct formating?
(BTW: in the manual OccurranceTime is spelled in two diferent ways: 'OccuranceTime' and 'OccurranceTime'. I believe the correct one is with double 'r', as it's what the authoring tools gives by default when creating a new event.)
Thank you,
Arthur
Event producer of type 'Timed' is a new feature that is part of release 4 of the CEP. It should be available in FIWARE Lab on October.
When available, you could choose it as the producer's type in the CEP Authoring tool. Then, the CEP will read events from an input file. In this file, you will write the expected occurrence time of each event.
For example, if the content of the input event file in JSON format is:
{"Name":"TrafficReport", "volume":"1000", "OccurrenceTime":"1000"}
{"Name":"TrafficReport", "volume":"1600", "OccurrenceTime":"6000"}
{"Name":"TrafficReport", "volume":"2500", "OccurrenceTime":"11000"}
The producer will process the second input event 5 seconds after the first input event, since it said to occur 5000 ms after the first one.