Skip to content

Commit

Permalink
Release v0.0.11 (#7)
Browse files Browse the repository at this point in the history
* add tls connection check

* bump version

* update k8s docs

* update collector dependencies
  • Loading branch information
smithclay authored Mar 4, 2024
1 parent 38fe65d commit 0a3af8b
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 31 deletions.
21 changes: 14 additions & 7 deletions collector/config-k8s/values-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extraEnvs:
valueFrom:
secretKeyRef:
name: servicenow-cloudobs-token
key: token
key: CLOUDOBS_TOKEN

# We only want one of these collectors - any more and we'd produce duplicate data
replicaCount: 1
Expand Down Expand Up @@ -38,6 +38,11 @@ config:
zipkin: null

processors:
k8sattributes/cluster:
passthrough: false
extract:
metadata:
- k8s.cluster.uid
resourcedetection/gcp:
detectors: [env, gcp]
timeout: 15s
Expand Down Expand Up @@ -88,13 +93,14 @@ config:
password: ${env:SERVICENOW_EVENTS_PASSWORD}

otlp/cloudobs:
endpoint: "ingest.lighstep.com:443"
endpoint: ingest.lightstep.com:443
headers:
"lightstep-access-token": "${env:CLOUDOBS_TOKEN}"
sending_queue:
enabled: true
num_consumers: 4
queue_size: 100
timeout: 30s

service:
# This isn't the final pipeline configuration: the helm chart values
Expand All @@ -105,13 +111,14 @@ config:
# Send metrics about the collector itself to Cloud Observability
metrics/collector-monitoring:
receivers: [prometheus]
processors: [batch]
exporters: [otlp/cloudobs]
processors: [k8sattributes/cluster, batch]
exporters: [debug, otlp/cloudobs]
metrics:
exporters: [otlp/cloudobs]
processors: [k8sattributes/cluster, batch]
exporters: [debug, otlp/cloudobs]
logs:
processors: [transform/events, batch]
exporters: [otlp/cloudobs]
processors: [k8sattributes/cluster, transform/events, batch]
exporters: [debug, otlp/cloudobs]

ports:
jaeger-compact:
Expand Down
11 changes: 6 additions & 5 deletions collector/config-k8s/values-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extraEnvs:
valueFrom:
secretKeyRef:
name: servicenow-cloudobs-token
key: token
key: CLOUDOBS_TOKEN

presets:
# enables the k8sattributesprocessor and adds it to the traces, metrics, and logs pipelines
Expand Down Expand Up @@ -83,13 +83,14 @@ config:

exporters:
otlp/cloudobs:
endpoint: "ingest.lighstep.com:443"
endpoint: ingest.lightstep.com:443
headers:
"lightstep-access-token": "${env:CLOUDOBS_TOKEN}"
sending_queue:
enabled: true
num_consumers: 4
queue_size: 100
timeout: 30s

service:
# This isn't the final pipeline configuration: the helm chart values
Expand All @@ -98,11 +99,11 @@ config:
pipelines:
traces:
receivers: [otlp]
exporters: [otlp/cloudobs]
exporters: [debug, otlp/cloudobs]
metrics:
exporters: [otlp/cloudobs]
exporters: [debug, otlp/cloudobs]
logs:
exporters: [otlp/cloudobs]
exporters: [debug, otlp/cloudobs]

ports:
jaeger-compact:
Expand Down
79 changes: 79 additions & 0 deletions collector/config-k8s/values-oteldemo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
# ;)
prometheus:
enabled: false
grafana:
enabled: false
opensearch:
enabled: false
jaeger:
enabled: false

opentelemetry-collector:
config:
processors:
k8sattributes:
extract:
metadata:
- k8s.namespace.name
- k8s.deployment.name
- k8s.deployment.uid
- k8s.statefulset.name
- k8s.statefulset.uid
- k8s.daemonset.name
- k8s.daemonset.uid
- k8s.cronjob.name
- k8s.cronjob.uid
- k8s.job.name
- k8s.job.uid
- k8s.node.name
- k8s.pod.name
- k8s.pod.uid
- k8s.container.name
- container.image.tag
- container.image.name
- k8s.pod.start_time
- k8s.cluster.uid
passthrough: false
pod_association:
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: connection
exporters:
debug:
verbosity: normal
otlp/cloudobs:
endpoint: ingest.lightstep.com:443
headers:
lightstep-access-token: "YOUR_TOKEN"
service:
pipelines:
metrics:
receivers:
- otlp
processors:
- batch
exporters:
- debug
- otlp/cloudobs
traces:
receivers:
- otlp
processors:
- batch
exporters:
- debug
- otlp/cloudobs
logs:
receivers:
- otlp
processors:
- batch
exporters:
- debug
- otlp/cloudobs
6 changes: 2 additions & 4 deletions collector/otelcol-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dist:
description: ServiceNow-flavored OpenTelemetry Collector distro
output_path: ./otelcol-servicenow
otelcol_version: 0.95.0
version: 0.0.10
version: 0.0.11

exporters:
- gomod:
Expand Down Expand Up @@ -64,12 +64,10 @@ receivers:

connectors:
- gomod:
github.com/open-telemetry/opentelemetry-collector-contrib/connector/exceptionsconnector v0.95.0
github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.95.0

extensions:
- gomod:
github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.95.0
- gomod:
github.com/open-telemetry/opentelemetry-collector-contrib/extension/opampextension v0.95.0
- gomod:
github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.95.0
15 changes: 14 additions & 1 deletion collector/scripts/install/install-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SERVICE_NAME="com.servicenow.collector"
DOWNLOAD_BASE="https://github.com/lightstep/sn-collector/releases/download"

# Script Constants
PREREQS="printf sed uname tr find grep"
PREREQS="printf sed uname tr find grep curl"
TMP_DIR="${TMPDIR:-"/tmp/"}sn-collector" # Allow this to be overriden by cannonical TMPDIR env var
INSTALL_DIR="/opt/sn-collector"
SCRIPT_NAME="$0"
Expand Down Expand Up @@ -284,6 +284,18 @@ dependencies_check()
succeeded
}

check_tls_connection()
{
ingest_endpoint="ingest.lightstep.com"
banner "Checking TLS connection to $ingest_endpoint"
if echo | openssl s_client -connect $ingest_endpoint:443 > /dev/null; then
succeeded
else
failed
error_exit "$LINENO" "Could not establish a TLS connection to $ingest_endpoint"
fi
}

# This will set all installation variables
# at the beginning of the script.
setup_installation()
Expand Down Expand Up @@ -577,6 +589,7 @@ main()

setup_installation
install_package
check_tls_connection
display_results
}

Expand Down
12 changes: 12 additions & 0 deletions collector/scripts/install/install-unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ failed()
error "Failed!"
}

check_tls_connection()
{
ingest_endpoint="ingest.lightstep.com"
banner "Checking TLS connection to $ingest_endpoint"
if echo | openssl s_client -connect $ingest_endpoint:443 > /dev/null; then
succeeded
else
failed
error_exit "$LINENO" "Could not establish a TLS connection to $ingest_endpoint"
fi
}

# This will set all installation variables
# at the beginning of the script.
setup_installation()
Expand Down
2 changes: 1 addition & 1 deletion collector/service/com.servicenow.collector.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
<key>StandardOutPath</key>
<string>/opt/sn-collector/collector.log</string>
<key>StandardErrorPath</key>
<string>/var/log/sn_collector.err</string>
<string>/opt/sn-collector/collector.log</string>
</dict>
</plist>
64 changes: 54 additions & 10 deletions docs/monitor-kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@

* `helm` v3
* Kubernetes cluster with local access via `kubectl`
* ability to pull from the Docker image repository `ghcr.io/lightstep/sn-collector`
* active workloads running in your cluster (no workloads or a test cluster? [See below for deploying the OpenTelemetry demo](#optional-run-the-opentelemetry-demo))
* ability to pull from the public Docker image repository `ghcr.io/lightstep/sn-collector`
* `ClusterRole`

#### 1. Add OpenTelemetry Helm Repository
#### 1. Add OpenTelemetry helm repository

We use the OpenTelemetry Helm charts to install the OpenTelemetry Operator. The Operator makes it easy to scale and configure collectors in Kubernetes.
We use the OpenTelemetry Helm charts to configure collectors for Kubernetes monitoring. Helm charts make it easy to deploy and configure Kubernetes manifests.

```sh
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update
```

#### 2. Create a ServiceNow Namespace
#### 2. Create a ServiceNow namespace

This namespace is where the OpenTelemetry components will live in your cluster.

Expand All @@ -36,12 +38,12 @@ kubectl create namespace servicenow

#### 3. Set credentials

Paste your token carefully and escape it in single-quotes so special characters aren't interpreted by your shell.
Paste your token carefully and **escape it in single-quotes** so special characters aren't interpreted by your shell.

```sh
export CLOUDOBS_TOKEN='<your-cloudobs-token>'
kubectl create secret generic servicenow-cloudobs-token \
-n servicenow --from-literal='token=$CLOUDOBS_TOKEN'
-n servicenow --from-literal='CLOUDOBS_TOKEN=$CLOUDOBS_TOKEN'
```

Set username for Event Manangement:
Expand All @@ -60,10 +62,12 @@ kubectl create secret generic servicenow-events-password \

#### 3. Deploy ServiceNow Collector for Cluster Monitoring

You're now ready to deploy a collector to your cluster to collect cluster-level metrics and events.
You're now ready to deploy a collector to your cluster to collect cluster-level metrics and events. To preview the generated manifest before deploying, add the `--dry-run` option to the below command:

```sh
helm upgrade otel-collector-cluster open-telemetry/opentelemetry-collector --install --namespace servicenow --values https://raw.githubusercontent.com/lightstep/sn-collector/main/collector/config-k8s/values-cluster.yaml
helm upgrade otel-collector-cluster open-telemetry/opentelemetry-collector \
--install --namespace servicenow \
--values https://raw.githubusercontent.com/lightstep/sn-collector/main/collector/config-k8s/values-cluster.yaml
```

The pod will deploy after a few seconds, to check status and for errors, run:
Expand All @@ -74,8 +78,48 @@ kubectl get pods -n servicenow

#### 3. Deploy ServiceNow Collector for Node and Workloads Monitoring

Next, deploy collectors to each Kubernetes host to get workload metrics (via Kubelet).
Next, deploy collectors to each Kubernetes host to get workload metrics (via Kubelet). To preview the generated manifest before deploying, add the `--dry-run` option to the below command:

```sh
helm upgrade otel-collector open-telemetry/opentelemetry-collector --install --namespace servicenow --values https://raw.githubusercontent.com/lightstep/sn-collector/main/collector/config-k8s/values-node.yaml
helm upgrade otel-collector \
open-telemetry/opentelemetry-collector \
--install --namespace servicenow \
--values https://raw.githubusercontent.com/lightstep/sn-collector/main/collector/config-k8s/values-node.yaml
```

#### 4. See data in ServiceNow

If all went well, Kubernetes metrics and events will be sent to ServiceNow and Cloud Observability.

🎉

### Optional: Run the OpenTelemetry demo

If you just want to see how OpenTelemetry monitoring works in an otherwise empty or test cluster, the [OpenTelemetry demo](https://github.com/open-telemetry/opentelemetry-demo) is an example microservice environment with real-world metrics, logs, events and traces from a variety of microservices.

#### 1. Add OpenTelemetry helm repository

We use the OpenTelemetry Helm charts to install the OpenTelemetry Demo. If you haven't already added the repo, run:

```sh
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update
```

#### 2. Edit the demo config to use your access token

Download the file in the `collector/config-k8s/values-oteldemo.yaml` directory and replace `YOUR_TOKEN` with your [Cloud Observability access token](https://docs.lightstep.com/docs/create-and-manage-access-tokens).

#### 3. Deploy the demo environment

This will deploy a microservice environment instrumented for OpenTelemetry metrics, logs, and traces.

```sh
helm upgrade --install my-otel-demo open-telemetry/opentelemetry-demo -f collector/config-k8s/values-oteldemo.yaml
```

#### 4. See data in ServiceNow

In Cloud Observability, you should see metrics, logs, and traces from the demo environment after a few minutes.

🎉
2 changes: 1 addition & 1 deletion docs/monitor-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This install approach automatically downloads dependencies and installs the coll

### Manual install for macOS

1. On the [Releases](https://github.com/lightstep/sn-collector/releases) page, download the appropriate collector `*.tar.gz` for `darwin` and your processor type. Apple Silicon processors use the `amd` binary.
1. On the [Releases](https://github.com/lightstep/sn-collector/releases) page, download the appropriate collector `*.tar.gz` for `darwin` and your processor type. Apple Silicon processors use the `arm` binary.

2. Extract the `*.tar.gz` archive.

Expand Down
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,14 @@ The following tables represent the supported components of the ServiceNow Collec
| ---------------------------------------------------------------- | --------------- |
| healthcheck | [contrib][4] |
| opamp | [contrib][4] |
| pprof | [contrib][4] |

[4]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension

#### Connectors

| Extension | Status |
| ---------------------------------------------------------------- | --------------- |
| exceptionsconnector | in [contrib][9] |
| countconnector | in [contrib][9] |

[9]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/connector

Expand Down

0 comments on commit 0a3af8b

Please sign in to comment.