Coder Social home page Coder Social logo

grafana / sentry-datasource Goto Github PK

View Code? Open in Web Editor NEW
20.0 123.0 13.0 1.31 MB

Grafana data source plugin for Sentry.

Home Page: https://grafana.com/grafana/plugins/grafana-sentry-datasource/

License: Apache License 2.0

JavaScript 2.17% Go 38.80% TypeScript 58.57% SCSS 0.10% Dockerfile 0.36%
hacktoberfest

sentry-datasource's Introduction

Sentry data source plugin with Grafana

The Sentry data source plugin allows you to query and visualize Sentry data within Grafana.

Requirements

The Sentry data source has the following requirements:

  • Grafana user with a server or organization administration role; refer to Permissions.
  • An active Sentry account
  • In Sentry, The Admin, Manager, or Owner role is required to get an internal integration token

Known limitations

With the Grafana Sentry data source plugin, you are able to visualize issues, events or usage statistics within an organization. For more information, see Issues, Events and Org Stats.

Install the Sentry data source plugin

To install the Sentry data source plugin in your Grafana instance, refer to Installation.

Get an authentication token from Sentry

To configure the Sentry data source plugin within Grafana, get an internal integration token from Sentry:

  1. Go to https://sentry.io.
  2. Navigate to Organization Settings
  3. Under Developer Settings select Custom Integrations.
  4. Click Create New Integration and then select Internal Integration
  5. Use a valid name such as Grafana.
  6. Go to PERMISSIONS, provide Read permissions to the required resources such as "Project", "Issue and Event", and "Organization".
  7. Click Save Changes then scroll down to TOKENS and click + New Token
  8. Copy the token for the Sentry Auth Token field when configuring the data source within Grafana.

Note: In Sentry, The Admin, Manager, or Owner role is required to get an internal integration token

Configure the data source in Grafana

Add a data source by filling in the following fields:

Field name Description
Sentry URL Sentry URL to be used. If left blank, the default is https://sentry.io.
Sentry Org Sentry Org slug. Typically this is in the URL, such as https://sentry.io/organizations/{organization_slug}/.
Sentry Auth Token Sentry Auth token. You can generate this from https://sentry.io/settings/{organization_slug}/developer-settings/) using the steps specified in the previous section.

Configure the data source via provisioning

You can configure data sources to use Grafana’s provisioning system. For more information about how provisioning works, and all of the settings that you can set for data sources, see Provisioning Grafana.

Here is an example for provisioning this data source:

apiVersion: 1
datasources:
  - name: Sentry
    type: grafana-sentry-datasource
    access: proxy
    orgId: 1
    version: 1
    editable: false
    jsonData:
      url: https://sentry.io
      orgSlug: xxxxxxxxxxxxx
    secureJsonData:
      authToken: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Query the data source

The query editor allows you to query Sentry, get sentry issues, events and stats and display them in Grafana dashboard panels. You can choose one of the following query types, to get the relevant data.

Sentry issues

To get the list of Sentry issues, select Sentry Issues as the query type. Issues are filtered based on Grafana’s selected time range.

Field Description
Query Type Choose Issues as query type.
Projects (optional) Select one or more projects to filter the results.
Environments (optional) Select one or more environments to filter the results.
Query (optional) Enter your sentry query to get the relevant results.
Sort By (optional) Select the order of results you want to display.
Limit (optional) Limit the number of results displayed.

Sentry events

To get the list of Sentry events, select Sentry Events as the query type. Events are filtered based on Grafana’s selected time range.

Field Description
Query Type Choose Events as query type.
Projects (optional) Select one or more projects to filter the results.
Environments (optional) Select one or more environments to filter the results.
Query (optional) Enter your sentry query to get the relevant results. More on query syntax
Sort By (optional) Select the order of results you want to display.
Limit (optional) Limit the number of results displayed. Max limit - 100.

Sentry Org stats

To get the trend of Sentry Org stats, select Stats as the query type. Org stats are filtered based on Grafana’s selected time range.

Field Description
Query Type Choose Stats as query type.
Field Select the field type you want to trend. Currently, you must choose either sum(quantity) or sum(times_seen).
Category Filter Select the category you want to filter the results. You must to choose one the available option there.
Group By (optional) Select one or more fields you want to group the results.
Projects (optional) Select one or more projects to filter the results.
Outcome Filter (optional) Select one of more outcomes to filter the results.
Reason Filter (optional) Enter comma separated list of reasons you want to filter.

Templates and variables

In Grafana dashboards, you can use Sentry entities as dashboard variables. Sentry data source supports following variables:

Variable name Description
Teams Lists the Sentry teams. The team name is used as the display value, and team slug is used as as actual value.
Projects Lists the Sentry projects. The project name is used as the display value, and each project ID is used as an actual value.
Environments Lists the Sentry environments for the selected projects. If you do not select a project, all of the applicable environments are listed.

Annotations

Annotations give you the ability to overlay Sentry issues on graphs. In the annotations editor, you have to choose Issues for creating annotations from Sentry issues.

Get the most out of the plugin

sentry-datasource's People

Contributors

aangelisc avatar acifani avatar adamyeats avatar alyssabull avatar asimpson avatar bossinc avatar dependabot[bot] avatar joey-grafana avatar leandro-deveikis avatar oblador avatar olegpixel avatar vanchaxy avatar vekien avatar vickyyyyyyy avatar wbrowne avatar yesoreyeram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sentry-datasource's Issues

Allow to disable SSl validation

Hello,
I would like to ask you to add an option to make it possible to disable the SSL validation of the Sentry server cert. This is going to be helpful for self hosted setups that use a private CA.

Thanks,
Timo

Example dashboard

It would nice to have a built-in dashboard and few sample dashboards published to grafana.com

Panel showing lots of transactions for an inactive project

What happened: I installed grafana-sentry-datasource to the Grafana we are using in the company (version: 9.3.2), I created 2 panels each for the 3 projects that is on our Sentry. "Error Count" and "Transaction Count". One of these projects should have returned 0 data since Sentry is not enabled on it currently. But it shows lots of transactions and errors. Even though I selected the project filter from the dropdown. I tried creating another dashboard, re-installing the plugin, re-adding the datasource. Error persisted. When I create the datasource it says that the health check is OK

What you expected to happen: I expected to see the data of the project I specified, and since Sentry is not currently collecting data, I expected to see 0 transactions/errors

How to reproduce it (as minimally and precisely as possible): We have 10 projects on our Sentry. Don't know if it is too much for the plugin but I highly doubt it. I don't think it is reproducable on your side but I am at least expecting possible places to check. Esp. on our sentry server

Screenshots

image

This is the problematic panel. it shows ~10k average transaction

image

This is the project page of that same project. As you can see there are no such transactions.

Another interesting is we have around 19k transactions TOTAL for 24 hours. Here is a screenshot from our stats page in sentry
image

Anything else we need to know?: project_1 is the 10th project in our sentry. It's DSN ends with "/10"

Environment:

  • Grafana version: 9.3.2
  • Plugin version: 1.1.0
  • OS Grafana is installed on: Debian
  • User OS & Browser: MacOS, Google Chrome
  • Others:

Returned by a data source time series is not filtered by time window

What happened?

If the data source returns time series outside of the specified window they are still used in the reduce function.

For example, on the screenshot, you can see that all data points in the last 5 minutes are 0 but reduced to max returns 1.

image

Currently, I have this issue with the forked sentry data source because Sentry ignores a specified time window but this could be with any other data source with a similar problem.

What did you expect to happen?

I expect Grafana to use only data points from the selected time window. This is especially confusing because when specifying an alert via provisioning relativeTimeRange is specified under in reduce query but it's completely ignored. E.g.

      - refId: B
        datasourceUid: "__expr__"
        model:
          refId: B
          type: reduce
          datasource:
            uid: "-100"
            type: __expr__
          expression: A
          reducer: max
          relativeTimeRange: # doesn't matter, all range from A is using
            from: 900
            to: 0

Did this work before?

No idea, I noticed it only now

How do we reproduce it?

  1. Use a data source that returns time series outside selected window
  2. Use any min/max reduce function

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

Grafana: 10.1.2

Grafana platform?

Kubernetes

Datasource(s)?

No response

Sentry projects from dropdown menu hidden with panel.

Good day, team.

Currently got a beautiful bug on front - most of the projects could not be selected, because they're hidden with the visualization panel. Simple bug on frontend, which cause a lot of inconvenience.

Software:
Sentry v23.0
Grafana v8.2.7 (d2cccfe91e)

Steps to reproduce:
0. Generate >6 projects in the Sentry

  1. Create new Grafana panel
  2. Select Sentry datasource
  3. Count available projects

ER:
User can select from dropdown any available project to query

AR:
Projects dropdown opens up and hides with the visualization panel
image

Looks like it should open down

Support latest API

We currently don't support the latest API capabilities from Sentry. For example, we currently fetch issues via the org API route (docs) but that doesn't seem officially supported anymore?

Include inbound filters

Could we add an option to include inbound filters when querying sentry? I know that a lot of users use this to filter out unnecessary errors and I would find it quite handy.
Thanks! 🙏

Allow filtering Projects by Teams

Hello,

We are super excited by the Sentry plugin! We have tried it out, however we have quite a large number of teams that have a list of projects assigned to them. We would love to have an option to filter Sentry projects or errors by teams, as otherwise we are unable to add the plugin to our dynamic per-team dashboard. Is this something you're thinking of adding?

Issue "Last seen" based on start time of search query, cannot be changed for annotations

What happened:
When querying issues, the "Last seen" always seem to show a value within the queried time frame, not the actual "first seen". In Sentry, the "first seen" always displays correctly as the actual timestamp this issue was first seen (first event in the issue)

When exploring the query sent to Sentry, I see the interval for timestamps set for start and end are very close:

https://sentry.io/api/0/organizations/xxxl/issues/?end=2024-01-15T19%3A56%3A22&environment=production&limit=10000&project=xxxxxx&query=&sort=date&start=2024-01-15T13%3A56%3A22

When using the issues (with first seen) for Annotations, I can't force the start time to be very early (to get the correct data from sentry) without changing the entire time range for the dashboard, which makes it a little useless, since I want to see when new issues occurred, but I can't rely on the date.

What you expected to happen:

That there's a way to correctly get the actual "first seen" for issues when querying them for annotaitons.

How to reproduce it (as minimally and precisely as possible):

  1. Add sentry integration
  2. Add annotations like on screenshot

Screenshots

CleanShot 2024-01-15 at 21 07 04@2x

Environment:

  • Grafana version: Latest Grafana Cloud
  • Plugin version: 1.5.0

Plugin listing max 100 projects

What happened:

I'm trying to list specific projects, but they are not listed under Projects.
I verified that the plugin only lists the first 100 projects I have in Sentry.

Environment:

Grafana version: 8.3.5
Data source type & version: Sentry plugin
OS Grafana is installed on: Ubuntu 20.04
User OS & Browser: Chrome 99
Grafana plugins: Sentry
Sentry self-hosted version: Sentry 21.3.17

Add initial support for feature tracking

It would be useful to understand what features of the datasource are being used and how they are being used. We can start by tracking some basic features to get a sense of their usage. Below are two basic things to track, we can then expand it out as we see the need for more.

  • Track which mode is used, e.g. "Issues" or "StatsV2"
  • Track which optional settings are used in "StatsV2": "Outcome Filter", "Reason Filter", or "Group By"

Variables in query editor not working correctly

Feedback from the sentry team:

The data source plugin doesn't work with template variables, which is a problem for users who have dashboards that rely on them. Is this something that can be addressed?

I haven't confirmed, but I remember hearing from a customer that they couldn't use template variables for the Projects query type. I see it says it's supported in the doc, so might be off base here.

More details in the #grafana-sentry slack thread.

Sentry datasource querying wrong Sentry URL

What happened:
Sentry data source is attempting to fetch data from an invalid host/URL.

What you expected to happen:
Sentry data source to attempt to fetch data from the URL that is explicitly listed in the data source configuration.

How to reproduce it (as minimally and precisely as possible):

  1. Deploy Grafana using the Grafana Operator v5.8.1 on Kubernetes.
  2. Configure the Sentry data source in the Grafana Kubernetes custom resource (see snippet below for exact configuration).
  3. In the Grafana UI, visit Home > Connections > Data sources.
  4. Click the Sentry data source, then click Explore data in the top-right corner

Screenshots, Recordings, and Configuration

sentrydatasourceissue.mov

It is expected that the data source fetches data from https://cruise.sentry.io/api/0/organizations/cruise/projects instead of https://cruise.sentry.iohttps//sentry.io/api/0/organizations/cruise/projects/ (which is not a valid host).

Screenshot 2024-05-23 at 10 45 15 AM

The URL in the configuration of the data source is shown in the screen recording above. I will also share the codified configuration below:

- name: sentry 
  type: grafana-sentry-datasource
  access: proxy
  isDefault: false
  basicAuth: false
  jsonData:
    url: "https://cruise.sentry.io"
    orgSlug: "cruise"
  secureJsonData:
    authToken: "${SENTRY_TOKEN}"
  secrets:
    - name: sentry-token
      env: SENTRY_TOKEN
      targetPath: secureJsonData.authToken
      value: [redacted]
  plugins:
    - name: grafana-sentry-datasource
      version: 1.7.0
  • Grafana version: 10.4.1
  • Plugin version: 1.7.0
  • Grafana platform: Kubernetes v1.27.11 via Grafana CR using the Grafana Operator v5.8.1
  • User OS & Browser: MacOS 14.5 & Google Chrome

Interval is not calculated correctly for larger time period

In Stats type of query, when the dashboard time range is higher, the interval is not calculated correctly and getting error

Query with 30 days dashboard time range ( in explorer )

image

Query with 90 days dashboard time range ( in explorer )

image

Sentry plugin - Variable value in dashboard report an HTTP 400 "Invalid project parameter"

What happened:

I'm trying to use variable to define project name on my Sentry dashboard as referenced on the documentation of the plugin
https://grafana.com/grafana/plugins/grafana-sentry-datasource/

What you expected to happen: Filter error with the project name from the defined variable

How to reproduce it (as minimally and precisely as possible):
Add Sentry as datasource and use variable as project filter with the following parameters :
Query type : Stats
Project : your variable name (from the drop-down menu)
Field : sum(quantity)
Category filter : error

Anything else we need to know?:

Sentry Grafana integration is based on the following documentation https://grafana.com/grafana/plugins/grafana-sentry-datasource/
Also, permissions on Sentry end are the following :
Project : read
Team : no access
Release : no access
Issue & Event : read
Organization : read
Member : no access

Environment:

  • Grafana version: 8.4.0
  • Data source type & version: Sentry plugin
  • OS Grafana is installed on: Ubuntu 20.04
  • User OS & Browser: Firefox 96
  • Grafana plugins: Sentry
  • Others:

When I'm performing filtering with drop down menu, here the JSON

From query inspector without variable

{
  "request": {
    "url": "api/ds/query",
    "method": "POST",
    "data": {
      "queries": [
        {
          "datasource": {
            "uid": "lcd6BkB7k",
            "type": "grafana-sentry-datasource"
          },
          "environments": [],
          "hide": false,
          "projectIds": [
            "10"
          ],

As you can see, projectIds is set to 10, which is the right value on Sentry side for the project (from the URL e.g)

From query inspector with variable

{
  "request": {
    "url": "api/ds/query",
    "method": "POST",
    "data": {
      "queries": [
        {
          "datasource": {
            "uid": "lcd6BkB7k",
            "type": "grafana-sentry-datasource"
          },
          "environments": [],
          "hide": false,
          "projectIds": [
            "${sentry_project}"
          ],

As you can see, with variable from dashboard, the syntax is correct but I have the following result
"error": "400 Bad Request Invalid project parameter. Values must be numbers."
The variable seems correct according to the documentation

I also tried to replace project name with an integer as value but no luck with the following variable configuration :
Variable type : custom
Values separated by comma : my-project:10

Some help will be appreciated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.