Categorygithub.com/ONSdigital/dp-import-tracker

# README

dp-import-tracker

Check for completed import instances, and mark them (and possibly their associated/parent import job) as completed.

  • At startup, ask the Dataset API for the list of active instances.

  • Add to the above in-memory list when INPUT_FILE_AVAILABLE_TOPIC events arrive.

  • Also, listen for IMPORT_OBSERVATIONS_INSERTED_TOPIC events, and inform the Dataset API with those additional numbers of inserted observations.

  • Regularly check the Dataset API for the total number of observations, and the current count of inserted observations. When the total has been inserted, mark the status of the instance as completed (and similar for the parent import job, if all other instances are also completed).

INPUT_FILE_AVAILABLE_TOPIC events are published by the Import API.

IMPORT_OBSERVATIONS_INSERTED_TOPIC events are published by the Observation Importer.

Getting started

Service is authenticated against zebedee, one can run dp-auth-api-stub to mimic service identity check in zebedee. make debug

Kafka scripts

Scripts for updating and debugging Kafka can be found here(dp-data-tools)

Configuration

Environment variableDefaultDescription
INPUT_FILE_AVAILABLE_TOPICinput-file-availabletopic name for import file available events
INPUT_FILE_AVAILABLE_CONSUMER_GROUPdp-import-trackerconsumer group name for import file available events
IMPORT_OBSERVATIONS_INSERTED_TOPICimport-observations-insertedtopic name for numbers of inserted observations
IMPORT_OBSERVATIONS_INSERTED_CONSUMER_GROUPdp-import-trackerconsumer group name for numbers of inserted observations
HIERARCHY_BUILT_TOPIChierarchy-builttopic name for built hierarchies
HIERARCHY_BUILT_CONSUMER_GROUPdp-import-trackerconsumer group name for built hierarchies
SEARCH_BUILT_TOPICdimension-search-builttopic name for search built
SEARCH_BUILT_CONSUMER_GROUPdp-import-trackerconsumer group name for search built
DATA_IMPORT_COMPLETE_TOPICdata-import-completetopic name for hierarchies ready to be imported
KAFKA_ADDRlocalhost:9092A list of kafka brokers
KAFKA_VERSION1.0.2The kafka version that this service expects to connect to
KAFKA_SEC_PROTOunsetif set to TLS, kafka connections will use TLS [1]
KAFKA_SEC_CLIENT_KEYunsetPEM for the client key [1]
KAFKA_SEC_CLIENT_CERTunsetPEM for the client certificate [1]
KAFKA_SEC_CA_CERTSunsetCA cert chain for the server cert [1]
KAFKA_SEC_SKIP_VERIFYfalseignores server certificate issues if true [1]
KAFKA_OFFSET_OLDESTtruesets kafka offset to oldest if true
IMPORT_API_ADDRhttp://localhost:21800The address of Import API
DATASET_API_ADDRhttp://localhost:22000The address of Dataset API
BIND_ADDR:21300address to listen on for healthcheck requests
GRACEFUL_SHUTDOWN_TIMEOUT5show much grace time to allow when shutting down (time.duration)
SERVICE_AUTH_TOKENAB0A5CFA-3C55-4FA8-AACC-F98039BED0ACThe service authorization token
ZEBEDEE_URLhttp://localhost:8082The host name for Zebedee
CHECK_COMPLETE_INTERVAL2000mshow much time between checking for instances
INITIALISE_LIST_INTERVAL4son startup, if getting instance list fails, how much time to wait before retries
INITIALISE_LIST_ATTEMPTS20on startup, how many times to retry for instances, before exiting, see INITIALISE_LIST_INTERVAL
HEALTHCHECK_INTERVAL30sThe period of time between health checks
HEALTHCHECK_CRITICAL_TIMEOUT90sThe period of time after which failing checks will result in critical global check

Notes:

  1. For more info, see the kafka TLS examples documentation

Graph / Neptune Configuration

Environment variableDefaultDescription
GRAPH_DRIVER_TYPE""string identifier for the implementation to be used (e.g. 'neptune' or 'mock')
GRAPH_ADDR""address of the database matching the chosen driver type (web socket)
NEPTUNE_TLS_SKIP_VERIFYfalseflag to skip TLS certificate verification, should only be true when run locally

:warning: to connect to a remote Neptune environment on MacOSX using Go 1.18 or higher you must set NEPTUNE_TLS_SKIP_VERIFY to true. See our Neptune guide for more details.

Contributing

See CONTRIBUTING for details.

License

Copyright © 2016-2021, Office for National Statistics (https://www.ons.gov.uk)

Released under MIT license, see LICENSE for details.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author