Menu
Technical documentation
Plugin catalog
Choose a product
Viewing: v0.48.x
Find another version
Grafana k6
Get started
Installation
Troubleshooting
Running k6
Results output
k6 resources
Using k6
HTTP Requests
Metrics
Create custom metrics
Built-in metrics
Checks
Thresholds
Options
How to use options
Options reference
Test lifecycle
Modules
Tags and Groups
Cookies
Protocols
HTTP/2
WebSockets
gRPC
SSL/TLS
Online Certificate Status Protocol (OCSP)
SSL/TLS client certificates
SSL/TLS version and ciphers
Environment variables
Execution context variables
Scenarios
Concepts
Graceful stop
Arrival-rate VU allocation
Dropped iterations
Open and closed models
Executors
Shared iterations
Per VU iterations
Constant VUs
Ramping VUs
Constant arrival rate
Ramping arrival rate
Externally controlled
Advanced Examples
Test authoring
Test builder
Create tests from recordings
Using the browser recorder
Using the HAR converter
Using k6 browser
Running browser tests
Browser metrics
Migrating to k6 v0.46
Recommended practices
Hybrid approach to performance
Page object model
Selecting elements
Results output
End of test
Custom summary
Real time
Amazon CloudWatch
Apache Kafka
CSV
Datadog
Dynatrace
Elasticsearch
Grafana Cloud k6
Grafana Cloud Prometheus
InfluxDB
JSON
Netdata
New Relic
Prometheus remote write
StatsD
TimescaleDB
Grafana dashboards
Testing guides
Load test types
Smoke testing
Average-load testing
Stress testing
Soak testing
Spike testing
Breakpoint testing
API load testing
Automated performance testing
Load testing websites
Running large tests
Running distributed tests
Injecting faults with xk6-disruptor
xk6-disruptor first steps
Requirements
Installation
Expose your application
How xk6-disruptor works
xk6-disruptor examples
Inject gRPC faults into Service
Inject HTTP faults into Pod
Interactive demo
JavaScript API
Init context
open( filePath, [mode] )
k6
check( val, sets, [tags] )
fail( [err] )
group( name, fn )
randomSeed( int )
sleep( t )
k6/crypto
createHash( algorithm )
createHMAC( algorithm, secret )
hmac( algorithm, secret, data, outputEncoding )
md4( input, outputEncoding )
md5( input, outputEncoding )
randomBytes( int )
ripemd160( input, outputEncoding )
sha1( input, outputEncoding )
sha256( input, outputEncoding )
sha384( input, outputEncoding )
sha512( input, outputEncoding )
sha512_256( input, outputEncoding )
sha512_224( input, outputEncoding )
Hasher
k6/data
SharedArray
k6/encoding
b64decode( input, [encoding], [format] )
b64encode( input, [encoding] )
k6/execution
k6/experimental
browser
BrowserContext
addCookies()
addInitScript()
clearCookies()
clearPermissions()
close()
Cookie
cookies([urls])
grantPermissions(permissions[, options])
newPage()
pages()
setDefaultNavigationTimeout(timeout)
setDefaultTimeout(timeout)
setGeolocation(geolocation)
setOffline(offline)
waitForEvent(event[, optionsOrPredicate])
ConsoleMessage
ElementHandle
Frame
JSHandle
Keyboard
Locator
check([options])
click([options])
dblclick([options])
dispatchEvent(type, eventInit, [options])
fill(value, [options])
focus([options])
getAttribute(name, [options])
hover([options])
innerHTML([options])
innerText([options])
inputValue([options])
isChecked([options])
isDisabled([options])
isEditable([options])
isEnabled([options])
isHidden([options])
isVisible([options])
press(key, [options])
selectOption(values, [options])
tap([options])
textContent([options])
type(text, [options])
uncheck([options])
waitFor([options])
Mouse
Page
$(selector)
$$(selector)
bringToFront()
check(selector[, options])
click(selector[, options])
close()
content()
context()
dblclick(selector[, options])
dispatchEvent(selector, type, eventInit[, options])
emulateMedia([options])
emulateVisionDeficiency(type)
evaluate(pageFunction[, arg])
evaluateHandle(pageFunction[, arg])
fill(selector, value[, options])
focus(selector[, options])
frames()
getAttribute(selector, name[, options])
goto(url[, options])
hover(selector[, options])
innerHTML(selector[, options])
innerText(selector[, options])
inputValue(selector[, options])
isChecked(selector[, options])
isClosed()
isDisabled(selector[, options])
isEditable(selector[, options])
isEnabled(selector[, options])
isHidden(selector[, options])
isVisible(selector[, options])
keyboard
locator(selector)
mainFrame()
mouse
on(event, handler)
opener()
press(selector, key[, options])
reload([options])
screenshot([options])
selectOption(selector, values[, options])
setContent(html[, options])
setDefaultNavigationTimeout(timeout)
setDefaultTimeout(timeout)
setExtraHTTPHeaders(headers)
setViewportSize(viewportSize)
tap(selector[, options])
textContent(selector[, options])
throttleCPU(cpuProfile)
throttleNetwork(networkProfile)
title()
touchScreen
type(selector, text[, options])
uncheck(selector[, options])
url()
viewportSize()
waitForFunction(pageFunction, arg[, options])
waitForLoadState(state[, options])
waitForNavigation([options])
waitForSelector(selector[, options])
waitForTimeout(timeout)
workers()
Request
size()
Response
Touchscreen
Worker
closeContext()
context()
isConnected()
newContext([options])
newPage([options])
version()
grpc
Client
Client.load(importPaths, ...protoFiles)
Client.loadProtoset(protosetPath)
Client.connect(address [,params])
Client.invoke(url, request [,params])
Client.close()
Params
Response
Stream
Stream.on()
Error
Stream.end()
Stream.write()
Constants
redis
Client
Client.decr(key)
Client.decrBy(key, decrement)
Client.del(keys)
Client.exists(keys)
Client.expire(key, seconds)
Client.get(key)
Client.getDel(key)
Client.getSet(key, value)
Client.hdel(key, fields)
Client.hget(key, field)
Client.hgetall(key)
Client.hincrby(key, field, increment)
Client.hkeys(key)
Client.hlen(key)
Client.hset(key, field, value)
Client.hsetnx(key, field, value)
Client.hvals(key)
Client.incr(key)
Client.incrBy(key, increment)
Client.lindex(key)
Client.llen(key)
Client.lpop(key)
Client.lpush(key, values)
Client.lrange(key, start, stop)
Client.lrem(key, count, value)
Client.lset(key, index, element)
Client.mget(keys)
Client.persist(key)
Client.randomKey()
Client.rpop(key)
Client.rpush(key, values)
Client.sadd(key, members)
Client.sendCommand(command, args)
Client.set(key, value, expiration)
Client.sismember(key, member)
Client.smembers(key)
Client.spop(key)
Client.srandmember(key)
Client.srem(key, members)
Client.ttl(key)
Options
timers
tracing
instrumentHTTP
Client
Options
websockets
WebSocket
WebSocket.addEventListener(event, handler)
WebSocket.send(data)
WebSocket.close([code])
WebSocket.ping()
WebSocket.onclose
WebSocket.onerror
WebSocket.onmessage
WebSocket.onopen
WebSocket.onping
WebSocket.onpong
Params
webcrypto
Crypto
getRandomValues
randomUUID
SubtleCrypto
decrypt
digest
encrypt
exportKey
generateKey
importKey
sign
verify
CryptoKey
AesKeyGenParams
HmacKeyGenParams
AesCtrParams
AesCbcParams
AesGcmParams
fs
File
read
seek
stat
open
FileInfo
SeekMode
k6/html
parseHTML( src )
Element
Selection
Selection.attr(name)
Selection.children([selector])
Selection.closest(selector)
Selection.contents()
Selection.data([key])
Selection.each(fn)
Selection.eq(index)
Selection.filter(selector)
Selection.find(selector)
Selection.first()
Selection.get(index)
Selection.has(selector)
Selection.html()
Selection.is(selector)
Selection.last()
Selection.map(fn)
Selection.next([selector])
Selection.nextAll([selector])
Selection.nextUntil([selector], [filter])
Selection.not(selector)
Selection.parent([selector])
Selection.parents([selector])
Selection.parentsUntil([selector], [filter])
Selection.prev([selector])
Selection.prevAll([selector])
Selection.prevUntil([selector], [filter])
Selection.serialize()
Selection.serializeArray()
Selection.serializeObject()
Selection.size()
Selection.slice(start [, end])
Selection.text()
Selection.toArray()
Selection.val()
k6/http
asyncRequest( method, url, [body], [params] )
batch( requests )
del( url, [body], [params] )
file( data, [filename], [contentType] )
get( url, [params] )
head( url, [params] )
options( url, [body], [params] )
patch( url, [body], [params] )
post( url, [body], [params] )
put( url, [body], [params] )
request( method, url, [body], [params] )
setResponseCallback( callback )
url\`url\`
expectedStatuses( statuses )
CookieJar
CookieJar.clear(url)
CookieJar.cookiesForURL(url)
CookieJar.delete(url, name)
CookieJar.set(url, name, value, [options])
FileData
Params
Response
Response.clickLink( [params] )
Response.html()
Response.json( [selector] )
Response.submitForm( [params] )
k6/metrics
Counter
Counter.add(value, [tags])
Gauge
Gauge.add(value, [tags])
Rate
Rate.add(value, [tags])
Trend
Trend.add(value, [tags])
k6/net/grpc
Client
Client.load(importPaths, ...protoFiles)
Client.loadProtoset(protosetPath)
Client.connect(address [,params])
Client.invoke(url, request [,params])
Client.close()
Params
Response
Constants
k6/ws
connect( url, params, callback )
Params
Socket
Socket.close([code])
Socket.on(event, callback)
Socket.ping()
Socket.send(data)
Socket.sendBinary(data)
Socket.setInterval(callback, interval)
Socket.setTimeout(callback, delay)
Error Codes
xk6-disruptor API
Get started
Faults
gRPC
HTTP
Pod Termination
PodDisruptor
Constructor
injectGrpcFaults()
injectHTTPFaults()
terminatePods()
ServiceDisruptor
Constructor
injectGrpcFaults
injectHTTPFaults
terminatePods()
jslib
aws
AWSConfig
EventBridgeClient
putEvents
KMSClient
generateDataKey
listKeys
KMSDataKey
KMSKey
LambdaClient
invoke
S3Client
abortMultipartUpload
completeMultipartUpload
copyObject
createMultipartUpload
deleteObject
getObject
listBuckets
listObjects
putObject
uploadPart
Bucket
Object
S3MultipartUpload
S3Part
S3UploadedObject
SecretsManagerClient
createSecret
deleteSecret
getSecret
listSecrets
putSecretValue
Secret
SignatureV4
presign
sign
SQSClient
deleteMessage
listQueues
receiveMessages
sendMessage
sendMessageBatch
SystemsManagerClient
getParameter
SystemsManagerParameter
httpx
asyncRequest(method, url, [body], [params])
request(method, url, [body], [params])
get(url, [body], [params])
post(url, [body], [params])
put(url, [body], [params])
patch(url, [body], [params])
delete(url, [body], [params])
options(url, [body], [params])
head(url, [body], [params])
trace(url, [body], [params])
batch( requests )
setBaseUrl( url )
addHeader( key, value )
addHeaders( object )
clearHeader( name )
addTag( key, value )
addTags( object )
clearTag( name )
k6chaijs
config
describe( name, function )
expect()
Error handling
utils
randomIntBetween(min, max)
randomItem(array)
randomString(length, [charset])
uuidv4()
findBetween(content, left, right, [repeat])
normalDistributionStages(maxVus, durationSeconds, [numberOfStages])
Extensions
Explore extensions
Build a k6 binary using Go
Build a k6 binary using Docker
Create an extension
JavaScript Extensions
Output Extensions
Explanations
About the Extensions Registry
About the Go-to-JS bridge
Extension Graduation
Examples
Get started with k6
Test for functional behavior
Test for performance
Analyze results
Reuse and re-run tests
Single request
HTTP Authentication
OAuth Authentication
Correlation and Dynamic Data
Data Parameterization
Parse HTML
HTML Forms
Cookies Example
Data Uploads
API CRUD Operations
Generating UUIDs
HTTP2
WebSockets
SOAP
Transport Layer Security (TLS)
Generating realistic data
Crawl a web page
Bundling and transpilation
Functional testing
Track transmitted data per URL
URLs with query parameters
Instant load increase
Get timings for an HTTP metric
Distribute workloads across VUs
Error handler
Tutorials
Misc
Integrations & Tools
Usage collection
IntelliSense
Fine-tuning OS
Archive Command
Release notes
Glossary
Scroll for more
Documentation
Grafana k6
Misc
Open source
Misc
Integrations & Tools
Usage collection
IntelliSense
Fine-tuning OS
Archive Command
Release notes
Glossary
Was this page helpful?
Yes
No
Create a GitHub issue
Email docs@grafana.com
Help and support
Community