Skip to content

Commit

Permalink
Merge pull request #3 from smartrecruiters/chore-sync-with-weaveworks…
Browse files Browse the repository at this point in the history
…-main

Chore sync with weaveworks main
  • Loading branch information
mmiedviediev authored Jan 3, 2024
2 parents c35d611 + 1f18baf commit 1b6197a
Show file tree
Hide file tree
Showing 12 changed files with 229 additions and 40 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/check-sphinx-and-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,18 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.8

- name: "Install prerequisites"
run: |
pip3 install -r docs/requirements.txt
- uses: actions/checkout@v4

- uses: ammaraskar/sphinx-action@master
# - uses: ammaraskar/sphinx-action@master
# Using fork of sphinx-action to support python version > 3.9
# As sphinx-action not updated the sphinx docker image it uses
- uses: erpcya/sphinx-action@feature/#update-sphinx-base-image
with:
docs-folder: "docs/"
pre-build-command: |
pip3 install --upgrade pip
sphinx-apidoc -f grafanalib -o docs/api
python setup.py install --user
python3 setup.py install --user
build-command: "make html"

- name: Link Checker
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on: push
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v4.6.1
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4.7.0
with:
python-version: 3.7
python-version: '3.10'
- name: Build a binary wheel and a source tarball
run: >-
pip install wheel;
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4.6.1
uses: actions/setup-python@v4.7.0
with:
python-version: ${{ matrix.python }}
- name: Run tests
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,31 @@ Changelog
0.x.x (?)
==================

* Extended DashboardLink to support links to dashboards and urls, as per the docs_

.. _`docs`: https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-dashboard-links/#dashboard-links

* Added ...
* Add Unit option for Graph panel
* Added Minimum option for Timeseries
* Added Maximum option for Timeseries
* Added Number of decimals displays option for Timeseries
* Added Bar_Chart_ panel support
* Extended SqlTarget to support parsing queries from files
* Fix AlertCondition backwards compatibility (``useNewAlerts`` default to ``False``)
* Added RateMetricAgg_ for ElasticSearch
* added axisSoftMin and axisSoftMax options for TimeSeries
* Added support for Azure Data Explorer datasource plugin (https://github.com/grafana/azure-data-explorer-datasource)
* Added ``sortBy`` parameter to Table panel
* Added ``tooltipSort`` parameter to TimeSeries panel

.. _`Bar_Chart`: https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/bar-chart/
.. _`RateMetricAgg`: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-rate-aggregation.html

* Added unit parameter to the Table class in core
* Added a hide parameter to ElasticsearchTarget
* Fix value literal GAUGE_CALC_TOTAL to sum instead of total

0.7.0 (2022-10-02)
==================

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Support
This library is in its very early stages. We'll probably make changes that
break backwards compatibility, although we'll try hard not to.

grafanalib works with Python 3.6 through 3.10.
grafanalib works with Python 3.6 through 3.11.

Developing
==========
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx == 6.1.3
sphinx_rtd_theme == 1.2.2
sphinx == 7.2.6
sphinx_rtd_theme == 1.3.0
41 changes: 41 additions & 0 deletions grafanalib/azuredataexplorer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""Helpers to create Azure Data Explorer specific Grafana queries."""

import attr

TIME_SERIES_RESULT_FORMAT = 'time_series'
TABLE_RESULT_FORMAT = 'table'
ADX_TIME_SERIES_RESULT_FORMAT = 'time_series_adx_series'


@attr.s
class AzureDataExplorerTarget(object):
"""
Generates Azure Data Explorer target JSON structure.
Link to Azure Data Explorer datasource Grafana plugin:
https://grafana.com/grafana/plugins/grafana-azure-data-explorer-datasource/
Azure Data Explorer docs on query language (KQL):
https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/
:param database: Database to execute query on
:param query: Query in Kusto Query Language (KQL)
:param resultFormat: Output format of the query result
:param alias: legend alias
:param refId: target reference id
"""

database = attr.ib(default="")
query = attr.ib(default="")
resultFormat = attr.ib(default=TIME_SERIES_RESULT_FORMAT)
alias = attr.ib(default="")
refId = attr.ib(default="")

def to_json_data(self):
return {
'database': self.database,
'query': self.query,
'resultFormat': self.resultFormat,
'alias': self.alias,
'refId': self.refId
}
Loading

0 comments on commit 1b6197a

Please sign in to comment.