• Stars
    star
    285
  • Rank 140,468 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use Kafka as a remote storage database for Prometheus (remote write only)

prometheus-kafka-adapter

CI

Prometheus-kafka-adapter is a service which receives Prometheus metrics through remote_write, marshal into JSON and sends them into Kafka.

output

It is able to write JSON or Avro-JSON messages in a kafka topic, depending on the SERIALIZATION_FORMAT configuration variable.

JSON

{
  "timestamp": "1970-01-01T00:00:00Z",
  "value": "9876543210",
  "name": "up",

  "labels": {
    "__name__": "up",
    "label1": "value1",
    "label2": "value2"
  }
}

timestamp and value are reserved values, and can't be used as label names. __name__ is a special label that defines the name of the metric and is copied as name to the top level for convenience.

Avro JSON

The Avro-JSON serialization is the same. See the Avro schema.

configuration

prometheus-kafka-adapter

There is a docker image telefonica/prometheus-kafka-adapter:1.8.0 available on Docker Hub.

Prometheus-kafka-adapter listens for metrics coming from Prometheus and sends them to Kafka. This behaviour can be configured with the following environment variables:

  • KAFKA_BROKER_LIST: defines kafka endpoint and port, defaults to kafka:9092.
  • KAFKA_TOPIC: defines kafka topic to be used, defaults to metrics. Could use go template, labels are passed (as a map) to the template: e.g: metrics.{{ index . "__name__" }} to use per-metric topic. Two template functions are available: replace ({{ index . "__name__" | replace "message" "msg" }}) and substring ({{ index . "__name__" | substring 0 5 }})
  • KAFKA_COMPRESSION: defines the compression type to be used, defaults to none.
  • KAFKA_BATCH_NUM_MESSAGES: defines the number of messages to batch write, defaults to 10000.
  • SERIALIZATION_FORMAT: defines the serialization format, can be json, avro-json, defaults to json.
  • PORT: defines http port to listen, defaults to 8080, used directly by gin.
  • BASIC_AUTH_USERNAME: basic auth username to be used for receive endpoint, defaults is no basic auth.
  • BASIC_AUTH_PASSWORD: basic auth password to be used for receive endpoint, defaults is no basic auth.
  • LOG_LEVEL: defines log level for logrus, can be debug, info, warn, error, fatal or panic, defaults to info.
  • GIN_MODE: manage gin debug logging, can be debug or release.

To connect to Kafka over SSL define the following additional environment variables:

  • KAFKA_SSL_CLIENT_CERT_FILE: Kafka SSL client certificate file, defaults to ""
  • KAFKA_SSL_CLIENT_KEY_FILE: Kafka SSL client certificate key file, defaults to ""
  • KAFKA_SSL_CLIENT_KEY_PASS: Kafka SSL client certificate key password (optional), defaults to ""
  • KAFKA_SSL_CA_CERT_FILE: Kafka SSL broker CA certificate file, defaults to ""

To connect to Kafka over SASL/SCRAM authentication define the following additional environment variables:

  • KAFKA_SECURITY_PROTOCOL: Kafka client used protocol to communicate with brokers, must be set if SASL is going to be used, either plain or with SSL
  • KAFKA_SASL_MECHANISM: SASL mechanism to use for authentication, defaults to ""
  • KAFKA_SASL_USERNAME: SASL username for use with the PLAIN and SASL-SCRAM-.. mechanisms, defaults to ""
  • KAFKA_SASL_PASSWORD: SASL password for use with the PLAIN and SASL-SCRAM-.. mechanism, defaults to ""

When deployed in a Kubernetes cluster using Helm and using a Kafka external to the cluster, it might be necessary to define the kafka hostname resolution locally (this fills the /etc/hosts of the container). Use a custom values.yaml file with section hostAliases (as mentioned in default values.yaml).

prometheus

Prometheus needs to have a remote_write url configured, pointing to the '/receive' endpoint of the host and port where the prometheus-kafka-adapter service is running. For example:

remote_write:
  - url: "http://prometheus-kafka-adapter:8080/receive"

When deployed in a Kubernetes cluster using Helm and using an external Prometheus, it might be necessary to expose prometheus-kafka-adapter input port as a node port. Use a custom values.yaml file to set service.type: NodePort and service.nodeport: <PortNumber> (see comments in default values.yaml)

development

The provided Makefile can do basic linting/building for you simply:

  • make fmt -> basic formatting.
  • make test -> runs go test fixtures
  • make vet -> runs go vet against the package
  • make vendor-update -> ensure dependencies are up to date
  • make -> builds libc and musl based binaries, including testing and vetting code

contributing

With issues:

  • Use the search tool before opening a new issue.
  • Please provide source code and commit sha if you find a bug.
  • Review existing issues and provide feedback or react to them.

With pull requests:

  • Open your pull request against master
  • It should pass all tests in the continuous integration pipeline (Github Actions).
  • You should add/modify tests to cover your proposed code changes.
  • If your pull request contains a new feature, please document it in this README.

license

Copyright 2018 Telefónica

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

Eternalblue-Doublepulsar-Metasploit

Module of Metasploit to exploit the vulnerability Eternalblue-Doublepulsar.
Ruby
1,025
star
2

HomePWN

HomePwn - Swiss Army Knife for Pentesting of IoT Devices
Python
827
star
3

ibombshell

Tool to deploy a post-exploitation prompt at any time
Python
308
star
4

ATTPwn

ATTPwn
Python
205
star
5

toolium

Wrapper tool of Selenium and Appium libraries to test web and mobile applications in a single project
Python
108
star
6

uac-a-mola

Python
107
star
7

on-the-fly

on-the-fly
Python
82
star
8

Telefonica-WannaCry-FileRestorer

Tool to restore some WannaCry files which encryption weren't finish properly
PowerShell
59
star
9

Airdrop-Crazy

Airdrop Crazy
Python
55
star
10

mistica-web

React components library for Telefonica Design System (Mistica)
TypeScript
47
star
11

nginx-canary

nginx with canary release strategy
Lua
45
star
12

level_up

Python
40
star
13

HiddenNetworks-Python

Python
37
star
14

HashCheck

Ideaslocas Repository
Python
36
star
15

USBHiddenNetworks

PowerShell
31
star
16

SDK-SMS-Stack

SDK-SMS-Stack
Java
30
star
17

webview-bridge

Novum JavaScript Bridge
TypeScript
26
star
18

latch-plugin-wordpress

Latch module for WordPress that lets end-users add an extra level of security to their accounts
PHP
24
star
19

TEFstrap

Bootstrap Theme for Telefonica
CSS
23
star
20

latch-plugin-unix

Shell
20
star
21

node-merge-config

Merge multiple configuration sources: JSON and YAML files, directories, environment properties and command-line arguments.
JavaScript
19
star
22

mistica

18
star
23

latch-sdk-python

Python
18
star
24

mistica-design

Mística Design System (only design)
18
star
25

latch-sdk-php

PHP
17
star
26

node-express-logging

Express middleware to log, using a configurable logger, each request and response.
JavaScript
16
star
27

OMLASP

OMLASP (Ideas Locas)
Jupyter Notebook
15
star
28

node-server-terminate

Allow terminating a server in an orderly fashion
JavaScript
15
star
29

seed-golang

Seed for golang projects
Go
14
star
30

WPM-Wordpress-in-Paranoid-Mode

Ruby
13
star
31

mistica-ios

Swift
13
star
32

node-jwt-utils

JSON Web Tokens (JWT) utils.
JavaScript
13
star
33

latch-plugin-joomla

PHP
11
star
34

tweaks

A customizable debug screen to view and edit flags that can be used for development
Kotlin
11
star
35

HoneyBadger

Python
10
star
36

MetaThief

PoC for extracting office files into PDF file metadata
Python
10
star
37

node-express-domaining

Express middleware to automatically create and destroy a domain.
JavaScript
10
star
38

toolium-examples

Set of examples to learn how to use toolium different functionalities
Python
10
star
39

toolium-template

Base project to start using toolium for your testing automation projects
Python
10
star
40

alfalfa

Opinionated startup for node services and applications to remove plumbing and boilerplate
TypeScript
10
star
41

puppet-github-actions-runner

In This Repository you can find a module that will setup all of the files and configuration needed for GitHub Actions runner to work on Linux hosts (Ubuntu, Debian and CentOS).
Ruby
10
star
42

node-http-pooling-agent

HTTP agent with smart socket pool
JavaScript
9
star
43

node-express-tracking

Express middleware to track the request and response storing in the domain the operation, transactionId and correlator.
JavaScript
9
star
44

CrazyToolBox

A web3 utilities toolbox
Python
9
star
45

mistica-icons

Mística Design System Icons library
8
star
46

govice

Golang library to develop a production-like service
Go
8
star
47

mistica-android

Kotlin
7
star
48

luis-cli

Simple command-line interface to interact with Microsoft LUIS APIs.
TypeScript
7
star
49

node-express-metrics

Express middleware to automatically log the metrics traces.
JavaScript
7
star
50

Docker-WPM-Environment

Ruby
6
star
51

latch-sdk-java

Java
6
star
52

latch-sdk-nodejs

NodeJS SDK for latch
JavaScript
6
star
53

node-themible

Themible Module to set up the theme (to customize the web presentation) and locales (for internationalization) of a node.js express application.
JavaScript
6
star
54

language-model-converter

Language model converter yaml <-> json for LUIS
TypeScript
5
star
55

Cube11Paths

Machine Learning authentication system based on a custom Rubik cube.
C
5
star
56

latch-plugin-jira

Latch plugin for Jira
Java
4
star
57

android-nested-scroll-webview

Android WebView implementation for nested scrolling layouts
Java
4
star
58

seed-bot

Seed bot project
TypeScript
4
star
59

clips

Snapshot of the CLIPS rules engine
C
4
star
60

latch-plugin-openLDAP

C
4
star
61

latch-sdk-c

C
4
star
62

latch-sdk-dotnet

C#
3
star
63

LambdaNetwork

Python
3
star
64

x-ray_code

XRayCode
Python
3
star
65

gymnos

A training platform for AI models
Python
3
star
66

msteams-private-messages

Send private messages programmatically in MSTeams
JavaScript
3
star
67

k8s-spa

K8s Static Pod Autoscaler
Rust
3
star
68

helm-charts

Kubernetes applications
Python
3
star
69

java-plainmap

Java library to access elements in a hierarchical map as a simple map
Java
3
star
70

latch-plugin-drupal7

PHP
3
star
71

latch-plugin-dotnet-membership-provider

C#
3
star
72

post-buildkite-plugin

Post jobs recovery buildkite plugin (WIP)
JavaScript
2
star
73

latch-plugin-squirrelmail

PHP
2
star
74

latch-sdk-ruby

Ruby
2
star
75

jwt-bulk-generator

Script to generate JWT tokens and store them in a csv file
JavaScript
2
star
76

latch-plugin-prestashop

PHP
2
star
77

Metaverse-3d-Assets

2
star
78

android-mock-api-server

Kotlin
2
star
79

latch-plugin-jenkins

Latch plugin for Jenkins CI tool
Java
2
star
80

latch-plugin-redmine

Ruby
2
star
81

latch-sdk-powershell

C#
2
star
82

dome9-cli

Dome9 utilities: SDK, CLI & Agile module
Python
2
star
83

latch-plugin-roundcube

PHP
2
star
84

living-app-v2-react-template

Set up a modern Living App by forking.
JavaScript
2
star
85

latch-plugin-open-xchange

Java
2
star
86

latch-plugin-phpBB

JavaScript
2
star
87

latch-plugin-drupal8

PHP
2
star
88

github-pr-comment-buildkite-plugin

buildkite plugin to post a comment in a PR
Shell
2
star
89

XAIoGraphs

XAIoGraphs (eXplainability Articicial Intelligence over Graphs) is an Explicability and Fairness Python library for classification problems with tabulated and discretized data.
Python
2
star
90

iot-utils

IOT operation Utilities & systems management tools - Ansible Scripting Python WinSSH OpenStack VirtualBox MySQL Postgress MongoDB DevOPS Admin
Shell
2
star
91

niji-dashboard-angular

Niji Dashboard 2.x (Angular)
TypeScript
1
star
92

latch-plugin-owncloud

PHP
1
star
93

la-acme-inc

TypeScript
1
star
94

react-code-test

TypeScript
1
star
95

latch-plugin-sugarCRM

PHP
1
star
96

latch-plugin-drupal6

PHP
1
star
97

latch-plugin-dotnetnuke

C#
1
star
98

latch-plugin-WindowsAuthProvider

C
1
star
99

qacdco-performance

QACDCO performance testing framework.
Python
1
star
100

object-storage

Tool to upload and keep objects in a AWS S3 or Azure Blob storage
TypeScript
1
star