---
title: "Create a Opentelemetry plugin"
method: POST
path: "/plugins#Opentelemetry"
tags: ["Plugins"]
---

# Create a Opentelemetry plugin

`POST /plugins#Opentelemetry`

Create a Opentelemetry plugin

## Request body

- CreateOpentelemetryPlugin
  - `config` object — The configuration properties for the Plugin which can be found on the plugins documentation page in the [Kong Hub](https://docs.konghq.com/hub/).
    - `batch_flush_delay` integer — The delay, in seconds, between two consecutive batches.
    - `batch_span_count` integer — The number of spans to be sent in a single batch.
    - `connect_timeout` integer — An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.
    - `header_type` 'preserve' | 'ignore' | 'b3' | 'b3-single' | 'w3c' | 'jaeger' | 'ot' | 'aws' | 'gcp' | 'datadog'
    - `headers` object — The custom headers to be added in the HTTP request sent to the OTLP server. This setting is useful for adding the authentication headers (token) for the APM backend.
    - `http_response_header_for_traceid` string
    - `logs_endpoint` string — A string representing a URL, such as https://example.com/path/to/resource?q=search.
    - `propagation` object
      - `clear` string[] — Header names to clear after context extraction. This allows to extract the context from a certain header and then remove it from the request, useful when extraction and injection are performed on different header formats and the original header should not be sent to the upstream. If left empty, no headers are cleared.
      - `default_format` 'w3c' | 'datadog' | 'b3' | 'gcp' | 'b3-single' | 'jaeger' | 'aws' | 'ot', required — The default header format to use when extractors did not match any format in the incoming headers and `inject` is configured with the value: `preserve`. This can happen when no tracing header was found in the request, or the incoming tracing header formats were not included in `extract`.
      - `extract` string[] — Header formats used to extract tracing context from incoming requests. If multiple values are specified, the first one found will be used for extraction. If left empty, Kong will not extract any tracing context information from incoming requests and generate a trace with no parent and a new trace ID.
      - `inject` string[] — Header formats used to inject tracing context. The value `preserve` will use the same header format as the incoming request. If multiple values are specified, all of them will be used during injection. If left empty, Kong will not inject any tracing context information in outgoing requests.
    - `queue` object
      - `concurrency_limit` -1 | 1 — The number of of queue delivery timers. -1 indicates unlimited.
      - `initial_retry_delay` number — Time in seconds before the initial retry is made for a failing batch.
      - `max_batch_size` integer — Maximum number of entries that can be processed at a time.
      - `max_bytes` integer — Maximum number of bytes that can be waiting on a queue, requires string content.
      - `max_coalescing_delay` number — Maximum number of (fractional) seconds to elapse after the first entry was queued before the queue starts calling the handler.
      - `max_entries` integer — Maximum number of entries that can be waiting on the queue.
      - `max_retry_delay` number — Maximum time in seconds between retries, caps exponential backoff.
      - `max_retry_time` number — Time in seconds before the queue gives up calling a failed handler for a batch.
    - `read_timeout` integer — An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.
    - `resource_attributes` object
    - `sampling_rate` number — Tracing sampling rate for configuring the probability-based sampler. When set, this value supersedes the global `tracing_sampling_rate` setting from kong.conf.
    - `send_timeout` integer — An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.
    - `traces_endpoint` string — A string representing a URL, such as https://example.com/path/to/resource?q=search.
  - `created_at` integer — Unix epoch when the resource was created.
  - `enabled` boolean — Whether the plugin is applied.
  - `id` string
  - `instance_name` string
  - `name` 'opentelemetry' — The name of the Plugin that's going to be added. Currently, the Plugin must be installed in every Kong instance separately.
  - `ordering` object
    - `after` object
      - `access` string[]
    - `before` object
      - `access` string[]
  - `protocols` string[] — A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type. For example, plugins that only work in stream mode will only support `"tcp"` and `"tls"`.
  - `tags` string[] — An optional set of strings associated with the Plugin for grouping and filtering.
  - `updated_at` integer — Unix epoch when the resource was last updated.
  - `consumer` object — If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer.
    - `id` string
  - `consumer_group` object
    - `id` string
  - `route` object — If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used.
    - `id` string
  - `service` object — If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.
    - `id` string

## Response `201`

Created Opentelemetry plugin

- OpentelemetryPlugin
  - `config` object — The configuration properties for the Plugin which can be found on the plugins documentation page in the [Kong Hub](https://docs.konghq.com/hub/).
    - `batch_flush_delay` integer — The delay, in seconds, between two consecutive batches.
    - `batch_span_count` integer — The number of spans to be sent in a single batch.
    - `connect_timeout` integer — An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.
    - `header_type` 'preserve' | 'ignore' | 'b3' | 'b3-single' | 'w3c' | 'jaeger' | 'ot' | 'aws' | 'gcp' | 'datadog'
    - `headers` object — The custom headers to be added in the HTTP request sent to the OTLP server. This setting is useful for adding the authentication headers (token) for the APM backend.
    - `http_response_header_for_traceid` string
    - `logs_endpoint` string — A string representing a URL, such as https://example.com/path/to/resource?q=search.
    - `propagation` object
      - `clear` string[] — Header names to clear after context extraction. This allows to extract the context from a certain header and then remove it from the request, useful when extraction and injection are performed on different header formats and the original header should not be sent to the upstream. If left empty, no headers are cleared.
      - `default_format` 'w3c' | 'datadog' | 'b3' | 'gcp' | 'b3-single' | 'jaeger' | 'aws' | 'ot', required — The default header format to use when extractors did not match any format in the incoming headers and `inject` is configured with the value: `preserve`. This can happen when no tracing header was found in the request, or the incoming tracing header formats were not included in `extract`.
      - `extract` string[] — Header formats used to extract tracing context from incoming requests. If multiple values are specified, the first one found will be used for extraction. If left empty, Kong will not extract any tracing context information from incoming requests and generate a trace with no parent and a new trace ID.
      - `inject` string[] — Header formats used to inject tracing context. The value `preserve` will use the same header format as the incoming request. If multiple values are specified, all of them will be used during injection. If left empty, Kong will not inject any tracing context information in outgoing requests.
    - `queue` object
      - `concurrency_limit` -1 | 1 — The number of of queue delivery timers. -1 indicates unlimited.
      - `initial_retry_delay` number — Time in seconds before the initial retry is made for a failing batch.
      - `max_batch_size` integer — Maximum number of entries that can be processed at a time.
      - `max_bytes` integer — Maximum number of bytes that can be waiting on a queue, requires string content.
      - `max_coalescing_delay` number — Maximum number of (fractional) seconds to elapse after the first entry was queued before the queue starts calling the handler.
      - `max_entries` integer — Maximum number of entries that can be waiting on the queue.
      - `max_retry_delay` number — Maximum time in seconds between retries, caps exponential backoff.
      - `max_retry_time` number — Time in seconds before the queue gives up calling a failed handler for a batch.
    - `read_timeout` integer — An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.
    - `resource_attributes` object
    - `sampling_rate` number — Tracing sampling rate for configuring the probability-based sampler. When set, this value supersedes the global `tracing_sampling_rate` setting from kong.conf.
    - `send_timeout` integer — An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.
    - `traces_endpoint` string — A string representing a URL, such as https://example.com/path/to/resource?q=search.
  - `created_at` integer — Unix epoch when the resource was created.
  - `enabled` boolean — Whether the plugin is applied.
  - `id` string
  - `instance_name` string
  - `name` 'opentelemetry' — The name of the Plugin that's going to be added. Currently, the Plugin must be installed in every Kong instance separately.
  - `ordering` object
    - `after` object
      - `access` string[]
    - `before` object
      - `access` string[]
  - `protocols` string[] — A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type. For example, plugins that only work in stream mode will only support `"tcp"` and `"tls"`.
  - `tags` string[] — An optional set of strings associated with the Plugin for grouping and filtering.
  - `updated_at` integer — Unix epoch when the resource was last updated.
  - `consumer` object — If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer.
    - `id` string
  - `consumer_group` object
    - `id` string
  - `route` object — If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used.
    - `id` string
  - `service` object — If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.
    - `id` string

## Other responses

- `401` — Unauthorized

## Changes

> 3 revisions in range; 1 not diffed.

- **2024-09-11** `5bd52189d290` — 2 warning, 10 info
  - removed the request property `allOf[#/components/schemas/OpentelemetryPluginConfig]/config/endpoint`
  - removed the optional property `allOf[#/components/schemas/OpentelemetryPluginConfig]/config/endpoint` from the response with the `201` status
  - added the new optional request property `allOf[#/components/schemas/OpentelemetryPluginConfig]/config/logs_endpoint`
  - added the new optional request property `allOf[#/components/schemas/OpentelemetryPluginConfig]/config/queue/concurrency_limit`
  - …8 more

[Change history](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/changes/plugins#Opentelemetry/post.md)

---

[API](https://skmtc.dev/kong/apis/kong-enterprise-admin-api.md) · [All operations](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kong/kong-enterprise-admin-api/revisions/5bd52189d290/schema)
