Skip to content

Commit

Permalink
Added OpenTelemetry collector
Browse files Browse the repository at this point in the history
This will be used to collect data on the POS, and export to our main collector.
  • Loading branch information
clintonb committed Nov 10, 2023
0 parents commit 9e8a2bd
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
*.tar.gz
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# VoriPOS OpenTelemetry Collector

This repository contains an OpenTelemetry Collector configured for VoriPOS.

## Installation
This service is distributed via Homebrew.

```shell
brew tap voriteam/voripos
brew install voripos-otel-collector
brew services start voripos-otel-collector
```

## Distribution
1. Update `VORIPOS_OTEL_COLLECTOR_VERSION`.
2. Create a release on GitHub.
3. Follow the instructions at https://github.com/voriteam/homebrew-voripos to update the tap with the latest version.
68 changes: 68 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
extensions:
basicauth/client:
client_auth:
username: "${env:OTLP_USERNAME}"
password: "${env:OTLP_PASSWORD}"

receivers:
otlp:
protocols:
http:
grpc:

processors:
batch:
attributes:
actions:
- key: voripos_otel_collector_version
value: "${env:VORIPOS_OTEL_COLLECTOR_VERSION}"
action: upsert
- key: provisioned_environment
value: "${env:VORIPOS_ENVIRONMENT}"
action: upsert
- key: bannerID
value: "${env:VORIPOS_BANNER_ID}"
action: upsert
- key: bannerName
value: "${env:VORIPOS_BANNER_NAME}"
action: upsert
- key: storeID
value: "${env:VORIPOS_STORE_ID}"
action: upsert
- key: storeName
value: "${env:VORIPOS_STORE_NAME}"
action: upsert
- key: laneID
value: "${env:VORIPOS_LANE_ID}"
action: upsert
- key: laneName
value: "${env:VORIPOS_LANE_NAME}"
action: upsert
memory_limiter:
check_interval: 5s
limit_mib: 500
spike_limit_mib: 200

exporters:
debug:
verbosity: detailed
otlp:
endpoint: "${env:OTLP_HOSTNAME}:${env:OTLP_PORT}"
auth:
authenticator: basicauth/client

service:
extensions: [basicauth/client]
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter,attributes,batch]
exporters: [debug, otlp]
metrics:
receivers: [otlp]
processors: [memory_limiter,attributes,batch]
exporters: [debug, otlp]
logs:
receivers: [otlp]
processors: [memory_limiter,attributes,batch]
exporters: [debug, otlp]
32 changes: 32 additions & 0 deletions voripos-otel-collector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

# This is needed to locate the otelcol-contrib executable
export PATH="/opt/homebrew/bin:$PATH"

OTLP_HOSTNAME=$(defaults read com.vori.VoriPOS provisioned_otlpHostname)
OTLP_PORT=$(defaults read com.vori.VoriPOS provisioned_otlpPort)
OTLP_USERNAME=$(defaults read com.vori.VoriPOS provisioned_otlpUsername)
OTLP_PASSWORD=$(defaults read com.vori.VoriPOS provisioned_otlpPassword)
VORIPOS_ENVIRONMENT=$(defaults read com.vori.VoriPOS provisioned_environment)
VORIPOS_BANNER_ID=$(defaults read com.vori.VoriPOS provisioned_bannerID)
VORIPOS_BANNER_NAME=$(defaults read com.vori.VoriPOS provisioned_bannerName)
VORIPOS_STORE_ID=$(defaults read com.vori.VoriPOS provisioned_storeID)
VORIPOS_STORE_NAME=$(defaults read com.vori.VoriPOS provisioned_storeName)
VORIPOS_LANE_ID=$(defaults read com.vori.VoriPOS provisioned_laneID)
VORIPOS_LANE_NAME=$(defaults read com.vori.VoriPOS provisioned_laneName)

export OTLP_HOSTNAME
export OTLP_PORT
export OTLP_USERNAME
export OTLP_PASSWORD
export VORIPOS_ENVIRONMENT
export VORIPOS_BANNER_ID
export VORIPOS_BANNER_NAME
export VORIPOS_STORE_ID
export VORIPOS_STORE_NAME
export VORIPOS_LANE_ID
export VORIPOS_LANE_NAME
export VORIPOS_OTEL_COLLECTOR_VERSION=0.1.0

echo "Data will be exported to ${OTLP_HOSTNAME}:${OTLP_PORT}"
otelcol-contrib --config=file:$( dirname -- "$0"; )/config.yml

0 comments on commit 9e8a2bd

Please sign in to comment.