|
| 1 | +# Release 8.0.0 |
| 2 | + |
| 3 | +## Breaking changes |
| 4 | + |
| 5 | +### Python 3.7 and 3.8 are no longer supported |
| 6 | + |
| 7 | +As of version 8.0.0, Python 3.7 and 3.8 are no longer supported. |
| 8 | +The minimum required Python version is now **3.9**. |
| 9 | + |
| 10 | +If your add-on runs on Python 3.7 or 3.8, you must upgrade your environment |
| 11 | +before upgrading solnlib to 8.0.0. |
| 12 | + |
| 13 | +### New required dependencies |
| 14 | + |
| 15 | +The `observability` module introduces the following new dependencies: |
| 16 | + |
| 17 | +* `opentelemetry-api >=1.39.1,<2` |
| 18 | +* `opentelemetry-sdk >=1.39.1,<2` |
| 19 | +* `opentelemetry-exporter-otlp-proto-grpc >=1.39.1,<2` |
| 20 | +* `grpcio >=1.74.0` |
| 21 | + |
| 22 | +These are installed automatically when installing solnlib via pip. |
| 23 | + |
| 24 | +## New features |
| 25 | + |
| 26 | +### ObservabilityService |
| 27 | + |
| 28 | +A new `solnlib.observability` module has been added. It provides OpenTelemetry |
| 29 | +metric instrumentation for Splunk modular inputs, with automatic integration |
| 30 | +with the Splunk Spotlight collector. |
| 31 | + |
| 32 | +The module exposes two public components: |
| 33 | + |
| 34 | +* `ObservabilityService` — initializes a `MeterProvider` with two built-in |
| 35 | + event counters and attempts to connect to the local Spotlight OTLP collector. |
| 36 | + Falls back silently when the collector is not available, so observability |
| 37 | + failures never break the add-on. |
| 38 | +* `LoggerMetricExporter` — an OpenTelemetry `MetricExporter` that writes |
| 39 | + data points to a Python logger. Useful for local development and debugging. |
| 40 | + |
| 41 | +**Built-in counters:** |
| 42 | + |
| 43 | +| Attribute | Metric name | Unit | |
| 44 | +|-------------------------|-------------------------------|-------| |
| 45 | +| `event_count_counter` | `splunk.addon.events` | `1` | |
| 46 | +| `event_bytes_counter` | `splunk.addon.events.bytes` | `By` | |
| 47 | + |
| 48 | +**Example usage:** |
| 49 | + |
| 50 | +```python |
| 51 | +import logging |
| 52 | +from solnlib.observability import ObservabilityService, ATTR_MODINPUT_NAME |
| 53 | + |
| 54 | +logger = logging.getLogger(__name__) |
| 55 | + |
| 56 | +obs = ObservabilityService( |
| 57 | + modinput_type="my-input", |
| 58 | + logger=logger, |
| 59 | + ta_name="my_ta", |
| 60 | + ta_version="1.0.0", |
| 61 | +) |
| 62 | + |
| 63 | +# In your event collection loop: |
| 64 | +if obs.event_count_counter: |
| 65 | + obs.event_count_counter.add(len(events), {ATTR_MODINPUT_NAME: stanza_name}) |
| 66 | +if obs.event_bytes_counter: |
| 67 | + obs.event_bytes_counter.add(total_bytes, {ATTR_MODINPUT_NAME: stanza_name}) |
| 68 | +``` |
| 69 | + |
| 70 | +When `ta_name` and `ta_version` are not provided, they are read automatically |
| 71 | +from `app.conf` via `get_conf_stanzas`. Pass them explicitly when running |
| 72 | +outside a full Splunk environment. |
| 73 | + |
| 74 | +Additional instruments can be registered using `ObservabilityService.register_instrument`. |
| 75 | + |
| 76 | +For full API reference see [observability.py](observability.md). |
0 commit comments