Skip to content
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

Add influx2.0 output plugin #4645

Merged
merged 11 commits into from
Sep 12, 2018
Merged

Add influx2.0 output plugin #4645

merged 11 commits into from
Sep 12, 2018

Conversation

glinton
Copy link
Contributor

@glinton glinton commented Sep 6, 2018

No description provided.

@glinton glinton added this to the 1.8.0 milestone Sep 6, 2018
if err != nil {
return fmt.Errorf("Bad value for 'Retry-After': %s", err.Error())
}
time.Sleep(time.Second * time.Duration(retry))
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want a max sleep just in case the server says you sleep for a long time.

Copy link
Contributor

Choose a reason for hiding this comment

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

10s seems reasonable to me as a max sleep. The big issue with the influxdb output is that, when under load, the next filled batch will almost immediately trigger the next write even after a write timeout.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh but don't sleep and write because of #2919, hang on to the time and return. On the next call to Write check the time and if the amount of time has not passed then return an error.

Let's define a special error type specifically for this, something like CircuitOpenErr? We can put it in the internal package for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the failed to write metric get cached, timestamp included? If the next call to write is less than the initial retry-time, would that second metric also get cached and be written on the next attempt that is after the retry-time? If the next write also returns a retry-time, is it acceptable to drop that new metric, even though it didn't get a chance to retry?
I put in a max retries limit based on the connection/httpClient, but it seemed wrong, would that be useful to put back in?

plugins/outputs/influxdb_v2/influxdb.go Outdated Show resolved Hide resolved
plugins/outputs/influxdb_v2/http.go Outdated Show resolved Hide resolved
plugins/outputs/influxdb_v2/http.go Outdated Show resolved Hide resolved
plugins/outputs/influxdb_v2/http.go Outdated Show resolved Hide resolved
plugins/outputs/influxdb_v2/http.go Outdated Show resolved Hide resolved
if err != nil {
return fmt.Errorf("Bad value for 'Retry-After': %s", err.Error())
}
time.Sleep(time.Second * time.Duration(retry))
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh but don't sleep and write because of #2919, hang on to the time and return. On the next call to Write check the time and if the amount of time has not passed then return an error.

Let's define a special error type specifically for this, something like CircuitOpenErr? We can put it in the internal package for now.

plugins/outputs/influxdb_v2/http.go Outdated Show resolved Hide resolved
plugins/outputs/influxdb_v2/http.go Outdated Show resolved Hide resolved
plugins/outputs/influxdb_v2/http.go Outdated Show resolved Hide resolved
}

i.serializer = influx.NewSerializer()
i.serializer.SetFieldTypeSupport(influx.UintSupport)
Copy link
Contributor

Choose a reason for hiding this comment

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

@goller do we want this set?

Copy link
Contributor

Choose a reason for hiding this comment

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

@danielnelson , yes. We support uint.

Copy link
Contributor

@danielnelson danielnelson Sep 12, 2018

Choose a reason for hiding this comment

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

Is uint always desired? If someone imported non-uint data into the database, from say InfluxDB 1.6, this would be a change of type and could result in new data being uninsertable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like an issue for db migrations, right? This flag only allows the plugin to add uints if they are configured/used, if i understand correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Plus, with a major version change there are bound to have some incompatibilities. Keeping this always set seems like the best thing since the database supports uints from the getgo.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think a data migration could handle this since the database doesn't know what should be a int/uint. When it comes to Telegraf generated data, the only way to determine it today is by reading the code.

retry = 0
}
if retry > defaultMaxWait {
log.Println("E! [outputs.influxdb_v2] Failed to write metric: retry interval too long")
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this more like:

if retry > defaultMaxWait {
    retry = defaultMaxWait
}


## Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "identity"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's change the default to gzip.

@danielnelson danielnelson merged commit 1fdf032 into master Sep 12, 2018
@danielnelson danielnelson deleted the feature/influx2output branch September 12, 2018 21:49
rgitzel pushed a commit to rgitzel/telegraf that referenced this pull request Oct 17, 2018
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants