Skip to content

Opentelemetry Infinity provide otel-collector-contrib instances through a simple REST API using a policy mechanism. Each policy spin up a new otelcol-contrib process running the configuration provided by the policy.

License

leoparente/opentelemetry-infinity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenTelemetry Infinity


Build status CodeQL Quality Gate Status CodeCov Go Report Card GitHub release (latest by date)

What is it  •   Premises  •   Command Line Interface  •   REST API  •   Policy RFC


What is it

Opentelemetry Infinity provide otel-collector-contrib instances through a simple REST API using a policy mechanism. Each policy spin up a new otelcol-contrib process running the configuration provided by the policy.

Project premises

1. Single binary: otlpinf embeds otelcol-contrib in its binary. Therefore, only one static binary is provided.

2. No persistence: opentelemetry-infinity stores data in memory and in temporary files only. This adds a new paradigm to opentelemetry-collector that is expected to run over a persisted config file as default. If you are looking for a opentelemetry orchestrator as the way it was planned to perform, you should try the official opentelemetry-operator.

3. Compatibility: opentelemetry-infinity is basically a wrapper over the official opentelemetry-collector which has not released a version 1.0 yet, i.e., breaking changes are expected. Any changes that occurs on its CLI will be reflected in this project.

4. Versioning: as opentelemetry-infinity is a wrapper over the official collector, it follows the official opentelemetry-collector version. opentelemetry-infinity pipeline does releases automatically on every new otelcol-contrib.

Docker Image

You can download and run using docker image:

docker run --net=host ghcr.io/leoparente/opentelemetry-infinity run

Command Line Interface (CLI)

Opentelemetry Infinity allows some start up configuration that is listed below. It disables opentelemetry-collector self telemetry by default to avoid port conflict. If you want to enable it back, be aware to handle it properly when starting more that one otelcol-contrib, i.e., applying more than one policy.

docker run --net=host ghcr.io/leoparente/opentelemetry-infinity run --help

Run opentelemetry-infinity

Usage:
  opentelemetry-infinity run [flags]

Flags:
  -d, --debug                Enable verbose (debug level) output
  -h, --help                 help for run
  -s, --self_telemetry       Enable self telemetry for collectors. It is disabled by default to avoid port conflict
  -a, --server_host string   Define REST Host (default "localhost")
  -p, --server_port uint     Define REST Port (default 10222)

REST API

The default otlpinf address is localhost:10222. to change that you can specify host and port when starting otlpinf:

docker run --net=host ghcr.io/leoparente/opentelemetry-infinity run -a {host} -p {port}

Routes (v1)

otlpinf is aimed to be simple and straightforward.

Get runtime and capabilities information

GET /api/v1/status (gets otlpinf runtime data)
Parameters

None

Responses
http code content-type response
200 application/json; charset=utf-8 JSON data
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:10222/api/v1/status
GET /api/v1/capabilities (gets otelcol-contrib capabilities)
Parameters

None

Responses
http code content-type response
200 application/json; charset=utf-8 JSON data
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:10222/api/v1/capabilities

Policies Management

GET /api/v1/policies (gets all existing policies)
Parameters

None

Responses
http code content-type response
200 application/json; charset=utf-8 JSON array containing all applied policy names
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:10222/api/v1/policies
POST /api/v1/policies (Creates a new policy)
Parameters
name type data type description
None required YAML object yaml format specified in Policy RFC
Responses
http code content-type response
201 application/x-yaml; charset=UTF-8 YAML object
400 application/json; charset=UTF-8 { "message": "invalid Content-Type. Only 'application/x-yaml' is supported" }
400 application/json; charset=UTF-8 Any policy error
400 application/json; charset=UTF-8 { "message": "only single policy allowed per request" }
403 application/json; charset=UTF-8 { "message": "config field is required" }
409 application/json; charset=UTF-8 { "message": "policy already exists" }
Example cURL
 curl -X POST -H "Content-Type: application/x-yaml" --data @post.yaml http://localhost:10222/api/v1/policies
GET /api/v1/policies/{policy_name} (gets information of a specific policy)
Parameters
name type data type description
policy_name required string The unique policy name
Responses
http code content-type response
200 application/x-yaml; charset=UTF-8 YAML object
404 application/json; charset=UTF-8 { "message": "policy not found" }
Example cURL
 curl -X GET http://localhost:10222/api/v1/policies/my_policy
DELETE /api/v1/policies/{policy_name} (delete a existing policy)
Parameters
name type data type description
policy_name required string The unique policy name
Responses
http code content-type response
200 application/json; charset=UTF-8 { "message": "my_policy was deleted" }
404 application/json; charset=UTF-8 { "message": "policy not found" }
Example cURL
 curl -X DELETE http://localhost:10222/api/v1/policies/my_policy

Policy RFC (v1)

my_policy:
  #Optional
  #feature_gates:
  #Optional
  set:
    processors.batch.timeout: 2s
  #Required: Same configuration that you would use inside the config file passed to a otel-collector
  config:
    receivers:
      otlp:
        protocols:
          http:
          grpc: 
 
    exporters:
      logging:
        loglevel: debug
      
    service:
      pipelines:
        metrics:
          receivers:
          - otlp
          exporters:
          - logging

About

Opentelemetry Infinity provide otel-collector-contrib instances through a simple REST API using a policy mechanism. Each policy spin up a new otelcol-contrib process running the configuration provided by the policy.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •