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

[Alerting] Adding telemetry usage counter for create rule API when predefined ID is specified #108572

Merged

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Aug 13, 2021

Resolves #108417

Summary

Adds a telemetry usage counter to track the number of a times rules are created with pre-defined IDs via the API. Differentiates between default and custom space.

To Verify

  1. Run this branch and create some rules with pre-defined IDs using the API, both in the default space and in a non-default space
  2. Go to https://localhost:5601/api/stats?extended=true&legacy=true and verify that usage counters have been updated with the expected numbers. Usage counter section will look something like this:
{
  "usage": {
    "usage_counters": {
      "dailyEvents": [
        {
          "domainId": "alerts",
          "counterName": "ruleCreatedWithPredefinedIdInDefaultSpace",
          "counterType": "count",
          "lastUpdatedAt": "2021-08-16T02:01:16.786Z",
          "fromTimestamp": "2021-08-16T00:00:00Z",
          "total": 2
        },
        {
          "domainId": "alerts",
          "counterName": "ruleCreatedWithPredefinedIdInCustomSpace",
          "counterType": "count",
          "lastUpdatedAt": "2021-08-16T02:01:56.790Z",
          "fromTimestamp": "2021-08-16T00:00:00Z",
          "total": 2
        }
      ]
    }
  }
}

Checklist

Delete any items that are not applicable to this PR.

@@ -274,7 +277,12 @@ export class AlertingPlugin {
// Routes
const router = core.http.createRouter<AlertingRequestHandlerContext>();
// Register routes
defineRoutes(router, this.licenseState, plugins.encryptedSavedObjects);
defineRoutes({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this interface to options object instead of list of params bc the list is getting long and I'm planning to add logger as well in another PR

@ymao1 ymao1 self-assigned this Aug 16, 2021
@ymao1 ymao1 added Feature:Alerting Feature:Alerting/RulesManagement Issues related to the Rules Management UX release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.15.0 v8.0.0 labels Aug 16, 2021
@ymao1 ymao1 marked this pull request as ready for review August 16, 2021 02:09
@ymao1 ymao1 requested a review from a team as a code owner August 16, 2021 02:09
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

Copy link
Contributor

@chrisronline chrisronline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created two rules, one in the default space and one in a custom space.


POST .kibana_8*/_search
{
  "_source": ["_id"], 
  "query": {
    "term": {
      "type": {
        "value": "alert"
      }
    }
  }
}
#! this request accesses system indices: [.kibana_8.0.0_001], but in a future major version, direct access to system indices will be prevented by default
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 2,
      "relation" : "eq"
    },
    "max_score" : 1.8352444,
    "hits" : [
      {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "chrisspace:alert:5e7a4482-c161-46a7-830c-9e91eddf904c",
        "_score" : 1.8352444,
        "_source" : { }
      },
      {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "alert:5e7a4482-c161-46a7-830c-9e91eddf904c",
        "_score" : 1.8352444,
        "_source" : { }
      }
    ]
  }
}

However, the telemetry says:

{
  "usage_counters": {
    "dailyEvents": [
      {
        "domainId": "alerts",
        "counterName": "ruleCreatedWithPredefinedIdInDefaultSpace",
        "counterType": "count",
        "lastUpdatedAt": "2021-08-16T13:55:22.332Z",
        "fromTimestamp": "2021-08-16T00:00:00Z",
        "total": 2
      },
      {
        "domainId": "alerts",
        "counterName": "ruleCreatedWithPredefinedIdInCustomSpace",
        "counterType": "count",
        "lastUpdatedAt": "2021-08-16T13:56:12.337Z",
        "fromTimestamp": "2021-08-16T00:00:00Z",
        "total": 1
      }
    ]
  }
}

(Note the total: 2 in the default space)

Is that expected somehow?

@ymao1
Copy link
Contributor Author

ymao1 commented Aug 16, 2021

(Note the total: 2 in the default space)

Is that expected somehow?

@chrisronline Hmm...is there any chance you tried to create the default space rule twice? You would've gotten a version conflict message the second time (and no rule would have been created) but the usage counter would have ticked up. This PR is counting any attempt to use the route, not just the successful rule creation attempts.

@chrisronline
Copy link
Contributor

@ymao1 I tried it the third time and I'm only see 1 now! I'm not sure what I was doing, but it seems to be working now. False alarm!

Copy link
Contributor

@chrisronline chrisronline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice work!

x-pack/plugins/alerting/server/routes/create_rule.ts Outdated Show resolved Hide resolved
@mikecote mikecote self-requested a review August 16, 2021 18:04
Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM! I tested locally and was able to see the counters go up accordingly 👍 couple of nits below.

Comment on lines 24 to 26
spaceId === undefined || spaceId === 'default'
? 'ruleCreatedWithPredefinedIdInDefaultSpace'
: 'ruleCreatedWithPredefinedIdInCustomSpace';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I wonder if we can build visualizations on the sum of both fields 🤔 If not, should we track ruleCreatedWithPredefinedIdInCustomSpace and ruleCreatedWithPredefinedId instead? (one is to track custom IDs in non-default space, and the other is any space).

Copy link
Contributor Author

@ymao1 ymao1 Aug 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea! I'm currently trying to figure out how to get access to the telemetry cluster to see how these daily events are visualized, but given that it's an array of objects, it's likely that it might not be straightforward to do a sum. Since I'd like to get this in before FF, I updated in this commit with your suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but given that it's an array of objects, it's likely that it might not be straightforward to do a sum.

Oh, interesting 🤔 at least we'll start by tracking and then we can figure out visualizing if ever it's a problem.

I'll reach out with the telemetry cluster info.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note is the telemetry team is able to perform transformations on the data in the "middle layer" of the process (which is basically a cloud service that sits in the middle of Kibana sending the data, and it being indexed into the ES cluster) so it's possible to fix any issues outside of our deployment model

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's really good to know! Thanks, I'll add it to my list of questions (w/ the increasing field count each release).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is interesting! Are those transformations documented anywhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find anything public atm, but I'd ping @mindbat for more information as he knows all about it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymao1 @mikecote The transformations are part of the new telemetry system we've been building out 😀

We did a presentation at GAH about the capabilities, and we've got docs on how to build/use a custom index to take advantage of them here. The goal is to make things as self-service as possible, so folks like yourselves can have full control over how the data gets indexed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mindbat Thank you for the links! We will review them and look into how we can take advantage of this system!

@ymao1 ymao1 added the auto-backport Deprecated: Automatically backport this PR after it's merged label Aug 16, 2021
@ymao1 ymao1 enabled auto-merge (squash) August 16, 2021 21:49
@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / general / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/lens/drag_and_drop·ts.lens app lens drag and drop tests keyboard drag and drop should drop a field to workspace

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 1 times on tracked branches: https://github.com/elastic/kibana/issues/108622

[00:00:00]       │
[00:10:49]         └-: lens app
[00:10:49]           └-> "before all" hook in "lens app"
[00:10:49]           └-> "before all" hook in "lens app"
[00:10:49]             │ debg Starting lens before method
[00:10:49]             │ info [x-pack/test/functional/es_archives/logstash_functional] Loading "mappings.json"
[00:10:49]             │ info [x-pack/test/functional/es_archives/logstash_functional] Loading "data.json.gz"
[00:10:49]             │ info [o.e.c.m.MetadataDeleteIndexService] [node-01] [logstash-2015.09.22/BbRlJ8NyRg6_Zc0-NwgZTg] deleting index
[00:10:49]             │ info [x-pack/test/functional/es_archives/logstash_functional] Deleted existing index "logstash-2015.09.22"
[00:10:49]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [logstash-2015.09.22] creating index, cause [api], templates [], shards [1]/[0]
[00:10:49]             │ info [x-pack/test/functional/es_archives/logstash_functional] Created index "logstash-2015.09.22"
[00:10:49]             │ debg [x-pack/test/functional/es_archives/logstash_functional] "logstash-2015.09.22" settings {"index":{"analysis":{"analyzer":{"url":{"max_token_length":"1000","tokenizer":"uax_url_email","type":"standard"}}},"number_of_replicas":"0","number_of_shards":"1"}}
[00:10:49]             │ info [o.e.c.m.MetadataDeleteIndexService] [node-01] [logstash-2015.09.20/EdOBBBcuQSGBJRosyDFtzQ] deleting index
[00:10:49]             │ info [x-pack/test/functional/es_archives/logstash_functional] Deleted existing index "logstash-2015.09.20"
[00:10:49]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [logstash-2015.09.20] creating index, cause [api], templates [], shards [1]/[0]
[00:10:49]             │ info [x-pack/test/functional/es_archives/logstash_functional] Created index "logstash-2015.09.20"
[00:10:49]             │ debg [x-pack/test/functional/es_archives/logstash_functional] "logstash-2015.09.20" settings {"index":{"analysis":{"analyzer":{"url":{"max_token_length":"1000","tokenizer":"uax_url_email","type":"standard"}}},"number_of_replicas":"0","number_of_shards":"1"}}
[00:10:49]             │ info [o.e.c.m.MetadataDeleteIndexService] [node-01] [logstash-2015.09.21/Lvsc7H4BTNC1Zijh8jooTw] deleting index
[00:10:49]             │ info [x-pack/test/functional/es_archives/logstash_functional] Deleted existing index "logstash-2015.09.21"
[00:10:49]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [logstash-2015.09.21] creating index, cause [api], templates [], shards [1]/[0]
[00:10:49]             │ info [x-pack/test/functional/es_archives/logstash_functional] Created index "logstash-2015.09.21"
[00:10:49]             │ debg [x-pack/test/functional/es_archives/logstash_functional] "logstash-2015.09.21" settings {"index":{"analysis":{"analyzer":{"url":{"max_token_length":"1000","tokenizer":"uax_url_email","type":"standard"}}},"number_of_replicas":"0","number_of_shards":"1"}}
[00:10:49]             │ info [o.e.c.m.MetadataMappingService] [node-01] [logstash-2015.09.21/LrVYj_VgSO220lSKA8Budw] update_mapping [_doc]
[00:10:53]             │ info [o.e.c.m.MetadataMappingService] [node-01] [logstash-2015.09.20/r40wMOM-RkaLelsC8qUdQw] update_mapping [_doc]
[00:10:59]             │ info progress: 12563
[00:11:00]             │ info [x-pack/test/functional/es_archives/logstash_functional] Indexed 4634 docs into "logstash-2015.09.22"
[00:11:00]             │ info [x-pack/test/functional/es_archives/logstash_functional] Indexed 4757 docs into "logstash-2015.09.20"
[00:11:00]             │ info [x-pack/test/functional/es_archives/logstash_functional] Indexed 4614 docs into "logstash-2015.09.21"
[00:11:00]             │ info [x-pack/test/functional/es_archives/lens/basic] Loading "mappings.json"
[00:11:00]             │ info [x-pack/test/functional/es_archives/lens/basic] Loading "data.json"
[00:11:00]             │ info [x-pack/test/functional/es_archives/lens/basic] Loading "data.json.gz"
[00:11:00]             │ info [o.e.c.m.MetadataDeleteIndexService] [node-01] [.kibana_task_manager_8.0.0_001/gmTh3Z6ISAqfR2AIjlpI4g] deleting index
[00:11:00]             │ info [o.e.c.m.MetadataDeleteIndexService] [node-01] [.kibana_1/-eLmMXNSRUup6JZjY8Rv-A] deleting index
[00:11:00]             │ info [o.e.c.m.MetadataDeleteIndexService] [node-01] [.kibana_8.0.0_001/z9uCDWS0TKuJCvdYqBARxQ] deleting index
[00:11:00]             │ info [x-pack/test/functional/es_archives/lens/basic] Deleted existing index ".kibana_8.0.0_001"
[00:11:00]             │ info [x-pack/test/functional/es_archives/lens/basic] Deleted existing index ".kibana_task_manager_8.0.0_001"
[00:11:00]             │ info [x-pack/test/functional/es_archives/lens/basic] Deleted existing index ".kibana_1"
[00:11:00]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [.kibana_1] creating index, cause [api], templates [], shards [1]/[0]
[00:11:00]             │ info [x-pack/test/functional/es_archives/lens/basic] Created index ".kibana_1"
[00:11:00]             │ debg [x-pack/test/functional/es_archives/lens/basic] ".kibana_1" settings {"index":{"auto_expand_replicas":"0-1","number_of_replicas":"0","number_of_shards":"1"}}
[00:11:00]             │ info [x-pack/test/functional/es_archives/lens/basic] Indexed 24 docs into ".kibana_1"
[00:11:00]             │ debg Migrating saved objects
[00:11:00]             │ proc [kibana]   log   [21:30:03.738] [info][savedobjects-service] [.kibana_task_manager] INIT -> CREATE_NEW_TARGET. took: 3ms.
[00:11:00]             │ proc [kibana]   log   [21:30:03.741] [info][savedobjects-service] [.kibana] INIT -> WAIT_FOR_YELLOW_SOURCE. took: 8ms.
[00:11:00]             │ proc [kibana]   log   [21:30:03.743] [info][savedobjects-service] [.kibana] WAIT_FOR_YELLOW_SOURCE -> CHECK_UNKNOWN_DOCUMENTS. took: 2ms.
[00:11:00]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [.kibana_task_manager_8.0.0_001] creating index, cause [api], templates [], shards [1]/[1]
[00:11:00]             │ info [o.e.c.r.a.AllocationService] [node-01] updating number_of_replicas to [0] for indices [.kibana_task_manager_8.0.0_001]
[00:11:00]             │ proc [kibana]   log   [21:30:03.749] [info][savedobjects-service] [.kibana] CHECK_UNKNOWN_DOCUMENTS -> SET_SOURCE_WRITE_BLOCK. took: 6ms.
[00:11:00]             │ info [o.e.c.m.MetadataIndexStateService] [node-01] adding block write to indices [[.kibana_1/9KRlrnk2ScaeBol9XdSHZA]]
[00:11:00]             │ info [o.e.c.m.MetadataIndexStateService] [node-01] completed adding block write to indices [.kibana_1]
[00:11:00]             │ proc [kibana]   log   [21:30:03.810] [info][savedobjects-service] [.kibana_task_manager] CREATE_NEW_TARGET -> MARK_VERSION_INDEX_READY. took: 72ms.
[00:11:00]             │ proc [kibana]   log   [21:30:03.825] [info][savedobjects-service] [.kibana] SET_SOURCE_WRITE_BLOCK -> CALCULATE_EXCLUDE_FILTERS. took: 76ms.
[00:11:00]             │ proc [kibana]   log   [21:30:03.830] [info][savedobjects-service] [.kibana] CALCULATE_EXCLUDE_FILTERS -> CREATE_REINDEX_TEMP. took: 5ms.
[00:11:00]             │ proc [kibana]   log   [21:30:03.848] [info][savedobjects-service] [.kibana_task_manager] MARK_VERSION_INDEX_READY -> DONE. took: 38ms.
[00:11:00]             │ proc [kibana]   log   [21:30:03.848] [info][savedobjects-service] [.kibana_task_manager] Migration completed after 113ms
[00:11:00]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [.kibana_8.0.0_reindex_temp] creating index, cause [api], templates [], shards [1]/[1]
[00:11:00]             │ info [o.e.c.r.a.AllocationService] [node-01] updating number_of_replicas to [0] for indices [.kibana_8.0.0_reindex_temp]
[00:11:01]             │ proc [kibana]   log   [21:30:03.899] [info][savedobjects-service] [.kibana] CREATE_REINDEX_TEMP -> REINDEX_SOURCE_TO_TEMP_OPEN_PIT. took: 69ms.
[00:11:01]             │ proc [kibana]   log   [21:30:03.902] [info][savedobjects-service] [.kibana] REINDEX_SOURCE_TO_TEMP_OPEN_PIT -> REINDEX_SOURCE_TO_TEMP_READ. took: 3ms.
[00:11:01]             │ proc [kibana]   log   [21:30:03.911] [info][savedobjects-service] [.kibana] Starting to process 12 documents.
[00:11:01]             │ proc [kibana]   log   [21:30:03.911] [info][savedobjects-service] [.kibana] REINDEX_SOURCE_TO_TEMP_READ -> REINDEX_SOURCE_TO_TEMP_INDEX. took: 9ms.
[00:11:01]             │ proc [kibana]   log   [21:30:03.939] [info][savedobjects-service] [.kibana] REINDEX_SOURCE_TO_TEMP_INDEX -> REINDEX_SOURCE_TO_TEMP_INDEX_BULK. took: 28ms.
[00:11:01]             │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_reindex_temp/01SNNWX9RGqCMwe5hM4ibw] update_mapping [_doc]
[00:11:01]             │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_reindex_temp/01SNNWX9RGqCMwe5hM4ibw] update_mapping [_doc]
[00:11:01]             │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_reindex_temp/01SNNWX9RGqCMwe5hM4ibw] update_mapping [_doc]
[00:11:01]             │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_reindex_temp/01SNNWX9RGqCMwe5hM4ibw] update_mapping [_doc]
[00:11:01]             │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_reindex_temp/01SNNWX9RGqCMwe5hM4ibw] update_mapping [_doc]
[00:11:01]             │ proc [kibana]   log   [21:30:04.079] [info][savedobjects-service] [.kibana] REINDEX_SOURCE_TO_TEMP_INDEX_BULK -> REINDEX_SOURCE_TO_TEMP_READ. took: 140ms.
[00:11:01]             │ proc [kibana]   log   [21:30:04.084] [info][savedobjects-service] [.kibana] Processed 12 documents out of 12.
[00:11:01]             │ proc [kibana]   log   [21:30:04.087] [info][savedobjects-service] [.kibana] REINDEX_SOURCE_TO_TEMP_READ -> REINDEX_SOURCE_TO_TEMP_CLOSE_PIT. took: 5ms.
[00:11:01]             │ proc [kibana]   log   [21:30:04.089] [info][savedobjects-service] [.kibana] REINDEX_SOURCE_TO_TEMP_CLOSE_PIT -> SET_TEMP_WRITE_BLOCK. took: 5ms.
[00:11:01]             │ info [o.e.c.m.MetadataIndexStateService] [node-01] adding block write to indices [[.kibana_8.0.0_reindex_temp/01SNNWX9RGqCMwe5hM4ibw]]
[00:11:01]             │ info [o.e.c.m.MetadataIndexStateService] [node-01] completed adding block write to indices [.kibana_8.0.0_reindex_temp]
[00:11:01]             │ proc [kibana]   log   [21:30:04.128] [info][savedobjects-service] [.kibana] SET_TEMP_WRITE_BLOCK -> CLONE_TEMP_TO_TARGET. took: 39ms.
[00:11:01]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] applying create index request using existing index [.kibana_8.0.0_reindex_temp] metadata
[00:11:01]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [.kibana_8.0.0_001] creating index, cause [clone_index], templates [], shards [1]/[1]
[00:11:01]             │ info [o.e.c.r.a.AllocationService] [node-01] updating number_of_replicas to [0] for indices [.kibana_8.0.0_001]
[00:11:01]             │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_001/GSR5QBeTR1iCL85WNmxBnw] create_mapping
[00:11:01]             │ proc [kibana]   log   [21:30:04.224] [info][savedobjects-service] [.kibana] CLONE_TEMP_TO_TARGET -> REFRESH_TARGET. took: 96ms.
[00:11:01]             │ proc [kibana]   log   [21:30:04.228] [info][savedobjects-service] [.kibana] REFRESH_TARGET -> OUTDATED_DOCUMENTS_SEARCH_OPEN_PIT. took: 4ms.
[00:11:01]             │ proc [kibana]   log   [21:30:04.230] [info][savedobjects-service] [.kibana] OUTDATED_DOCUMENTS_SEARCH_OPEN_PIT -> OUTDATED_DOCUMENTS_SEARCH_READ. took: 2ms.
[00:11:01]             │ proc [kibana]   log   [21:30:04.235] [info][savedobjects-service] [.kibana] OUTDATED_DOCUMENTS_SEARCH_READ -> OUTDATED_DOCUMENTS_SEARCH_CLOSE_PIT. took: 5ms.
[00:11:01]             │ proc [kibana]   log   [21:30:04.237] [info][savedobjects-service] [.kibana] OUTDATED_DOCUMENTS_SEARCH_CLOSE_PIT -> UPDATE_TARGET_MAPPINGS. took: 2ms.
[00:11:01]             │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_001/GSR5QBeTR1iCL85WNmxBnw] update_mapping [_doc]
[00:11:01]             │ proc [kibana]   log   [21:30:04.289] [info][savedobjects-service] [.kibana] UPDATE_TARGET_MAPPINGS -> UPDATE_TARGET_MAPPINGS_WAIT_FOR_TASK. took: 52ms.
[00:11:01]             │ info [o.e.t.LoggingTaskListener] [node-01] 24452 finished with response BulkByScrollResponse[took=23.1ms,timed_out=false,sliceId=null,updated=12,created=0,deleted=0,batches=1,versionConflicts=0,noops=0,retries=0,throttledUntil=0s,bulk_failures=[],search_failures=[]]
[00:11:01]             │ proc [kibana]   log   [21:30:04.394] [info][savedobjects-service] [.kibana] UPDATE_TARGET_MAPPINGS_WAIT_FOR_TASK -> MARK_VERSION_INDEX_READY. took: 105ms.
[00:11:01]             │ info [o.e.c.m.MetadataDeleteIndexService] [node-01] [.kibana_8.0.0_reindex_temp/01SNNWX9RGqCMwe5hM4ibw] deleting index
[00:11:01]             │ proc [kibana]   log   [21:30:04.434] [info][savedobjects-service] [.kibana] MARK_VERSION_INDEX_READY -> DONE. took: 40ms.
[00:11:01]             │ proc [kibana]   log   [21:30:04.435] [info][savedobjects-service] [.kibana] Migration completed after 702ms
[00:11:01]             │ debg [x-pack/test/functional/es_archives/lens/basic] Migrated Kibana index after loading Kibana data
[00:11:01]             │ debg [x-pack/test/functional/es_archives/lens/basic] Ensured that default space exists in .kibana
[00:11:01]             │ debg applying update to kibana config: {"accessibility:disableAnimations":true,"dateFormat:tz":"UTC","visualization:visualize:legacyChartsLibrary":true,"visualization:visualize:legacyPieChartsLibrary":true}
[00:11:03]           └-: 
[00:11:03]             └-> "before all" hook in ""
[01:01:31]             └-: lens drag and drop tests
[01:01:31]               └-> "before all" hook in "lens drag and drop tests"
[01:01:31]               └-: keyboard drag and drop
[01:01:31]                 └-> "before all" hook for "should drop a field to workspace"
[01:01:31]                 └-> should drop a field to workspace
[01:01:31]                   └-> "before each" hook: global before each for "should drop a field to workspace"
[01:01:31]                   │ debg navigating to visualize url: http://localhost:6141/app/visualize#/
[01:01:31]                   │ debg navigate to: http://localhost:6141/app/visualize#/
[01:01:31]                   │ debg ... sleep(700) start
[01:01:31]                   │ debg browser[INFO] http://localhost:6141/app/visualize?_t=1629152434620#/ 281 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[01:01:31]                   │
[01:01:31]                   │ debg browser[INFO] http://localhost:6141/bootstrap.js 41:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[01:01:32]                   │ debg ... sleep(700) end
[01:01:32]                   │ debg returned from get, calling refresh
[01:01:33]                   │ debg browser[INFO] http://localhost:6141/app/visualize?_t=1629152434620#/ 281 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[01:01:33]                   │
[01:01:33]                   │ debg browser[INFO] http://localhost:6141/bootstrap.js 41:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[01:01:33]                   │ debg currentUrl = http://localhost:6141/app/visualize#/
[01:01:33]                   │          appUrl = http://localhost:6141/app/visualize#/
[01:01:33]                   │ debg TestSubjects.find(kibanaChrome)
[01:01:33]                   │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[01:01:34]                   │ debg ... sleep(501) start
[01:01:34]                   │ debg ... sleep(501) end
[01:01:34]                   │ debg in navigateTo url = http://localhost:6141/app/visualize#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))
[01:01:34]                   │ debg --- retry.tryForTime error: URL changed, waiting for it to settle
[01:01:35]                   │ debg ... sleep(501) start
[01:01:35]                   │ debg ... sleep(501) end
[01:01:35]                   │ debg in navigateTo url = http://localhost:6141/app/visualize#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))
[01:01:35]                   │ debg isGlobalLoadingIndicatorVisible
[01:01:35]                   │ debg TestSubjects.exists(globalLoadingIndicator)
[01:01:35]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[01:01:37]                   │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[01:01:37]                   │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[01:01:37]                   │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[01:01:37]                   │ debg TestSubjects.exists(newItemButton)
[01:01:37]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="newItemButton"]') with timeout=10000
[01:01:37]                   │ debg TestSubjects.click(newItemButton)
[01:01:37]                   │ debg Find.clickByCssSelector('[data-test-subj="newItemButton"]') with timeout=10000
[01:01:37]                   │ debg Find.findByCssSelector('[data-test-subj="newItemButton"]') with timeout=10000
[01:01:37]                   │ debg TestSubjects.find(visNewDialogGroups)
[01:01:37]                   │ debg Find.findByCssSelector('[data-test-subj="visNewDialogGroups"]') with timeout=10000
[01:01:37]                   │ debg TestSubjects.click(visType-lens)
[01:01:37]                   │ debg Find.clickByCssSelector('[data-test-subj="visType-lens"]') with timeout=10000
[01:01:37]                   │ debg Find.findByCssSelector('[data-test-subj="visType-lens"]') with timeout=10000
[01:01:38]                   │ debg isGlobalLoadingIndicatorVisible
[01:01:38]                   │ debg TestSubjects.exists(globalLoadingIndicator)
[01:01:38]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[01:01:39]                   │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[01:01:40]                   │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[01:01:40]                   │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[01:01:40]                   │ debg lensPage.goToTimeRange()
[01:01:40]                   │ debg TestSubjects.exists(noDataPopoverDismissButton)
[01:01:40]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="noDataPopoverDismissButton"]') with timeout=2500
[01:01:40]                   │ debg TestSubjects.click(noDataPopoverDismissButton)
[01:01:40]                   │ debg Find.clickByCssSelector('[data-test-subj="noDataPopoverDismissButton"]') with timeout=10000
[01:01:40]                   │ debg Find.findByCssSelector('[data-test-subj="noDataPopoverDismissButton"]') with timeout=10000
[01:01:40]                   │ debg Setting absolute range to Sep 19, 2015 @ 06:31:44.000 to Sep 23, 2015 @ 18:31:44.000
[01:01:40]                   │ debg TestSubjects.exists(superDatePickerToggleQuickMenuButton)
[01:01:40]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerToggleQuickMenuButton"]') with timeout=20000
[01:01:40]                   │ debg TestSubjects.exists(superDatePickerShowDatesButton)
[01:01:40]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=2500
[01:01:40]                   │ debg TestSubjects.click(superDatePickerShowDatesButton)
[01:01:40]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=10000
[01:01:40]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=10000
[01:01:40]                   │ debg TestSubjects.exists(superDatePickerstartDatePopoverButton)
[01:01:40]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=2500
[01:01:40]                   │ debg TestSubjects.click(superDatePickerendDatePopoverButton)
[01:01:40]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerendDatePopoverButton"]') with timeout=10000
[01:01:40]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerendDatePopoverButton"]') with timeout=10000
[01:01:40]                   │ debg Find.findByCssSelector('div.euiPopover__panel-isOpen') with timeout=10000
[01:01:40]                   │ debg TestSubjects.click(superDatePickerAbsoluteTab)
[01:01:40]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[01:01:40]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[01:01:40]                   │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[01:01:40]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[01:01:40]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[01:01:40]                   │ debg TestSubjects.setValue(superDatePickerAbsoluteDateInput, Sep 23, 2015 @ 18:31:44.000)
[01:01:40]                   │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[01:01:40]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[01:01:40]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[01:01:41]                   │ debg TestSubjects.click(superDatePickerstartDatePopoverButton)
[01:01:41]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=10000
[01:01:41]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=10000
[01:01:41]                   │ debg Find.waitForElementStale with timeout=10000
[01:01:41]                   │ debg Find.findByCssSelector('div.euiPopover__panel-isOpen') with timeout=10000
[01:01:41]                   │ debg TestSubjects.click(superDatePickerAbsoluteTab)
[01:01:41]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[01:01:41]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[01:01:41]                   │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[01:01:41]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[01:01:41]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[01:01:41]                   │ debg TestSubjects.setValue(superDatePickerAbsoluteDateInput, Sep 19, 2015 @ 06:31:44.000)
[01:01:41]                   │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[01:01:41]                   │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[01:01:41]                   │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[01:01:42]                   │ debg Waiting up to 20000ms for Timepicker popover to close...
[01:01:42]                   │ debg TestSubjects.exists(superDatePickerAbsoluteDateInput)
[01:01:42]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=2500
[01:01:42]                   │ debg --- retry.tryForTime error: [data-test-subj="superDatePickerAbsoluteDateInput"] is not displayed
[01:01:45]                   │ debg --- retry.tryForTime failed again with the same message...
[01:01:45]                   │ debg TestSubjects.exists(superDatePickerApplyTimeButton)
[01:01:45]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerApplyTimeButton"]') with timeout=2500
[01:01:48]                   │ debg --- retry.tryForTime error: [data-test-subj="superDatePickerApplyTimeButton"] is not displayed
[01:01:48]                   │ debg TestSubjects.click(querySubmitButton)
[01:01:48]                   │ debg Find.clickByCssSelector('[data-test-subj="querySubmitButton"]') with timeout=10000
[01:01:48]                   │ debg Find.findByCssSelector('[data-test-subj="querySubmitButton"]') with timeout=10000
[01:01:48]                   │ debg Find.waitForElementStale with timeout=10000
[01:01:48]                   │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[01:01:48]                   │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[01:01:48]                   │ debg isGlobalLoadingIndicatorVisible
[01:01:48]                   │ debg TestSubjects.exists(globalLoadingIndicator)
[01:01:48]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[01:01:49]                   │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[01:01:49]                   │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[01:01:49]                   │ debg lensPage.dragFieldWithKeyboard('@timestamp')
[01:01:49]                   │ debg Find.findByCssSelector('[data-test-subj="lnsDragDrop_draggable-@timestamp"] [data-test-subj="lnsDragDrop-keyboardHandler"]') with timeout=10000
[01:01:49]                   │ debg lensPage.waitForLensDragDropToFinish()
[01:01:49]                   │ debg Find.existsByCssSelector('.lnsDragDrop-isActiveGroup') with timeout=2500
[01:01:52]                   │ debg isGlobalLoadingIndicatorVisible
[01:01:52]                   │ debg TestSubjects.exists(globalLoadingIndicator)
[01:01:52]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[01:01:53]                   │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[01:01:54]                   │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[01:01:54]                   │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[01:01:54]                   │ debg lensPage.getDimensionTriggerText('lnsXY_xDimensionPanel')
[01:01:54]                   │ debg lensPage.getDimensionTriggersTexts('lnsXY_xDimensionPanel')
[01:01:54]                   │ debg TestSubjects.findAll(lnsXY_xDimensionPanel > lns-dimensionTrigger)
[01:01:54]                   │ debg Find.allByCssSelector('[data-test-subj="lnsXY_xDimensionPanel"] [data-test-subj="lns-dimensionTrigger"]') with timeout=10000
[01:02:04]                   │ info Taking screenshot "/dev/shm/workspace/parallel/4/kibana/x-pack/test/functional/screenshots/failure/lens app  lens drag and drop tests keyboard drag and drop should drop a field to workspace.png"
[01:02:04]                   │ info Current URL is: http://localhost:6141/app/lens#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:%272015-09-19T06:31:44.000Z%27,to:%272015-09-23T18:31:44.000Z%27))
[01:02:04]                   │ info Saving page source to: /dev/shm/workspace/parallel/4/kibana/x-pack/test/functional/failure_debug/html/lens app  lens drag and drop tests keyboard drag and drop should drop a field to workspace.html
[01:02:04]                   └- ✖ fail: lens app  lens drag and drop tests keyboard drag and drop should drop a field to workspace
[01:02:04]                   │      Error: expected undefined to sort of equal '@timestamp'
[01:02:04]                   │       at Assertion.assert (/dev/shm/workspace/parallel/4/kibana/node_modules/@kbn/expect/expect.js:100:11)
[01:02:04]                   │       at Assertion.eql (/dev/shm/workspace/parallel/4/kibana/node_modules/@kbn/expect/expect.js:244:8)
[01:02:04]                   │       at Context.<anonymous> (test/functional/apps/lens/drag_and_drop.ts:175:92)
[01:02:04]                   │       at runMicrotasks (<anonymous>)
[01:02:04]                   │       at processTicksAndRejections (internal/process/task_queues.js:95:5)
[01:02:04]                   │       at Object.apply (/dev/shm/workspace/parallel/4/kibana/node_modules/@kbn/test/target_node/functional_test_runner/lib/mocha/wrap_function.js:87:16)
[01:02:04]                   │ 
[01:02:04]                   │ 

Stack Trace

Error: expected undefined to sort of equal '@timestamp'
    at Assertion.assert (/dev/shm/workspace/parallel/4/kibana/node_modules/@kbn/expect/expect.js:100:11)
    at Assertion.eql (/dev/shm/workspace/parallel/4/kibana/node_modules/@kbn/expect/expect.js:244:8)
    at Context.<anonymous> (test/functional/apps/lens/drag_and_drop.ts:175:92)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Object.apply (/dev/shm/workspace/parallel/4/kibana/node_modules/@kbn/test/target_node/functional_test_runner/lib/mocha/wrap_function.js:87:16) {
  actual: undefined,
  expected: '@timestamp',
  showDiff: true
}

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @ymao1

@ymao1 ymao1 merged commit 3ab111e into elastic:master Aug 17, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 17, 2021
…edefined ID is specified (elastic#108572)

* Adding telemetry usage counter for create rule API when predefined ID is specified

* Checking explicitly for default space id

* Handling undefined space id when spaces is disabled

* Consolidating logic in single function

* Tracking total usage and custom usage
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Aug 17, 2021
…edefined ID is specified (#108572) (#108812)

* Adding telemetry usage counter for create rule API when predefined ID is specified

* Checking explicitly for default space id

* Handling undefined space id when spaces is disabled

* Consolidating logic in single function

* Tracking total usage and custom usage

Co-authored-by: ymao1 <ying.mao@elastic.co>
@ymao1 ymao1 deleted the alerting/telemetry-for-predefined-rule-ids branch August 17, 2021 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated: Automatically backport this PR after it's merged Feature:Alerting/RulesManagement Issues related to the Rules Management UX Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Alerting] Add telemetry for usage of pre-defined ID in rule creation API in non-default spaces.
6 participants