open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.12k stars 2.39k forks source link

New component: Azure Blob Exporter #34319

Open hgaol opened 4 months ago

hgaol commented 4 months ago

The purpose and use-cases of the new component

Azure Blob Storage is Microsoft's object storage solution for the cloud. Blob Storage is optimized for storing massive amounts of unstructured data. It's also used to batch analysis via ADLA, Synapse and other services to analyze big data. link

Example configuration for the component

The following settings are required:

The following settings can be optionally configured and have default values:

An example configuration is provided as follows:

exporters:
  azureblob:
    # storage account url
    url: "https://<account-name>.blob.core.windows.net/"
    # Authentication method for exporter to ingest data.
    auth:
      #  Authentication type for expoter. supported values are: connection_string, service_principal, system_managed_identity, user_managed_identity and etc.
      type: "system_managed_identity"
    format: "json"
    container:
      metrics: "test"
      logs: "test"
      traces: "test"
  azureblob/2:
    url: "https://<account-name>.blob.core.windows.net/"
    auth:
      type: "service_principal"
      # Tenand Id for the client, only needed when type is service_principal.
      tenant_id: "xxxxxxxx-32c4-4a70-949c-c7bd7ff7af89"
      #  Client Id for the auth, only needed when type is service_principal and user_managed_identity.
      client_id: "xxxxxxx-46e6-456a-9ee6-cf3b9cb23608"
      # Secret for the client, only needed when type is service_principal.
      client_secret: "<client secret>"
    # `json` or `proto`. which present otel json or otel protobuf format, the file extension will be `json` or `pb`.
    format: "proto"
    # container name for metrics, logs and traces
    container:
      metrics: "test"
      logs: "test"
      traces: "test"
  azureblob/3:
    auth:
      type: "connection_string"
      connection_string: "DefaultEndpointsProtocol=https;AccountName=<account-name>;AccountKey=<account key>;EndpointSuffix=core.windows.net"
    container:
      metrics: "test"
      logs: "test"
      traces: "test"

Telemetry data types supported

traces, metrics, logs

Is this a vendor-specific component?

Code Owner(s)

@hgaol

Sponsor (optional)

No response

Additional context

I found there's an issue about Azure Blob exporter 2 years ago and the issue is marked as staled #8823 . Thus, I'd like to contribute this component with some more functionalities like more authentication methods, signals and others.

hgaol commented 2 months ago

The implementation could be found here. https://github.com/hgaol/opentelemetry-collector-contrib/tree/azureblob-exporter-dev

example ocb config.

dist:
  module: go.opentelemetry.io/collector/cmd/otelcorecol
  name: otelcorecol
  description: Local OpenTelemetry Collector binary, testing only.
  version: 0.103.0-dev
  otelcol_version: 0.103.0
  output_path: .

receivers:
  - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.103.0
exporters:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/azureblobexporter v0.1.0

providers:
  - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v0.103.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v0.103.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.103.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.103.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.103.0

replaces:
  - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/azureblobexporter =>  github.com/hgaol/opentelemetry-collector-contrib/exporter/azureblobexporter v0.1.0

example otel-config.yaml.

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: localhost:4317
      http:
        endpoint: localhost:4318

exporters:
  azureblob/3:
    auth:
      type: "connection_string"
      connection_string: "DefaultEndpointsProtocol=https;AccountName=<accout name>;AccountKey=<key>;EndpointSuffix=core.windows.net"
    container:
      metrics: "test"
      logs: "test"
      traces: "test"

service:
  pipelines:
    traces:
      receivers: [ otlp ]
      exporters: [ azureblob/3 ]
    logs:
      receivers: [ otlp ]
      exporters: [ azureblob/3 ]
    metrics:
      receivers: [ otlp ]
      exporters: [ azureblob/3 ]

example output.

2024-09-02T23:48:07.132+0800    info    service@v0.103.0/service.go:208 Everything is ready. Begin running and processing data.
2024-09-02T23:48:07.132+0800    warn    localhostgate/featuregate.go:63 The default endpoints for all servers in components will change to use localhost instead of 0.0.0.0 in a future version. Use the feature gate to preview the new default.   {"feature gate ID": "component.UseLocalHostAsDefaultHost"}
2024-09-02T23:48:11.318+0800    info    azureblobexporter@v0.1.0/exporter.go:225        Successfully exported traces to Azure Blob Storage      {"kind": "exporter", "data_type": "traces", "name": "azureblob/3", "container": "test", "blob": "2024/09/02/traces_23_48_11_518409.json", "size": 2476}

demo. azureblobexporter

atoulme commented 1 month ago

Please come to a SIG meeting to discuss this exporter.

hgaol commented 1 month ago

Please come to a SIG meeting to discuss this exporter.

Thanks for response @atoulme ! I've joined SIG meeting at Aug 28, 2024 for this new component. I got suggestions that it'll not be assigned a sponsor automatically and I need to find one.