How to retrieve connector id?

Hello,

I am trying to follow the instructions in this article:

to use the Cloud Connect API to create and manage connectors. I am able to create a connector and retrieve its configuration details. I want to query the metrics of the connector and the metrics API requires the connector id. The APIs to create and manage the connector only return the connector name and not the id. Is there a different API that I should use to retrieve the resource id of the connector?

Thanks!

1 Like

This question has been answered in Confluent Community Slack. Copied here to make it available to all.

Narendran S (@nshanmug):
How to retrieve connector id:
Hello,
I am trying to follow the instructions in this article:

to use the Cloud Connect API to create and manage connectors. I am able to create a connector and retrieve its configuration details. I want to query the metrics of the connector and the metrics API requires the connector id. The APIs to create and manage the connector only return the connector name and not the id. Is there a different API that I should use to retrieve the resource id of the connector?

Thanks!

Amit Kumar Gupta @AmitGupta
Hey Narendran, using the latest Confluent CLI, you can find this ID with the command confluent connect list: confluent connect list | Confluent Documentation

The connector resource ID will have the form lcc-******.

We are also looking into adding support for retrieving this ID via the API as well.

Narendran S
Hello @AmitGupta , thanks for responding to my question. I was hoping to use the sent_records metric to monitor if the connector is still transferring/pulling messages from event hub and delete the connector if there was no recent activity. Is it not possible to do this using the API, at the moment?

Is it possible to use the connector name to get the sent_records metric using the metrics API?

Amit Kumar Gupta
Narendran, today that is not possible. Only the connector ID can be used for filtering connector metrics. You can see the source of truth for what can be used for filtering (called “labels”) here: Confluent Cloud Metrics API: Reference Documentation

You can also use the API to retrieve this list, rather than in the static docs, by GETting https://api.telemetry.confluent.cloud/v2/metrics/cloud/descriptors/resources

Narendran S
Yes @AmitGupta, thanks for confirming that the connector name is not supported by the metrics API. Do you know when the connector id will be available in the Confluent Cloud API? It makes a lot of sense to return the connector id in the API response after the connector is created, since we need the id to get the metrics.

Amit Kumar Gupta
Hey there, no timeframe yet on when this will be added to the CC API

Hello @AmitGupta is there any ticket where we can see the progress to include the possibility of retrieving the connector resource.connector.id via API? this is very handy to configure prometheus to monitor the connectors.