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

Timeframe to allow last_n_items #392

Open
itayw opened this issue Apr 16, 2014 · 3 comments · Fixed by #395
Open

Timeframe to allow last_n_items #392

itayw opened this issue Apr 16, 2014 · 3 comments · Fixed by #395
Assignees
Milestone

Comments

@itayw
Copy link
Member

itayw commented Apr 16, 2014

var table1Query = {
    timeframe: 'last_15_items',
    interval: 'second',
    dimensions: [
      {key: 'flows.name', name: 'Flow name', collection: 'benchmark'}
    ],
    metrics: [
      {
        key: 'reqrate',
        name: 'Avg. Request Time',
        formula: {
          dependsOn: [
            {
              key: 'req-count',
              aggregation: 'avg',
              dependsOn: 'flows.main.meter.count'
            },
            {
              key: 'elapsed',
              aggregation: 'avg',
              dependsOn: 'flows.totalElapsed'
            }
          ],
          run: 'function(count, elapsed){return elapsed/count}'
        },
        decimals: 4,
        suffix: 'ms'
      }
    ],
    collection: 'benchmark'
  };
@itayw itayw added this to the Version 0.5 milestone Apr 16, 2014
@itayw itayw self-assigned this Apr 16, 2014
itayw added a commit that referenced this issue Apr 16, 2014
itayw added a commit that referenced this issue Apr 16, 2014
Conflicts:
	lib/dispatch/index.js
itayw added a commit that referenced this issue Apr 17, 2014
#392 added support for last_n_items query
@itayw itayw changed the title Timeframe to allow n last items Timeframe to allow last_n_items Apr 17, 2014
@orweinberger
Copy link
Member

The last_n_items does not seem to work when dimension is set to timestamp. This is what I'm trying to run:

joolaio.query.fetch({
  timeframe:'last_1_items',
  interval: 'second',
  dimensions: [{key:'timestamp', collection:'VoyGXTIeTpxzAmnj8H'}],
  collection: 'VoyGXTIeTpxzAmnj8H',
  metrics: [{key:'visits', collection:'VoyGXTIeTpxzAmnj8H'}],
  filter: null
}, function(err, results) {
  if (err)
    throw err;
  console.log(results);
});

I get a result with 1 document. The timestamp in the single document is the current time and the value is 0.

I would basically like to get the last time an item was inserted.

@orweinberger orweinberger reopened this Jul 14, 2014
@itayw
Copy link
Member Author

itayw commented Jul 15, 2014

Will setting filter to filter: [] or removing it from the query changes the result?

@orweinberger
Copy link
Member

Nope, same result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants