Skip to content

Latest commit

 

History

History
146 lines (135 loc) · 4.63 KB

README.md

File metadata and controls

146 lines (135 loc) · 4.63 KB

otelcol-dev

OpenTelemetry collector development environment

Setup environment

Add custom/development components

  • Create and populate a directory with the new component, eg ./datasetexporter
    • Give the module an appropriate name and location
      • Eg go mod init github.com/jmakar-scalyr/otelcol-dev/datasetexporter
  • In otelcol-dev, modify components.go to include the new component, eg:
    • $ diff -U2 components.go{.orig,}
      --- components.go.orig
      +++ components.go
      @@ -12,4 +12,5 @@
              batchprocessor "go.opentelemetry.io/collector/processor/batchprocessor"
              otlpreceiver "go.opentelemetry.io/collector/receiver/otlpreceiver"
      +       datasetexporter "github.com/jmakar-scalyr/otelcol-dev/datasetexporter"
       )
      
      @@ -33,4 +34,5 @@
              factories.Exporters, err = exporter.MakeFactoryMap(
                      loggingexporter.NewFactory(),
      +               datasetexporter.NewFactory(),
              )
              if err != nil {
  • In otelcol-dev, modify go.mod to include the new requirement and associate it with a local path, eg:
    • $ diff -U1 go.mod{.orig,}
      --- go.mod.orig
      +++ go.mod
      @@ -6,2 +6,5 @@
      
      +require "github.com/jmakar-scalyr/otelcol-dev/datasetexporter" v0.0.0
      +replace "github.com/jmakar-scalyr/otelcol-dev/datasetexporter" v0.0.0 => "../datasetexporter"
      +
       require (
  • In otelcol-dev, modify otel-config.yaml to include the new component, eg:
    • $ diff -U3 otel-config.yaml{.orig,}
      --- otel-config.yaml.orig
      +++ otel-config.yaml
      @@ -10,10 +10,13 @@
       exporters:
         logging:
           loglevel: debug
      +  dataset:
      +    apikey: <elided>
      +    dataseturl: https://app-qatesting.scalyr.com
      
       service:
         pipelines:
           logs:
             receivers: [otlp]
             processors: [batch]
      -      exporters: [logging]
      +      exporters: [logging, dataset]
  • Build a new version with: go get -u github.com/jmakar-scalyr/otelcol-dev/datasetexporter; go build -o otelcol-dev
    • Can test using curl and sample log from the previous section