Skip to content

InfluxDB Connector for GoFr #2072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: development
Choose a base branch
from

Conversation

akhilsharmaa
Copy link

@akhilsharmaa akhilsharmaa commented Jul 17, 2025

InfluxDB Connector for GoFr

Closes: #1994

Contributor: Akhilesh Kumar Sharma
Track: Core Framework

Overview

This PR introduces native support for InfluxDB, a widely-used time-series database, to GoFr. With this integration, GoFr can now seamlessly store and query high-frequency data such as metrics and sensor data, enhancing its capabilities for time-series workloads.

Problem

Currently, GoFr does not support InfluxDB, which restricts its ability to effectively manage time-series data. This integration addresses that limitation by adding the necessary functionality.

Scope

The following changes and features have been implemented in this PR:

  • Added an InfluxDB datasource in pkg/gofr/datasource/influxdb.
  • Introduced a method on App to utilize the datasource.
  • Implemented logging for operations and failures to aid in debugging and monitoring.

Checklist

  • I have formatted my code using goimport and golangci-lint.
  • All new code is covered by unit tests.
  • This PR does not decrease the overall code coverage.
  • I have reviewed the code comments and documentation for clarity.

@gizmo-rt gizmo-rt added the enhancement New feature or request label Jul 17, 2025
@coolwednesday coolwednesday changed the title [GoFr-SOC]: InfluxDB Connector for GoFr InfluxDB Connector for GoFr Jul 21, 2025
Copy link
Member

@Umang01-hash Umang01-hash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Create a separate go.mod for pkg/gofr.datasource/influxdb and please make sure no unnecessary imports are added to GoFr's go.mod.
  • No test files added. Please make sure to try and achieve atleast 80-85% code coverage in the newly added directory influxdb.
  • GoDoc comments are not proper and lacks info about the method.
  • Your newly added code has a lot of linter errors in pkg/gofr/datasource/influxdb. Please address and resolve them.
  • The file interfaces.go is empty. If you don;t need it you can delete it but i think you need it for testing and other purposes. Please refer to other datasources and you will understand.
  • Let's add screenshots for InfluxDB logs and queries to see how they look after pretty printed.

go.mod Outdated
@@ -17,6 +17,7 @@ require (
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.3
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/influxdata/influxdb-client-go/v2 v2.14.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akhilsharmaa We can't insert the dependency github.com/influxdata/influxdb-client-go/v2 inside GoFr's go.mod. The whole reason to create a separate directory inside pkg/gofr/datasource was that datasources will have their own go.mod files and GoFr binary file will be clean. Please follow the same for InfluxDB too.

@@ -721,3 +722,52 @@ type ElasticsearchProvider interface {

provider
}

type InfluxPoint struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don;t define these struct here but only the interface and methods that are being implemented by the client of respective datasource. Please remove this InfluxPoint declaration from here.

import (
"context"
"fmt"
"gofr.dev/pkg/gofr/datasource"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imports are not sorted here

// CreateOrganization implements container.InfluxDBProvider.
func (c *Client) CreateOrganization(ctx context.Context, orgName string) (string, error) {
if orgName == "" {
return "", fmt.Errorf("org Name name must not be empty")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try and use predefined errors.

return *newOrg.Id, nil
}

// DeleteOrganization implements container.InfluxDBProvider.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The godoc comment should tell what the method does not what it is implementing.

@akhilsharmaa
Copy link
Author

@Umang01-hash thanks for the review, i am working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants