Graphite Percentage Calculation with groupby/Wildcards for alerting Target Function - graphite

I am trying to create a seyren alert for my page render metric stored in graphite.
My render stats are collected by ststsD and stored in graphite. The structure is following:
stats.counters.renderCompleted.display.<country>.<placement_id>.<page_version>.count
e.g.
stats.counters.renderCompleted.display.US.123456.v1_1_03.count
stats.counters.renderCompleted.display.US.123456.v1_1_09.count
stats.counters.renderCompleted.display.US.654321.v2_1_05.count
stats.counters.renderCompleted.display.US.654321.v2_1_07.count
stats.counters.renderCompleted.display.UK.123456.v1_1_09.count
...
...
I want to create a seyren alert with graphite function whenever the current render count for ANY PLACEMENT ANY VERSION (e.g. group by placement_id, page_version) falls below certain % of its (for that placement's and version's) previous day average.
I did search graphite functions but it's bit confusing probably because I don't have background in time-series data processing. Will truly appreciate any help. I tried with many combinations including the following, but not able to get it correct...
asPercent(sumSeriesWithWildCards(movingAverage(scaleToSeconds(
stats.counters.renderCompleted.display.US.*.*.count, 1),'10min'), 6),
sumSeriesWithWildCards(movingAverage(scaleToSeconds(timeShift(
stats.counters.renderCompleted.display.US.*.*.count, '1d'), 1), '10min'), 6))
Please note, I want to create only one alert (hence using WildCard function like sumSeriesWithWildCards) which should serve the purpose, not multiple alerts for individual placements and versions and we keep on adding these.
Thanks in advance.

Related

Field is periodically updated. Need to show New and prior field when changed

For this report, I need one field (Sales Code) to only show if it has been updated. Periodically they change Sales code and I want a report to show the prior code along side the new code when it changes. Along with its part number and so on.
I was wondering the best way to go about tackling this request.
I tried to do _add_days -1 and compare the Sales code --> Sales code1. I dont think that will give me what I am looking for.
For example Sales code changes from AA --> AB.
I want to see New CODE OLD Code Part Number and so on...
AB AB 12345
The pattern you are encountering is called a slowly changing dimension.
Here's a wee free primer.
https://www.kimballgroup.com/2013/02/design-tip-152-slowly-changing-dimension-types-0-4-5-6-7/
You don't mention the structure of the data you're working with so it would be quite difficult for me to say what type you have other than the fact that you're trying to track historical data and seem to have it captured somehow rules out type 0.
Because of that, I can't come down from Mount Sinai with the solution but this can help you start to think through the problem.
In Framework manager have the modeler design the fields for SalesCode and SalesCode1
To only show if there was a change
Add a detail filter:
SalesCode <> SalesCode1
To control the context of time, have a separate filter like:
[Sales Date] between ?FromDate? and ?ToDate?

MS Project: How to set daily actual work for a task using a JavaScript Add-In?

I want to synchronize data for actual work from a web-based application of my company with MS Project. I am currently developing an Add-In with JavaScript in order to achieve this:
The red circle in my screenshot shows the data that I want to set programmatically. However, I have no idea how to achieve this.
I understand that I can get Task GUIDs and then set task fields using the task GUID and the field ID. This way I can save the cumulative actual work, but not per day like in my screenshot.
The API Docs on the MS Office Website are rather hard to read and navigate. Any help would be apprechiated!
Let's first separate the language from the operation.
Operationally, based on your circle, you want to set work for a task to happen on individual days? This is done using timeScaleData, see https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2003/aa206255(v=office.11) . When I did something similar (in VBA), I had to (1) get an array of time scale values, then (2) walk/iterate through that array and set work to those days:
set timeScaleValsArry = myTask.Assignments(1).TimeScaleData(startDay, endDay, pjAssignmentTimeScaledWork, daily)
for a = 1 to timeScaleValsArry.Count
timeScaleValsArry[a].value = hoursToWorkThatDay
next
Breaking down the elements above:
myTask is the task (of type task) I want to manipulate.
Assignments is an array representing each resource assigned to the task; for my purposes, I only ever had 1 resource assigned, hence the index of (1).
TimeScaleData is the function that returns the the array starting on the day startDay (whatever you want that to be), endDay, pjAssignmentTimeScaledWork which tells this function what data we want to work with (being work, but there are alternates ), and daily which is the frequency you want to work with (for instance you can go down to minutes, or up to years).
Then the returned array timeScaleValsArry is walked, and inside the loop the daily assignment for each value is manipulated. You'd need to customize this part to meet your needs; alternatively, you don't even need to loop if you always had three days: just hard code the array indices.
As far as language, clearly this is do-able in VBA. Doing this in C# as a VSTO addin has very similar syntax. I'd presume for JavaScript (what are you using, ScriptLab?) would also have similar syntax.

"Calculated columns cannot contain volatile functions like Today and Me" error message on Sharepoint

I try to add a new calculated column to sharepoint list that will show elapsed day. I enter name and write a formula like;
=ABS(ROUND(Today-Created;0))
The data type returned from this formula is: Single line of text
When I want to save I get an error like
Calculated columns cannot contain volatile functions like Today and
Me.
Calculated Column Values Only Recalculate As Needed
The values in SharePoint columns--even in calculated columns--are stored in SharePoint's underlying SQL Server database.
The calculations in calculated columns are not performed upon page load; rather, they are recalculated only whenever an item is changed (in which case the formula is recalculated just for that specific item), or whenever the column formula is changed (in which case the formula is recalculated for all items).
(As a side note, this is the reason why in SharePoint 2010 you cannot create or change a calculated column on a list that has more than the list view threshold of 5000 items; it would require a mass update of values in all those items, which could impact database performance.)
Thus, in order for calculated columns to accurately store "volatile" values like "Me" and "Today", SharePoint would need to somehow constantly recalculate those column values and continuously update the column values in the database. This simply isn't possible.
Alternatives to Calculated Columns
I suggest taking a different approach entirely instead of using a calculated column for this purpose.
Conditional Formatting: You can apply conditional formatting to highlight records that meet certain criteria. This can be done using SharePoint Designer or HTML/JavaScript.
Filtered List views: Since views of lists are queried and generated in real time, you can use volatile values in list view filters. You can set up a list view web part that only shows items where Created is equal to [Today]. Since you can place multiple list view web parts on one page, you could have one section for today's items, and another web part for all the other items, giving you a visual separation.
A workflow, timer job, or scheduled task: You can use a repeating process to set the value of a normal (non-calculated) column on a daily basis. You need to be careful with this approach to ensure good performance; you wouldn't want it to query for and update every item in the list if the list has surpassed the list view threshold, for example.
I found some conversations about this issue. Many people suggest to creating a new Date Time column, visible is false, default value is Today's Date and it will be named as Today. Then we can use this column in our formulas.
I tried this suggestion and yes error is gone and formula is accepted but calculated columns' values are wrong. I setted column Today is visible and checked, it was empty. Default value Today's Date was not working. When I looking for a solution for this issue I deleted column Today carelessly. Then I realized calculated columns' values are right.
Finally; I don't know what is trick but before using Today keyword in your formulas if you create a column named as Today and after your formula saving if you delete Today column, it is working.
UPDATE
After #Thriggle's answer I realized this approach doesn't work like a charm. Yes, formula doesn't cause an error when calculated column saving but it works correctly only first time, in the next day the calculated column shows old values, because its values are static as Thriggle explained.

How to list unique values of a particular field in Kibana

I am having a field named rpc in my elasticsearch database and I am displaying it using Kibana. When I search in search bar of kibana like:
rpc:*
It display all the values of rpc field but I want to have only those value to be displayed which are unique.
I have been playing around with Kibana4 since a couple of weeks now. I find it intuitive and simple and the experience has been great till now. Following your question, I tried getting unique results via a Data Table visualization. Why? Because I personally find it easier to understand. Following are the steps:
1. Get unique count
Create the visualization (Visualize -> Data Table). First lets get
the count of how many unique entries we have for a particular field
(We will use this in the later part for verification). I'm using
clientip.raw but as I see, it will work just fine with any friendly
field name too.
2. Set the aggregation right
Set you aggregation back to count and have a Split Rows as follows. Not doing this will give you count 1 for each field value (since it is looking for unique counts) when you populate the table. Noteworthy part is setting the Top field to 0. Because Kibana won't let you enter anything else than a digit (Obviously!). This was the tricky part. Hit Apply and you'll get the results. Unique field values and the count of each of them.
3. Verification:
Going to the last page of the table, we see there are exactly 543 results. This is how I know it works.
What Next?
You save this visualization and add it to a Dashboard. There you can always check the request, query, response and other stats.
Just an addition to the above mathakoot answer.
For the user of newer version (which do not allow bucket size of 0 anymore) just set a value greater than the maximum number of result
And report the value in the Options>Per Page field
I am using Kibana 6 so the UI looks a bit different than the older answers here.
Here is what worked for me
Create a visualization from your query, I used a line graph type (don't think it matters)
Under Data, set metrics aggregation = "Unique Count" and set field to your field.
Set x-axis aggregation = "Terms" and set field to your field.
Set Size > your number of records
Under Metrics and Axes, disable drawing of the graph, circles, and labels (this really helps the UI not lag)
Run query and then click "Inspect" and download CSV
Data
Metrics & Axes
I wanted to achieve something similar but I'm stuck with Kibana 3.1.
I simply added a panel of type "TERMS" and configured its Field = User-agent and left everything else on default values. This gave me a nice bar chart with one bar for each User-agent.

Calculate product of a field across repeating elements in InfoPath

It is easy to calculate a sum, an average or a maximum accross set of fields using built-in xpath functions.
But is it possible to calculate a product?
Assuming I have repeating elements like
<my:table>
<my:row>
<my:value>10</my:value>
</my:row>
<my:row>
<my:value>20</my:value>
</my:row>
<my:row>
<my:value>30</my:value>
<my:row>
</my:table>
(the number of my:rows may vary).
i need to have a formula multiplying all my:values: 10*20*30 (and working with any number of rows).
Any ideas?
Please do not suggest code solutions, I need this for a restricted form.
Using conditional hack described here, I finally assembled the solution.
Inside my:row, create a running product field my:valueCumul, populated using a formula to refer to previous row, and leveraging the conditional hack to override NaN for the first row:
../my:value *
concat(
(count(../preceding-sibling::my:row[1]) = 0) * 1,
substring(../preceding-sibling::my:row[1]/my:valueCumul, 1, (count(../preceding-sibling::my:row[1]) = 1) * string-length(../preceding-sibling::my:row[1]/my:valueCumul))
)
Outside the table you can easily refer to my:valueCumul in the last row to get total product:
../my:row[count(../my:row)]/my:valueCumul
The nice features of this solution are:
Works in a browser form in any sharepoint environment
Is not impacted by "16 calculations" threshold
The formula is robust to row removal and shifts
You can't with the built in functions in InfoPath.
However, don't write off a code solution so fast. If you only access data elements in the form itself (nothing EXTERNAL) then you can leave the form as restricted security and the code will run with no problems - the user doesn't know the difference.
It is fairly trivial to attach to the right event, grab the nodes, and loop through them while multiplying. You don't even have to use managed code - use one of the script options. Comment back (or update your original post) if you run into any troubles and we can help resolve them.

Resources