Fix create_message_chunks import error across all collectors
The installed Diode SDK version does not export create_message_chunks. Replace chunked ingestion with direct client.ingest() calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
427dbf456d
commit
37b92c166a
@ -415,8 +415,6 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
|
|
||||||
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
||||||
|
|
||||||
from netboxlabs.diode.sdk.ingester import create_message_chunks
|
|
||||||
|
|
||||||
with DiodeClient(
|
with DiodeClient(
|
||||||
target=target,
|
target=target,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
@ -424,13 +422,11 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
app_name="cml-collector",
|
app_name="cml-collector",
|
||||||
app_version="0.1.0",
|
app_version="0.1.0",
|
||||||
) as client:
|
) as client:
|
||||||
chunks = create_message_chunks(entities)
|
resp = client.ingest(entities=entities)
|
||||||
for idx, chunk in enumerate(chunks):
|
if resp.errors:
|
||||||
resp = client.ingest(entities=chunk)
|
log.error("Ingestion errors: %s", resp.errors)
|
||||||
if resp.errors:
|
else:
|
||||||
log.error("Chunk %d errors: %s", idx, resp.errors)
|
log.info("Ingestion successful")
|
||||||
else:
|
|
||||||
log.info("Chunk %d: %d entities ingested", idx, len(chunk))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -315,8 +315,6 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
|
|
||||||
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
||||||
|
|
||||||
from netboxlabs.diode.sdk.ingester import create_message_chunks
|
|
||||||
|
|
||||||
with DiodeClient(
|
with DiodeClient(
|
||||||
target=target,
|
target=target,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
@ -324,13 +322,11 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
app_name="docker-collector",
|
app_name="docker-collector",
|
||||||
app_version="0.1.0",
|
app_version="0.1.0",
|
||||||
) as client:
|
) as client:
|
||||||
chunks = create_message_chunks(entities)
|
resp = client.ingest(entities=entities)
|
||||||
for idx, chunk in enumerate(chunks):
|
if resp.errors:
|
||||||
resp = client.ingest(entities=chunk)
|
log.error("Ingestion errors: %s", resp.errors)
|
||||||
if resp.errors:
|
else:
|
||||||
log.error("Chunk %d errors: %s", idx, resp.errors)
|
log.info("Ingestion successful")
|
||||||
else:
|
|
||||||
log.info("Chunk %d: %d entities ingested", idx, len(chunk))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -1608,8 +1608,6 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
|
|
||||||
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
||||||
|
|
||||||
from netboxlabs.diode.sdk.ingester import create_message_chunks
|
|
||||||
|
|
||||||
with DiodeClient(
|
with DiodeClient(
|
||||||
target=target,
|
target=target,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
@ -1617,13 +1615,11 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
app_name="network-collector",
|
app_name="network-collector",
|
||||||
app_version="0.1.0",
|
app_version="0.1.0",
|
||||||
) as client:
|
) as client:
|
||||||
chunks = create_message_chunks(entities)
|
resp = client.ingest(entities=entities)
|
||||||
for idx, chunk in enumerate(chunks):
|
if resp.errors:
|
||||||
resp = client.ingest(entities=chunk)
|
log.error("Ingestion errors: %s", resp.errors)
|
||||||
if resp.errors:
|
else:
|
||||||
log.error("Chunk %d errors: %s", idx, resp.errors)
|
log.info("Ingestion successful")
|
||||||
else:
|
|
||||||
log.info("Chunk %d: %d entities ingested", idx, len(chunk))
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
@ -337,8 +337,6 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
|
|
||||||
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
||||||
|
|
||||||
from netboxlabs.diode.sdk.ingester import create_message_chunks
|
|
||||||
|
|
||||||
with DiodeClient(
|
with DiodeClient(
|
||||||
target=target,
|
target=target,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
@ -346,13 +344,11 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
app_name="observium-collector",
|
app_name="observium-collector",
|
||||||
app_version="0.1.0",
|
app_version="0.1.0",
|
||||||
) as client:
|
) as client:
|
||||||
chunks = create_message_chunks(entities)
|
resp = client.ingest(entities=entities)
|
||||||
for idx, chunk in enumerate(chunks):
|
if resp.errors:
|
||||||
resp = client.ingest(entities=chunk)
|
log.error("Ingestion errors: %s", resp.errors)
|
||||||
if resp.errors:
|
else:
|
||||||
log.error("Chunk %d errors: %s", idx, resp.errors)
|
log.info("Ingestion successful")
|
||||||
else:
|
|
||||||
log.info("Chunk %d: %d entities ingested", idx, len(chunk))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -713,8 +713,6 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
|
|
||||||
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
||||||
|
|
||||||
from netboxlabs.diode.sdk.ingester import create_message_chunks
|
|
||||||
|
|
||||||
with DiodeClient(
|
with DiodeClient(
|
||||||
target=target,
|
target=target,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
@ -722,13 +720,11 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
app_name="unifi-collector",
|
app_name="unifi-collector",
|
||||||
app_version="0.1.0",
|
app_version="0.1.0",
|
||||||
) as client:
|
) as client:
|
||||||
chunks = create_message_chunks(entities)
|
resp = client.ingest(entities=entities)
|
||||||
for idx, chunk in enumerate(chunks):
|
if resp.errors:
|
||||||
resp = client.ingest(entities=chunk)
|
log.error("Ingestion errors: %s", resp.errors)
|
||||||
if resp.errors:
|
else:
|
||||||
log.error("Chunk %d errors: %s", idx, resp.errors)
|
log.info("Ingestion successful")
|
||||||
else:
|
|
||||||
log.info("Chunk %d: %d entities ingested", idx, len(chunk))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -503,8 +503,6 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
|
|
||||||
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
||||||
|
|
||||||
from netboxlabs.diode.sdk.ingester import create_message_chunks
|
|
||||||
|
|
||||||
with DiodeClient(
|
with DiodeClient(
|
||||||
target=target,
|
target=target,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
@ -512,13 +510,11 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
app_name="vmware-collector",
|
app_name="vmware-collector",
|
||||||
app_version="0.1.0",
|
app_version="0.1.0",
|
||||||
) as client:
|
) as client:
|
||||||
chunks = create_message_chunks(entities)
|
resp = client.ingest(entities=entities)
|
||||||
for idx, chunk in enumerate(chunks):
|
if resp.errors:
|
||||||
resp = client.ingest(entities=chunk)
|
log.error("Ingestion errors: %s", resp.errors)
|
||||||
if resp.errors:
|
else:
|
||||||
log.error("Chunk %d errors: %s", idx, resp.errors)
|
log.info("Ingestion successful")
|
||||||
else:
|
|
||||||
log.info("Chunk %d: %d entities ingested", idx, len(chunk))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -331,8 +331,6 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
|
|
||||||
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
log.info("Ingesting %d entities to %s ...", len(entities), target)
|
||||||
|
|
||||||
from netboxlabs.diode.sdk.ingester import create_message_chunks
|
|
||||||
|
|
||||||
with DiodeClient(
|
with DiodeClient(
|
||||||
target=target,
|
target=target,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
@ -340,13 +338,11 @@ def ingest_entities(entities: list[Entity], dry_run: bool = False) -> None:
|
|||||||
app_name="zabbix-collector",
|
app_name="zabbix-collector",
|
||||||
app_version="0.1.0",
|
app_version="0.1.0",
|
||||||
) as client:
|
) as client:
|
||||||
chunks = create_message_chunks(entities)
|
resp = client.ingest(entities=entities)
|
||||||
for idx, chunk in enumerate(chunks):
|
if resp.errors:
|
||||||
resp = client.ingest(entities=chunk)
|
log.error("Ingestion errors: %s", resp.errors)
|
||||||
if resp.errors:
|
else:
|
||||||
log.error("Chunk %d errors: %s", idx, resp.errors)
|
log.info("Ingestion successful")
|
||||||
else:
|
|
||||||
log.info("Chunk %d: %d entities ingested", idx, len(chunk))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user