Skip to content

Commit d777fff

Browse files
jsbnrakrrev
andauthored
Feature update may25 (#66)
* fix account bug and added ifthen * index updated * Added capture lesson, aparse() done and capture() still to do * Minor updates to support Transaction events in remaining query examples (#65) * Update queries for aparse() and if() to fully support the Transaction event type * Refer to docs until examples have been added for regex captures * nip and tuck * readme * fix for keyset from PR#52 * updated package lock * readme * workflow updates * prettier --------- Co-authored-by: Alexander Kristiansen <[email protected]>
1 parent b36544d commit d777fff

File tree

22 files changed

+5518
-3163
lines changed

22 files changed

+5518
-3163
lines changed

.github/workflows/pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Cache node_modules
2525
id: cache-node-modules
26-
uses: actions/cache@v1
26+
uses: actions/cache@v3
2727
env:
2828
cache-name: node-modules
2929
with:
@@ -57,7 +57,7 @@ jobs:
5757

5858
- name: Cache node_modules
5959
id: cache-node-modules
60-
uses: actions/cache@v1
60+
uses: actions/cache@v3
6161
env:
6262
cache-name: node-modules
6363
with:
@@ -103,7 +103,7 @@ jobs:
103103

104104
- name: Cache node_modules
105105
id: cache-node-modules
106-
uses: actions/cache@v1
106+
uses: actions/cache@v3
107107
env:
108108
cache-name: node-modules
109109
with:

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- name: Cache node_modules
2727
id: cache-node-modules
28-
uses: actions/cache@v1
28+
uses: actions/cache@v3
2929
env:
3030
cache-name: node-modules
3131
with:
@@ -63,7 +63,7 @@ jobs:
6363

6464
- name: Download Cached Deps
6565
id: cache-node-modules
66-
uses: actions/cache@v1
66+
uses: actions/cache@v3
6767
env:
6868
cache-name: node-modules
6969
with:

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore all js files:
2+
**/*.js

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cd nr1-learn-nrql
4444
npm install
4545
nr1 nerdpack:uuid -gf
4646
nr1 nerdpack:publish
47-
nr1 nerdpack:subscribe -c STABLE
47+
nr1 nerdpack:subscribe
4848
```
4949
This last command will subscribe the application to the account you've set as your default profile. You can check this using `nr1 profiles:default`. If you're not ready to deploy it to your account or want to test out changes you've made locally you can use:
5050

@@ -82,4 +82,4 @@ This project adheres to the New Relic [security policy](https://github.com/newre
8282

8383
Contributions are encouraged! If you submit an enhancement request, we'll invite you to contribute the change yourself. Please review our [Contributors Guide](CONTRIBUTING.md).
8484

85-
Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at [email protected]
85+
Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at [email protected].

nerdlets/nrql-tutorial-nerdlet/components/SampleQuery.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default class SampleQuery extends React.Component {
7171
.replace(/\*\*/g, '')
7272
.replace(/\\\*/g, '*')
7373
.replace(/\\_/g, '_')
74+
.replace(/\\\\/g, '\\')
7475
.replace(/\\\[/g, '[');
7576

7677
const fallbacknrqlPlain = fallbacknrql

nerdlets/nrql-tutorial-nerdlet/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default class NrqlTutorialNerdlet extends React.Component {
6363
let hasNoAPM = true;
6464

6565
// Get the 'accounts' from the returned data from the query to NerdGraph
66-
const { data: { actor: { accounts } } } = await NerdGraphQuery.query({ query }); // eslint-disable-line prettier/prettier
66+
const { data: { actor: { accounts } } } = await NerdGraphQuery.query({ query });
6767
const noAccounts = accounts.length === 0;
6868

6969
// Get the previous level, lesson and language from the User Storage
@@ -81,7 +81,7 @@ export default class NrqlTutorialNerdlet extends React.Component {
8181
// sanity check that loaded lesson actually exists
8282
const level = LEVELS[currentLevel];
8383
if (!level || !level.lessons[currentLesson]) {
84-
// eslint-disable-next-line no-console, prettier/prettier
84+
// eslint-disable-next-line no-console
8585
console.log(`Lesson ${currentLesson + 1} of level ${currentLevel + 1} doesn't exist! Resetting to level 1, lesson 1.`);
8686
currentLevel = 0;
8787
currentLesson = 0;
@@ -115,11 +115,11 @@ export default class NrqlTutorialNerdlet extends React.Component {
115115
}
116116

117117
return (
118-
<SelectItem value={String(id)} key={id}>{name}</SelectItem> // eslint-disable-line prettier/prettier
118+
<SelectItem value={String(id)} key={id}>{name}</SelectItem>
119119
);
120120
});
121121
// Check if we do not have an account selected when there are accounts (i.e. none contain Transaction event type)
122-
if (typeof !noAccounts && selectedAccount !== 'number') {
122+
if (!noAccounts && typeof selectedAccount !== 'number') {
123123
// If no account selected, use the first account in the list.
124124
selectedAccount = accounts[0].id;
125125
}
@@ -231,9 +231,9 @@ export default class NrqlTutorialNerdlet extends React.Component {
231231
<GridItem columnSpan={5}>
232232
<Select
233233
onChange={(key, value) => {
234-
const found = accounts.find(({ key }) => key === value); // eslint-disable-line prettier/prettier
235-
const hasAPMbool = found.props.children.includes('no recent APM data'); // eslint-disable-line prettier/prettier
236-
this.setState({ selectedAccount: value, hasNoAPM: hasAPMbool }); // eslint-disable-line prettier/prettier
234+
const found = accounts.find(({ key }) => key === value);
235+
const hasAPMbool = found.props.children.includes('no recent APM data');
236+
this.setState({ selectedAccount: value, hasNoAPM: hasAPMbool });
237237
}}
238238
value={selectedAccount}
239239
>

nerdlets/nrql-tutorial-nerdlet/levels/level1/lessons/FirstQuery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function FirstQuery() {
5555
which is 100 table rows for <code>SELECT *</code> queries or 10
5656
aggregated values for <code>FACET</code> queries and{' '}
5757
<code>SELECT (attributes)</code> queries. You can specify any limit up
58-
to the maximum. Use <code>LIMIT MAX</code> to return the maximum
58+
to the maximum. Use <code>LIMIT MAX</code> to return the maximum (10k)
5959
number of results possible.
6060
</Trans>
6161
</p>

nerdlets/nrql-tutorial-nerdlet/levels/level2/lessons/AggregateQuery2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export default function AggregateQuery2() {
4848
</p>
4949

5050
<SampleQuery
51-
nrql="SELECT **uniques(host)** FROM Transaction SINCE 1 day ago"
52-
fallbacknrql="SELECT uniques(http.url) FROM Public_APICall SINCE 1 day ago"
51+
nrql="SELECT **uniques(host)** as hosts FROM Transaction SINCE 1 day ago"
52+
fallbacknrql="SELECT uniques(http.url) as urls FROM Public_APICall SINCE 1 day ago"
5353
span="6"
5454
chartType="table"
5555
/>

nerdlets/nrql-tutorial-nerdlet/levels/level2/lessons/CompareWith.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export default function CompareWith() {
2525
<p>
2626
<Trans i18nKey="Contents.P3">
2727
Specifically, in the sample query below we compare the last day
28-
against the previous week using a relative offset of{' '}
29-
<code>1 week ago</code>.
28+
against the previous day'ss using a relative offset of{' '}
29+
<code>1 day ago</code>.
3030
</Trans>
3131
</p>
3232

3333
<SampleQuery
34-
nrql="SELECT average(duration) FROM Transaction SINCE 1 DAY AGO **COMPARE WITH 1 WEEK AGO**"
35-
fallbacknrql="SELECT average(duration) FROM Public_APICall SINCE 1 day ago COMPARE WITH 1 week ago"
34+
nrql="SELECT average(duration) FROM Transaction SINCE 1 DAY AGO **COMPARE WITH 1 DAY AGO**"
35+
fallbacknrql="SELECT average(duration) FROM Public_APICall SINCE 1 day ago COMPARE WITH 1 DAY ago"
3636
span="6"
3737
/>
3838

@@ -46,8 +46,8 @@ export default function CompareWith() {
4646
</p>
4747

4848
<SampleQuery
49-
nrql="SELECT average(duration) FROM Transaction SINCE 1 DAY AGO **COMPARE WITH 1 WEEK AGO** TIMESERIES"
50-
fallbacknrql="SELECT average(duration) FROM Public_APICall SINCE 1 day ago COMPARE WITH 1 week ago TIMESERIES"
49+
nrql="SELECT average(duration) FROM Transaction SINCE 1 DAY AGO **COMPARE WITH 1 DAY AGO** TIMESERIES"
50+
fallbacknrql="SELECT average(duration) FROM Public_APICall SINCE 1 day ago COMPARE WITH 1 DAY ago TIMESERIES"
5151
span="12"
5252
/>
5353

nerdlets/nrql-tutorial-nerdlet/levels/level3/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import FacetCases from './lessons/FacetCases';
55
import FilterToEventTypes from './lessons/FilterToEventTypes';
66
import OverridingValues from './lessons/OverridingValues';
77
import Concatenation from './lessons/Concatenation';
8+
import IfThen from './lessons/IfThen';
89
import NextSteps from './lessons/NextSteps';
910

1011
export default [
@@ -36,6 +37,10 @@ export default [
3637
title: 'String concatenation',
3738
component: Concatenation
3839
},
40+
{
41+
title: 'Conditional logic',
42+
component: IfThen
43+
},
3944
{
4045
title: 'Summary',
4146
component: NextSteps

0 commit comments

Comments
 (0)