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

[APM] Add sparklines to the multi-signal view table #187782

Conversation

jennypavlova
Copy link
Member

@jennypavlova jennypavlova commented Jul 8, 2024

Closes #187567

Summary

This PR adds sparklines to the multi-signal view table

image

Testing

  1. Enable observability:apmEnableMultiSignal in advanced settings
2. Run the entities definition in the dev tools
POST kbn:/internal/api/entities/definition
{
  "id": "apm-services-with-metadata",
  "name": "Services from logs and metrics",
  "displayNameTemplate": "test",
  "history": {
    "timestampField": "@timestamp",
    "interval": "5m"
  },
  "type": "service",
  "indexPatterns": [
    "logs-*",
    "metrics-*"
  ],
  "timestampField": "@timestamp",
  "lookback": "5m",
  "identityFields": [
    {
      "field": "service.name",
      "optional": false
    },
    {
      "field": "service.environment",
      "optional": true
    }
  ],
  "identityTemplate": "{{service.name}}:{{service.environment}}",
  "metadata": [
    "tags",
    "host.name",
    "data_stream.type",
    "service.name", 
    "service.instance.id",
    "service.namespace",
    "service.environment",
    "service.version",
    "service.runtime.name",
    "service.runtime.version",
    "service.node.name",
    "service.language.name",
    "agent.name",
    "cloud.provider",
    "cloud.instance.id",
    "cloud.availability_zone",
    "cloud.instance.name",
    "cloud.machine.type",
    "container.id"
  ],
  "metrics": [
    {
      "name": "latency",
      "equation": "A",
      "metrics": [
        {
          "name": "A",
          "aggregation": "avg",
          "field": "transaction.duration.histogram"
           
          
        }
      ]
    },
    {
      "name": "throughput",
      "equation": "A / 5",
      "metrics": [
        {
          "name": "A",
          "aggregation": "doc_count",
          "filter": "transaction.duration.histogram:*"
        }
      ]
    },
    {
      "name": "failedTransactionRate",
      "equation": "A / B",
      "metrics": [
        {
          "name": "A",
          "aggregation": "doc_count",
          "filter": "event.outcome: \"failure\""
        },
        {
          "name": "B",
          "aggregation": "doc_count",
          "filter": "event.outcome: *"
        }
      ]
    },
    {
      "name": "logErrorRate",
      "equation": "A / B",
      "metrics": [
        {
          "name": "A",
          "aggregation": "doc_count",
          "filter": "log.level: \"error\""
        },
        {
          "name": "B",
          "aggregation": "doc_count",
          "filter": "log.level: *"
        }
      ]
    },
     {
      "name": "logRatePerMinute",
      "equation": "A / 5",
      "metrics": [
        {
          "name": "A",
          "aggregation": "doc_count",
          "filter": "log.level: \"error\""
        }
      ]
    }
  ]
}
  1. Generate data with synthrace

    1. logs only: node scripts/synthtrace simple_logs.ts
    2. APM only: node scripts/synthtrace simple_trace.ts
  2. Open services inventory

    • the sparklines should be visible next to the values in the table (big screen only like in the services table)
    image
    • on small screens, the sparklines should not be visible
    image

@jennypavlova jennypavlova added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Jul 8, 2024
@jennypavlova jennypavlova self-assigned this Jul 8, 2024
@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@jennypavlova jennypavlova marked this pull request as ready for review July 9, 2024 12:05
@jennypavlova jennypavlova requested review from a team as code owners July 9, 2024 12:05
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Jul 9, 2024
terms: {
field: LOG_LEVEL,
include: ['error', 'ERROR'],
},
});

type LogErrorsAggregation = ReturnType<typeof getLogErrorsAggegation>;
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

Copy link
Contributor

@kpatticha kpatticha left a comment

Choose a reason for hiding this comment

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

LGTM, I left a comment

@jennypavlova jennypavlova enabled auto-merge (squash) July 10, 2024 09:36
@achyutjhunjhunwala
Copy link
Contributor

(nit): Looking at the Name Column, its Left Aligned, Will it look better to have the other columns too left aligned. At the moment looking at Mixed NA and data scenarios, this UI looks a bit wierd

@jennypavlova
Copy link
Member Author

(nit): Looking at the Name Column, its Left Aligned, Will it look better to have the other columns too left aligned. At the moment looking at Mixed NA and data scenarios, this UI looks a bit wierd

@achyutjhunjhunwala All APM tables have the same alignment, it's not something introduced here - the sparklines will look bad if we change the alignment (will move to the left). I agree that we should improve the UI so we can add an issue for that, wdyt?

getRandomSampler({ security, request, probability }),
]);

if (!serviceNames.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could make this validation before the API calls to save time in case serviceNames is empty

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I missed that when I got this part from the service overview request, moved 👍

},
// only fetches detailed statistics when requestId is invalidated by main statistics api call or offset is changed
// eslint-disable-next-line react-hooks/exhaustive-deps
[mainStatisticsData.requestId, services],
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the dependency that causes the API to be unnecessarily called?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is similar to the request we have in the services overview (POST /internal/apm/services/detailed_statistics) It's start, end, environment, kuery, and dataSourceOptions in this case

'1m'
);

logSynthtrace.index([
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logSynthtrace.index([
await logSynthtrace.index([

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks ✅

@elasticmachine
Copy link
Contributor

elasticmachine commented Jul 10, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.5MB 3.5MB +1.7KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
apm 123 124 +1
Unknown metric groups

ESLint disabled line counts

id before after diff
apm 72 73 +1

Total ESLint disabled count

id before after diff
apm 86 87 +1

History

cc @jennypavlova

@jennypavlova
Copy link
Member Author

@achyutjhunjhunwala I added an issue to improve the table alignment: #188060
Can you please check the PR again (I need a co-owner review here)?

Copy link
Contributor

@yngrdyn yngrdyn left a comment

Choose a reason for hiding this comment

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

LGTM

@jennypavlova jennypavlova merged commit 35b5fcc into elastic:main Jul 11, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Add SparkLines to the multi-signal view table
8 participants