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

modified team city dashboard #114

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Teamcity metrics using the OpenTelemetry Collector

## Overview

Name: natively exposes a Prometheus endpoint and the OpenTelemetry Collector has a [Prometheus receiver][otel-prom-receiver] that can be used to scrape its Prometheus endpoint. This directory contains an example showing how to configure Name: and the Collector to send metrics to Cloud Observability.

## Prerequisites

* Docker
* Docker Compose
* A Cloud Observability [access token][ls-docs-access-token]

## How to run the example

* Export your Cloud Observability access token

```sh
export LS_ACCESS_TOKEN=<YOUR_TOKEN>
```

* Run the docker compose example

```sh
docker-compose up -d
```

### Explore Metrics in Cloud Observability

See the [Name: Telemetry Docs][teamcity-docs-telemetry] for comprehensive documentation on metrics emitted and the [dashboard documentation][ls-docs-dashboards] for more details.

## Configure the Collector

Below is a snippet showing how to configure the Prometheus Receiver to scrape the Prometheus endpoint exposed by the Name: Server.

```yaml
receivers:
prometheus:
config:
scrape_configs:
- job_name: 'teamcity'
scrape_interval: 10s
metrics_path: "/app/metrics"
static_configs:
- targets: ['localhost:8111']
tls_config:
insecure_skip_verify: true
```


## Additional information

- [OpenTelemetry Collector Prometheus Receiver][otel-prom-receiver]
- [Name: Telemetry Reference][teamcity-docs-telemetry]

[ls-docs-access-token]: https://docs.lightstep.com/docs/create-and-manage-access-tokens
[ls-docs-dashboards]: https://docs.lightstep.com/docs/create-and-manage-dashboards
[otel-prom-receiver]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver
[teamcity-docs-telemetry]: https://blog.jetbrains.com/teamcity/2022/06/monitoring-teamcity-server-health/
202 changes: 202 additions & 0 deletions collector-dashboards/otel-collector-teamcity-prom-dashboard/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
terraform {
required_providers {
lightstep = {
source = "lightstep/lightstep"
version = "~> 1.70.10"
}
}
required_version = ">= v1.0.11"
}

resource "lightstep_dashboard" "otel_collector_teamcity_dashboard" {
project_name = var.lightstep_project
dashboard_name = "OpenTelemetry Team City Dashboard"
dashboard_description = "Monitor Team City with this CI/CD metrics summary."

chart {
name = "Connected Authorized Agents"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "line"
hidden = false
query_string = <<EOT
metric agents_connected_authorized_number | rate | group_by [], sum
EOT
}
}

chart {
name = "Build Queue Length"
rank = "1"
type = "timeseries"

query {
query_name = "b"
display = "line"
hidden = false
query_string = <<EOT
metric build_queue_length | rate | group_by [], sum
EOT
}
}

chart {
name = "Running Builds Count"
rank = "2"
type = "timeseries"

query {
query_name = "c"
display = "line"
hidden = false
query_string = <<EOT
metric running_builds_count | rate | group_by [], sum
EOT
}
}

chart {
name = "VCS Problem Count"
rank = "3"
type = "timeseries"

query {
query_name = "d"
display = "line"
hidden = false
query_string = <<EOT
metric vcs_problem_count | rate | group_by [], sum
EOT
}
}

chart {
name = "Server CPU Usage"
rank = "4"
type = "timeseries"

query {
query_name = "e"
display = "line"
hidden = false
query_string = <<EOT
metric server_cpu_usage | rate | group_by [], sum
EOT
}
}

chart {
name = "Connected Unauthorized Agents"
rank = "5"
type = "timeseries"
query {
query_name = "f"
display = "line"
hidden = false
query_string = <<EOT
metric agents_connected_unauthorized_number | rate | group_by [], sum
EOT
}
}

chart {
name = "Disconnected Agents"
rank = "6"
type = "timeseries"
query {
query_name = "g"
display = "line"
hidden = false
query_string = <<EOT
metric agents_disconnected_number | rate | group_by [], sum
EOT
}
}

chart {
name = "VCS Polling Time"
rank = "7"
type = "timeseries"
query {
query_name = "h"
display = "line"
hidden = false
query_string = <<EOT
metric vcs_polling_time | rate | group_by [], sum
EOT
}
}

chart {
name = "Server Memory Usage"
rank = "8"
type = "timeseries"
query {
query_name = "i"
display = "line"
hidden = false
query_string = <<EOT
metric server_memory_usage | rate | group_by [], sum
EOT
}
}

chart {
name = "Database Connection Count"
rank = "9"
type = "timeseries"
query {
query_name = "j"
display = "line"
hidden = false
query_string = <<EOT
metric db_connection_count | rate | group_by [], sum
EOT
}
}

chart {
name = "Database Query Time"
rank = "10"
type = "timeseries"
query {
query_name = "k"
display = "line"
hidden = false
query_string = <<EOT
metric db_query_time | rate | group_by [], sum
EOT
}
}

chart {
name = "Artifact Size"
rank = "11"
type = "timeseries"
query {
query_name = "l"
display = "line"
hidden = false
query_string = <<EOT
metric artifacts_size | rate | group_by [], sum
EOT
}
}

chart {
name = "Server Uptime"
rank = "12"
type = "timeseries"
query {
query_name = "m"
display = "line"
hidden = false
query_string = <<EOT
metric server_uptime | rate | group_by [], sum
EOT
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "dashboard_url" {
value = "https://app.lightstep.com/${var.lightstep_project}/dashboard/${lightstep_dashboard.otel_collector_teamcity_dashboard.id}"
description = "OpenTelemetry Team City Dashboard URL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "lightstep_project" {
description = "Name of Lightstep project"
type = string
}