Skip to content

Commit

Permalink
Add the Tekton integration (#16665)
Browse files Browse the repository at this point in the history
* Add the structure of the Tekton integration

* update manifest

* auto install

* Add the e2e environment

* add triggers

* lint

* sleep

* switch to the operator

* lint

* add tasks

* echo sleep

* sleep

* sh

* lint

* add pipeline run

* lint

* add pipelinerun

* Implement the check and add tests

* triggers tests

* update the config

* metrics in manifest

* update the config

* nit

* update tests

* nit

* lint

* fix

* test

* add metrics

* update manifest

* simplify

* config

* lint

* add metrics

* update tests

* add metrics

* drop optional metrics

* metadata

* add service checks

* fix

* lint

* metadata

* revert gitlab stuff

* Update tekton/datadog_checks/tekton/check.py

Co-authored-by: Ilia Kurenkov <ilia.kurenkov@datadoghq.com>

* address

* lint

* fix

* Update tekton/tests/conftest.py

Co-authored-by: Ilia Kurenkov <ilia.kurenkov@datadoghq.com>

* Update tekton/datadog_checks/tekton/check.py

* Update tekton/datadog_checks/tekton/check.py

* changelog

---------

Co-authored-by: Ilia Kurenkov <ilia.kurenkov@datadoghq.com>
  • Loading branch information
FlorentClarret and iliakur authored Mar 7, 2024
1 parent 6374198 commit 4144124
Show file tree
Hide file tree
Showing 39 changed files with 4,119 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ coverage:
target: 75
flags:
- teamcity
Tekton:
target: 75
flags:
- tekton
Temporal:
target: 75
flags:
Expand Down Expand Up @@ -1361,6 +1365,11 @@ flags:
paths:
- teamcity/datadog_checks/teamcity
- teamcity/tests
tekton:
carryforward: true
paths:
- tekton/datadog_checks/tekton
- tekton/tests
temporal:
carryforward: true
paths:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/config/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ integration/tcp_queue_length:
- tcp_queue_length/**/*
integration/teamcity:
- teamcity/**/*
integration/tekton:
- tekton/**/*
integration/temporal:
- temporal/**/*
integration/tenable:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3127,6 +3127,25 @@ jobs:
test-py3: ${{ inputs.test-py3 }}
minimum-base-package: ${{ inputs.minimum-base-package }}
secrets: inherit
jf4a7e97:
uses: ./.github/workflows/test-target.yml
with:
job-name: Tekton
target: tekton
platform: linux
runner: '["ubuntu-22.04"]'
repo: "${{ inputs.repo }}"
python-version: "${{ inputs.python-version }}"
standard: ${{ inputs.standard }}
latest: ${{ inputs.latest }}
agent-image: "${{ inputs.agent-image }}"
agent-image-py2: "${{ inputs.agent-image-py2 }}"
agent-image-windows: "${{ inputs.agent-image-windows }}"
agent-image-windows-py2: "${{ inputs.agent-image-windows-py2 }}"
test-py2: ${{ inputs.test-py2 }}
test-py3: ${{ inputs.test-py3 }}
minimum-base-package: ${{ inputs.minimum-base-package }}
secrets: inherit
j840fec7:
uses: ./.github/workflows/test-target.yml
with:
Expand Down
3 changes: 3 additions & 0 deletions tekton/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CHANGELOG - Tekton

<!-- towncrier release notes start -->
55 changes: 55 additions & 0 deletions tekton/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Agent Check: Tekton

## Overview

This check monitors [Tekton][1] through the Datadog Agent.

## Setup

Follow the instructions below to install and configure this check for an Agent running on a host. For containerized environments, see the [Autodiscovery Integration Templates][3] for guidance on applying these instructions.

### Installation

The Tekton check is included in the [Datadog Agent][2] package.
No additional installation is needed on your server.

### Configuration

1. Edit the `tekton.d/conf.yaml` file, in the `conf.d/` folder at the root of your Agent's configuration directory to start collecting your tekton performance data. See the [sample tekton.d/conf.yaml][4] for all available configuration options.

2. [Restart the Agent][5].

### Validation

[Run the Agent's status subcommand][6] and look for `tekton` under the Checks section.

## Data Collected

### Metrics

See [metadata.csv][7] for a list of metrics provided by this integration.

### Events

The Tekton integration does not include any events.

### Service Checks

The Tekton integration does not include any service checks.

See [service_checks.json][8] for a list of service checks provided by this integration.

## Troubleshooting

Need help? Contact [Datadog support][9].


[1]: **LINK_TO_INTEGRATION_SITE**
[2]: https://app.datadoghq.com/account/settings/agent/latest
[3]: https://docs.datadoghq.com/agent/kubernetes/integrations/
[4]: https://github.com/DataDog/integrations-core/blob/master/tekton/datadog_checks/tekton/data/conf.yaml.example
[5]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[6]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
[7]: https://github.com/DataDog/integrations-core/blob/master/tekton/metadata.csv
[8]: https://github.com/DataDog/integrations-core/blob/master/tekton/assets/service_checks.json
[9]: https://docs.datadoghq.com/help/
27 changes: 27 additions & 0 deletions tekton/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tekton
files:
- name: tekton.yaml
options:
- template: init_config
options:
- template: init_config/openmetrics
- template: instances
options:
- name: pipelines_controller_endpoint
description: |
Endpoint exposing the Pipelines Controller's Prometheus metrics.
value:
display_default: null
example: http://tekton-pipelines-controller:9090/metrics
type: string
- name: triggers_controller_endpoint
description: |
Endpoint exposing the Triggers Controller's Prometheus metrics.
value:
display_default: null
example: http://tekton-triggers-controller:9000/metrics
type: string
- template: instances/openmetrics
overrides:
openmetrics_endpoint.required: false
openmetrics_endpoint.hidden: true
32 changes: 32 additions & 0 deletions tekton/assets/service_checks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"agent_version": "7.53.0",
"integration": "Tekton",
"check": "tekton.pipelines_controller.openmetrics.health",
"statuses": [
"ok",
"critical"
],
"groups": [
"host",
"endpoint"
],
"name": "Tekton Pipelines openmetrics endpoint up",
"description": "Returns `CRITICAL` if the check cannot access the openmetrics metrics endpoint of Tekton Pipelines."
},
{
"agent_version": "7.53.0",
"integration": "Tekton",
"check": "tekton.triggers_controller.openmetrics.health",
"statuses": [
"ok",
"critical"
],
"groups": [
"host",
"endpoint"
],
"name": "Tekton Triggers openmetrics endpoint up",
"description": "Returns `CRITICAL` if the check cannot access the openmetrics metrics endpoint of Tekton Triggers."
}
]
1 change: 1 addition & 0 deletions tekton/changelog.d/16665.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Initial Release
4 changes: 4 additions & 0 deletions tekton/datadog_checks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
4 changes: 4 additions & 0 deletions tekton/datadog_checks/tekton/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = '0.0.1'
7 changes: 7 additions & 0 deletions tekton/datadog_checks/tekton/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .__about__ import __version__
from .check import TektonCheck

__all__ = ['__version__', 'TektonCheck']
38 changes: 38 additions & 0 deletions tekton/datadog_checks/tekton/check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from datadog_checks.base import ConfigurationError, OpenMetricsBaseCheckV2
from datadog_checks.tekton.config_models import ConfigMixin

from .metrics import ENDPOINTS_METRICS_MAP


class TektonCheck(OpenMetricsBaseCheckV2, ConfigMixin):
DEFAULT_METRIC_LIMIT = 0

def __init__(self, name, init_config, instances):
super(TektonCheck, self).__init__(name, init_config, instances)
self.check_initializations.appendleft(self.parse_config)

def parse_config(self):
self.scraper_configs = []

if not any(self.instance.get(endpoint) for endpoint in ENDPOINTS_METRICS_MAP):
raise ConfigurationError(
f"Must specify at least one of the following: {', '.join(ENDPOINTS_METRICS_MAP.keys())}."
)

for endpoint, metrics in ENDPOINTS_METRICS_MAP.items():
if url := self.instance.get(endpoint):
self.scraper_configs.append(
self.generate_config(url, f"tekton.{endpoint.removesuffix('_endpoint')}", metrics)
)

def generate_config(self, endpoint, namespace, metrics):
config = {
'openmetrics_endpoint': endpoint,
'metrics': [metrics],
'namespace': namespace,
}
config |= self.instance
return config
24 changes: 24 additions & 0 deletions tekton/datadog_checks/tekton/config_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

# This file is autogenerated.
# To change this file you should edit assets/configuration/spec.yaml and then run the following commands:
# ddev -x validate config -s <INTEGRATION_NAME>
# ddev -x validate models -s <INTEGRATION_NAME>

from .instance import InstanceConfig
from .shared import SharedConfig


class ConfigMixin:
_config_model_instance: InstanceConfig
_config_model_shared: SharedConfig

@property
def config(self) -> InstanceConfig:
return self._config_model_instance

@property
def shared_config(self) -> SharedConfig:
return self._config_model_shared
132 changes: 132 additions & 0 deletions tekton/datadog_checks/tekton/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

# This file is autogenerated.
# To change this file you should edit assets/configuration/spec.yaml and then run the following commands:
# ddev -x validate config -s <INTEGRATION_NAME>
# ddev -x validate models -s <INTEGRATION_NAME>


def shared_skip_proxy():
return False


def shared_timeout():
return 10


def instance_allow_redirects():
return True


def instance_auth_type():
return 'basic'


def instance_cache_metric_wildcards():
return True


def instance_cache_shared_labels():
return True


def instance_collect_counters_with_distributions():
return False


def instance_collect_histogram_buckets():
return True


def instance_disable_generic_tags():
return False


def instance_empty_default_hostname():
return False


def instance_enable_health_service_check():
return True


def instance_histogram_buckets_as_distributions():
return False


def instance_ignore_connection_errors():
return False


def instance_kerberos_auth():
return 'disabled'


def instance_kerberos_delegate():
return False


def instance_kerberos_force_initiate():
return False


def instance_log_requests():
return False


def instance_min_collection_interval():
return 15


def instance_non_cumulative_histogram_buckets():
return False


def instance_persist_connections():
return False


def instance_request_size():
return 16


def instance_skip_proxy():
return False


def instance_tag_by_endpoint():
return True


def instance_telemetry():
return False


def instance_timeout():
return 10


def instance_tls_ignore_warning():
return False


def instance_tls_use_host_header():
return False


def instance_tls_verify():
return True


def instance_use_latest_spec():
return False


def instance_use_legacy_auth_encoding():
return True


def instance_use_process_start_time():
return False
Loading

0 comments on commit 4144124

Please sign in to comment.